2021-12-09 16:25:14 +00:00
|
|
|
const log = require('./utils/log');
|
2021-12-09 18:41:04 +00:00
|
|
|
global.log = log; // Make log global for easy usage everywhere
|
2021-12-11 20:09:43 +00:00
|
|
|
global.oaVersion = 'nightly';
|
2021-12-09 16:25:14 +00:00
|
|
|
|
2021-12-10 17:17:49 +00:00
|
|
|
log('Init', 'OpenAsar v' + oaVersion);
|
2021-12-09 19:27:06 +00:00
|
|
|
|
2021-12-22 19:06:57 +00:00
|
|
|
log('Init', 'Resources Path:', process.resourcesPath);
|
2022-01-12 15:15:16 +00:00
|
|
|
if (process.resourcesPath.startsWith('/usr/lib/electron')) { // Using system electron, fix process.resourcesPath
|
2021-12-22 19:06:57 +00:00
|
|
|
log('Init', 'Detected System Electron, fixing paths');
|
|
|
|
global.systemElectron = true;
|
|
|
|
|
|
|
|
const { join } = require('path');
|
|
|
|
process.resourcesPath = join(__dirname, '..');
|
|
|
|
|
|
|
|
log('Init', 'Resources Path:', process.resourcesPath);
|
|
|
|
}
|
|
|
|
|
2021-12-09 19:27:06 +00:00
|
|
|
const appSettings = require('./appSettings');
|
|
|
|
global.oaConfig = appSettings.getSettings().get('openasar', {});
|
|
|
|
|
|
|
|
log('Init', 'Loaded config', oaConfig);
|
2021-12-09 16:25:14 +00:00
|
|
|
|
2021-12-21 10:38:18 +00:00
|
|
|
require('./cmdSwitches')();
|
|
|
|
|
2021-12-12 14:41:15 +00:00
|
|
|
const appMode = process.argv?.includes('--overlay-host') ? 'overlay-host' : 'app';
|
2021-12-09 16:25:14 +00:00
|
|
|
|
2021-12-12 14:41:15 +00:00
|
|
|
if (appMode === 'overlay-host') {
|
|
|
|
const buildInfo = require('./utils/buildInfo');
|
|
|
|
|
|
|
|
if (buildInfo.newUpdater) {
|
2021-12-12 22:46:13 +00:00
|
|
|
require('./utils/u2LoadModulePath')();
|
2021-12-12 14:41:15 +00:00
|
|
|
} else {
|
|
|
|
require('./updater/moduleUpdater').initPathsOnly(buildInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
require('./utils/requireNative')('discord_overlay2/standalone_host.js')
|
|
|
|
} else {
|
|
|
|
const bootstrap = require('./bootstrap');
|
|
|
|
|
|
|
|
bootstrap(); // Start bootstrap
|
2022-01-12 15:15:16 +00:00
|
|
|
}
|