[Index] Add overlay support and rewrite some new updater code
This commit is contained in:
parent
0c2116de78
commit
308ba74a18
18
src/index.js
18
src/index.js
|
@ -9,6 +9,20 @@ global.oaConfig = appSettings.getSettings().get('openasar', {});
|
|||
|
||||
log('Init', 'Loaded config', oaConfig);
|
||||
|
||||
const bootstrap = require('./bootstrap');
|
||||
const appMode = process.argv?.includes('--overlay-host') ? 'overlay-host' : 'app';
|
||||
|
||||
bootstrap(); // Start bootstrap
|
||||
if (appMode === 'overlay-host') {
|
||||
const buildInfo = require('./utils/buildInfo');
|
||||
|
||||
if (buildInfo.newUpdater) {
|
||||
require('./utils/u2LoadModulePath')('discord_overlay2');
|
||||
} else {
|
||||
require('./updater/moduleUpdater').initPathsOnly(buildInfo);
|
||||
}
|
||||
|
||||
require('./utils/requireNative')('discord_overlay2/standalone_host.js')
|
||||
} else {
|
||||
const bootstrap = require('./bootstrap');
|
||||
|
||||
bootstrap(); // Start bootstrap
|
||||
}
|
|
@ -339,6 +339,7 @@ function initSplash(startMinimized = false) {
|
|||
destroySplash();
|
||||
|
||||
if (newUpdater != null) { // Manually load desktop_core module path for faster requiring
|
||||
require('../utils/u2LoadModulePath')('discord_desktop_core');
|
||||
const NodeModule = require('module');
|
||||
|
||||
const modulesDir = _path.default.join(paths.getExeDir(), 'modules');
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
module.exports = (moduleName) => {
|
||||
const NodeModule = require('module');
|
||||
|
||||
const modulesDir = _path.default.join(paths.getExeDir(), 'modules');
|
||||
const moduleCoreDir = _fs.default.readdirSync(modulesDir).find((x) => x.startsWith(moduleName + '-')); // Find desktop core dir by name
|
||||
|
||||
NodeModule.globalPaths.push(_path.default.join(modulesDir, moduleCoreDir)); // Add to globalPaths for requiring
|
||||
};
|
Loading…
Reference in New Issue