Skip to content

Commit

Permalink
feat(release): publish 3.6.1 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnrdrata committed May 28, 2024
1 parent 249d196 commit e04e0c1
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drata-agent",
"version": "3.6.0",
"version": "3.6.1",
"description": "The Drata Agent is a light-weight tray-application that runs in the background, reporting important read-only data to Drata about your machine's state for compliance tracking.",
"author": "Drata Inc. <[email protected]> (https://drata.com)",
"private": true,
Expand Down
6 changes: 3 additions & 3 deletions src/assets/data/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@
"We are making Drata even better than before.": "We are making Drata even better than before.",
"Hide Agent": "Hide Agent",
"Register": "Register",
"Save Diagnostics": "Save Diagnostics",
"Enable Resize": "Enable Resize",
"Save diagnostics": "Save diagnostics",
"Enable resize": "Enable resize",
"Drata Agent update required. Please quit the application to install.": "Drata Agent update required. Please quit the application to install.",
"Send Diagnostics": "Send Diagnostics",
"Send diagnostics": "Send diagnostics",
"Click Okay to send errors to Drata.": "Click Okay to send errors to Drata."
}
1 change: 1 addition & 0 deletions src/enums/sync-state.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export enum SyncState {
SUCCESS,
ERROR,
RUNNING,
UNKNOWN,
}
3 changes: 1 addition & 2 deletions src/main/helpers/auto-launcher.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ export class AutoLauncherHelper {
}

const autoLauncher = new AutoLaunch(options);

const isEnabled = await autoLauncher.isEnabled();

if (isEnabled) {
if (isEnabled && !PLATFORM.MACOS) {
await autoLauncher.disable();
await autoLauncher.enable();
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/main/helpers/axios.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class AxiosHelper {
static instance: AxiosHelper = new AxiosHelper();
private readonly dataStore = DataStoreHelper.instance;
private readonly axiosInstance = axios.create();
private readonly REQUEST_TIMEOUT = 5 * 60 * 1000;

private constructor() {
// prepare headers for requests
Expand All @@ -23,7 +24,7 @@ export class AxiosHelper {
if (isNil(uuid)) {
this.dataStore.set('uuid', crypto.randomUUID());
}

config.timeout = this.REQUEST_TIMEOUT;
config.baseURL = resolveBaseUrl(region);
config.headers.Authorization = `Bearer ${this.dataStore.get(
'accessToken',
Expand Down
19 changes: 17 additions & 2 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ class DrataAgent {
);
}

this.resolveRunningSyncState(); // shouldn't be running on launch

const hasAccessToken = !!this.dataStore.get('accessToken');
const region = this.dataStore
.get('region')
Expand Down Expand Up @@ -162,7 +164,12 @@ class DrataAgent {
// this will not stop jobs already running
app.on('before-quit', this.scheduler.stopAllJobs.bind(this));
powerMonitor.on('suspend', this.scheduler.stopAllJobs.bind(this));
powerMonitor.on('resume', this.scheduler.startAllJobs.bind(this));
powerMonitor.on('resume', () => {
this.resolveRunningSyncState(); // allow new sync on resume
setTimeout(() => {
this.scheduler.startAllJobs();
}, Math.max(config.secondsDelaySyncOnStart, config.secondsDelayUpdateCheckOnStart));
});

// run and schedule app auto update
this.autoUpdate = new AutoUpdateHelper(this.mb, this.bridge);
Expand Down Expand Up @@ -192,6 +199,13 @@ class DrataAgent {
}
}

private resolveRunningSyncState() {
if (this.dataStore.get('syncState') === SyncState.RUNNING) {
this.dataStore.set('syncState', SyncState.UNKNOWN);
this.logger.warn('Reset sync to unknown.');
}
}

private installDevTools() {
if (!TARGET_ENV.PROD) {
installExtension(REDUX_DEVTOOLS)
Expand Down Expand Up @@ -239,6 +253,7 @@ class DrataAgent {
this.logger.info('System query started.');
const queryResults =
await this.systemQueryService.getSystemInfo();
queryResults.manualRun = manualRun;
this.logger.info('System query successfully completed.');

this.logger.info('Sending query results.');
Expand Down Expand Up @@ -268,7 +283,7 @@ class DrataAgent {
private get shouldRunSync(): boolean {
// don't sync while already in progress
if (this.dataStore.get('syncState') === SyncState.RUNNING) {
this.logger.info('Sync aborted. Sync in progress.');
this.logger.info('Sync aborted due to sync already in progress.');
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ScreenLockSetting } from './screen-lock-setting-interface';
export type QueryResult = {
drataAgentVersion: string;
platform: 'MACOS' | 'WINDOWS' | 'LINUX';
manualRun?: boolean;
rawQueryResults: {
osVersion: any;
hwSerial: any;
Expand Down

0 comments on commit e04e0c1

Please sign in to comment.