fchat-rising/electron/common.ts

49 lines
1.4 KiB
TypeScript
Raw Permalink Normal View History

2018-01-06 16:14:21 +00:00
import * as electron from 'electron';
2017-09-02 01:50:31 +00:00
import * as path from 'path';
2020-06-30 21:51:06 +00:00
import log from 'electron-log'; //tslint:disable-line:match-default-export-name
2023-09-04 03:05:46 +00:00
log.debug('init.common');
2019-09-17 17:14:14 +00:00
export const defaultHost = 'wss://chat.f-list.net/chat2';
function getDefaultLanguage(): string {
try {
return (electron.app.getLocale() || process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || process.env.LANGUAGE || 'en-GB')
.replace(/[.:].*/, '');
} catch (err) {
return 'en-GB';
}
}
2018-01-06 16:14:21 +00:00
export class GeneralSettings {
account = '';
closeToTray = true;
profileViewer = true;
host = defaultHost;
2018-01-06 16:14:21 +00:00
logDirectory = path.join(electron.app.getPath('userData'), 'data');
spellcheckLang: string[] | string | undefined = [getDefaultLanguage()];
2018-01-06 16:14:21 +00:00
theme = 'default';
version = electron.app.getVersion();
beta = false;
2018-08-10 16:59:37 +00:00
customDictionary: string[] = [];
2018-09-28 00:08:10 +00:00
hwAcceleration = true;
2020-07-01 15:00:37 +00:00
risingCacheExpiryDays = 30;
2020-06-30 21:51:06 +00:00
risingSystemLogLevel: log.LevelOption = 'info';
risingDisableWindowsHighContrast = false;
browserPath = '';
browserArgs = '%s';
2018-01-06 16:14:21 +00:00
}
2023-09-04 03:05:46 +00:00
// //tslint:disable
// const Module = require('module');
//
// export function nativeRequire<T>(module: string): T {
// return Module.prototype.require.call({paths: Module._nodeModulePaths(__dirname)}, module);
// }
//
// //tslint:enable
2018-01-06 16:14:21 +00:00
2023-09-04 03:05:46 +00:00
log.debug('init.common.done');
2018-01-06 16:14:21 +00:00