diff --git a/src/splash/index.html b/src/splash/index.html
index 9c3425f..1387e6e 100644
--- a/src/splash/index.html
+++ b/src/splash/index.html
@@ -106,8 +106,6 @@
const barContainer = document.querySelector('#bar-container');
const barFill = document.querySelector('#bar-fill');
- DiscordSplash.signalReady();
-
DiscordSplash.onStateUpdate(({ status, current, total, progress, seconds }) => {
let statusText = status.replaceAll('-', ' ');
let showProgress = false;
diff --git a/src/splash/index.js b/src/splash/index.js
index 3b0a551..3d4b317 100644
--- a/src/splash/index.js
+++ b/src/splash/index.js
@@ -377,6 +377,7 @@ function launchSplashWindow(startMinimized) {
resizable: false,
center: true,
show: false,
+ backgroundColor: '#2f3136',
webPreferences: {
nodeIntegration: false,
enableRemoteModule: false,
@@ -399,21 +400,20 @@ function launchSplashWindow(startMinimized) {
});
}
- ipcMain.on('DISCORD_SPLASH_SCREEN_READY', () => {
- log('Splash', 'Window declared ready, showing and starting update process');
+ const win = splashWindow;
+ const wc = win.webContents;
+ wc.once('dom-ready', () => {
if (oaConfig.themeSync !== false) try { // Inject themesync CSS
- splashWindow.webContents.insertCSS(JSON.parse(_fs.default.readFileSync(_path.default.join(paths.getUserData(), 'userDataCache.json'), 'utf8')).openasarSplashCSS);
+ wc.insertCSS(JSON.parse(_fs.default.readFileSync(_path.default.join(paths.getUserData(), 'userDataCache.json'), 'utf8')).openasarSplashCSS);
} catch (e) { }
if (oaConfig.splashText === true) try {
const buildInfo = require('../utils/buildInfo.js');
- splashWindow.webContents.executeJavaScript(`debug.textContent = '${buildInfo.releaseChannel} ${buildInfo.version}\\nOpenAsar ${oaVersion}'`);
+ wc.executeJavaScript(`debug.textContent = '${buildInfo.releaseChannel} ${buildInfo.version}\\nOpenAsar ${oaVersion}'`);
} catch (e) { }
- if (splashWindow && !startMinimized) {
- splashWindow.show();
- }
+ if (!startMinimized) win.once('ready-to-show', () => win.show());
});
const splashUrl = _url.default.format({
@@ -422,7 +422,7 @@ function launchSplashWindow(startMinimized) {
pathname: _path.default.join(__dirname, 'index.html')
});
- splashWindow.loadURL(splashUrl);
+ win.loadURL(splashUrl);
log('Splash', `Loading window (with url ${splashUrl})`);
}
diff --git a/src/splash/preload.js b/src/splash/preload.js
index f21f1cc..672becc 100644
--- a/src/splash/preload.js
+++ b/src/splash/preload.js
@@ -2,6 +2,5 @@ const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('DiscordSplash', {
- signalReady: () => ipcRenderer.send('DISCORD_SPLASH_SCREEN_READY'),
onStateUpdate: callback => ipcRenderer.on('DISCORD_SPLASH_UPDATE_STATE', (_, state) => callback(state))
});
\ No newline at end of file