[Splash] Rewrite config passing

This commit is contained in:
Ducko 2021-12-17 15:08:06 +00:00
parent a4280d4562
commit 199cf23a7a
2 changed files with 4 additions and 4 deletions

View file

@ -3,7 +3,7 @@ const { app, contextBridge, ipcRenderer } = require('electron');
const { saferShellOpenExternal } = require('../utils/securityUtils'); const { saferShellOpenExternal } = require('../utils/securityUtils');
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const oaConfig = JSON.parse(urlParams.get('oaConfig'));
contextBridge.exposeInMainWorld('DiscordSplash', { contextBridge.exposeInMainWorld('DiscordSplash', {
signalReady: () => { signalReady: () => {
@ -20,7 +20,7 @@ contextBridge.exposeInMainWorld('DiscordSplash', {
quitDiscord: () => ipcRenderer.send('DISCORD_SPLASH_SCREEN_QUIT'), quitDiscord: () => ipcRenderer.send('DISCORD_SPLASH_SCREEN_QUIT'),
getDebugInfo: () => { getDebugInfo: () => {
if (urlParams.get('oaSplashText') === 'false') return ''; if (oaConfig.splashText === false) return '';
const buildInfo = require('../utils/buildInfo'); const buildInfo = require('../utils/buildInfo');
@ -28,7 +28,7 @@ contextBridge.exposeInMainWorld('DiscordSplash', {
OpenAsar ${urlParams.get('oaVersion')}`; OpenAsar ${urlParams.get('oaVersion')}`;
}, },
getCSS: callback => urlParams.get('oaThemeSync') !== 'false' ? ipcRenderer.on('DISCORD_GET_CSS', (_, value) => { getCSS: callback => oaConfig.themeSync !== 'false' ? ipcRenderer.on('DISCORD_GET_CSS', (_, value) => {
callback(value); callback(value);
}) : {} }) : {}
}); });

View file

@ -493,7 +493,7 @@ function launchSplashWindow(startMinimized) {
log('Splash', 'Failed to inject splash CSS'); log('Splash', 'Failed to inject splash CSS');
} }
splashWindow.loadURL(splashUrl + '?oaVersion=' + global.oaVersion + '&oaThemeSync=' + oaConfig.themeSync + '&oaSplashText' + oaConfig.splashText); splashWindow.loadURL(splashUrl + '?oaVersion=' + global.oaVersion + '&oaConfig=' + JSON.stringify(oaConfig));
log('Splash', `Loading window (with url ${splashUrl})`); log('Splash', `Loading window (with url ${splashUrl})`);
} }