Merge pull request #905 from KiranNiranjan/SDA-1859

fix: SDA-1859 (Update the config logic & Hide menu items instead of disabling it)
This commit is contained in:
Johan Kwarnmark 2020-03-12 13:53:41 +01:00 committed by GitHub
commit f5f2058500
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 42 deletions

View File

@ -7,7 +7,6 @@ import { buildNumber } from '../../package.json';
import { isDevEnv, isElectronQA, isLinux, isMac } from '../common/env';
import { logger } from '../common/logger';
import { filterOutSelectedValues, pick } from '../common/utils';
import { getDefaultUserConfig } from './config-utils';
const writeFile = util.promisify(fs.writeFile);
@ -307,8 +306,9 @@ class Config {
if (!fs.existsSync(this.userConfigPath)) {
// Need to wait until app ready event to access user data
await app.whenReady();
await this.readGlobalConfig();
logger.info(`config-handler: user config doesn't exist! will create new one and update config`);
await this.updateUserConfig({ configVersion: app.getVersion().toString(), buildNumber, ...getDefaultUserConfig() } as IConfig);
await this.updateUserConfig({ configVersion: app.getVersion().toString(), buildNumber, ...this.globalConfig } as IConfig);
}
this.userConfig = this.parseConfigData(fs.readFileSync(this.userConfigPath, 'utf8'));
logger.info(`config-handler: User configuration: `, this.userConfig);

View File

@ -1,40 +0,0 @@
/**
* Returns the default user config data
*/
import { CloudConfigDataTypes, IConfig } from './config-handler';
export const getDefaultUserConfig = (): IConfig => {
return {
minimizeOnClose: CloudConfigDataTypes.ENABLED,
launchOnStartup: CloudConfigDataTypes.ENABLED,
alwaysOnTop: CloudConfigDataTypes.DISABLED,
bringToFront: CloudConfigDataTypes.DISABLED,
whitelistUrl: '*',
isCustomTitleBar: CloudConfigDataTypes.ENABLED,
memoryRefresh: CloudConfigDataTypes.ENABLED,
memoryThreshold: '800',
disableGpu: false,
devToolsEnabled: true,
ctWhitelist: [],
podWhitelist: [],
notificationSettings: {
position: 'upper-right',
display: '',
},
customFlags: {
authServerWhitelist: '',
authNegotiateDelegateWhitelist: '',
disableThrottling: false,
},
permissions: {
media: true,
geolocation: true,
notifications: true,
midiSysex: true,
pointerLock: true,
fullscreen: true,
openExternal: true,
},
autoLaunchPath: '',
};
};