diff --git a/src/splash/index.js b/src/splash/index.js index 57ce38d..6a89f35 100644 --- a/src/splash/index.js +++ b/src/splash/index.js @@ -20,11 +20,7 @@ exports.initSplash = (startMin = false) => { launchSplash(startMin); - if (newUpdater != null) { - updateUntilCurrent(); - } else { - moduleUpdater.installPendingUpdates(); - } + if (newUpdater != null) updateUntilCurrent(); if (process.env.OPENASAR_QUICKSTART || oaConfig.quickstart) setTimeout(() => { destroySplash(); @@ -253,7 +249,6 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only) add('installed-module', segmentCallback(installs)); add('installing-modules-finished', callbackCheck); - add('no-pending-updates', callbackCheck); const progressCallback = (tracker) => ({ name, cur, total }) => tracker.record(name, '', cur, total); @@ -267,6 +262,8 @@ const initModuleUpdater = () => { // "Old" (not v2 / new, win32 only) }); sendState(CHECKING_FOR_UPDATES); + + callbackCheck(); }; const scheduleNextUpdate = (callback = moduleUpdater.checkForUpdates) => { // Used by v1 and v2, default to v1 as used more widely in it diff --git a/src/updater/moduleUpdater.js b/src/updater/moduleUpdater.js index ac121c7..60f1c83 100644 --- a/src/updater/moduleUpdater.js +++ b/src/updater/moduleUpdater.js @@ -10,8 +10,7 @@ const request = require('./request'); const events = exports.events = new (require('events').EventEmitter)(); exports.INSTALLED_MODULE = 'installed-module'; // Fixes DiscordNative ensureModule as it uses export -let bootstrapping, - skipHost, skipModule, +let skipHost, skipModule, remote = {}, installed = {}, downloading, installing, @@ -49,8 +48,10 @@ exports.init = (endpoint, { releaseChannel, version }) => { try { installed = JSON.parse(fs.readFileSync(manifestPath)); - } catch (e) { - bootstrapping = true; + } catch { + for (const m in JSON.parse(fs.readFileSync(join(paths.getResources(), 'bootstrap', 'manifest.json')))) { // Read [resources]/bootstrap/manifest.json, with "moduleName": version (always 0) + installed[m] = { installedVersion: 0 }; // Set initial version as 0 + } } @@ -339,8 +340,6 @@ const finishInstall = (name, ver, success) => { }); resetTracking(); - - bootstrapping = false; } }; @@ -392,18 +391,4 @@ exports.install = (name, def, { version } = {}) => { } downloadModule(name, version ?? remote[name] ?? 0); -}; - -exports.installPendingUpdates = () => { - if (bootstrapping) { - log('Modules', 'Bootstrapping...'); - - for (const m in JSON.parse(fs.readFileSync(join(paths.getResources(), 'bootstrap', 'manifest.json')))) { // Read [resources]/bootstrap/manifest.json, with "moduleName": version (always 0) - installed[m] = { installedVersion: 0 }; // Set initial version as 0 - } - - return exports.checkForUpdates(); - } - - events.emit('no-pending-updates'); }; \ No newline at end of file