2021-12-13 18:30:38 +00:00
|
|
|
const { app, contextBridge, ipcRenderer } = require('electron');
|
2021-12-09 16:25:14 +00:00
|
|
|
|
2021-12-13 18:30:38 +00:00
|
|
|
const { saferShellOpenExternal } = require('../utils/securityUtils');
|
2021-12-09 16:25:14 +00:00
|
|
|
|
2021-12-16 16:52:25 +00:00
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
2021-12-17 15:08:06 +00:00
|
|
|
const oaConfig = JSON.parse(urlParams.get('oaConfig'));
|
2021-12-09 16:25:14 +00:00
|
|
|
|
|
|
|
contextBridge.exposeInMainWorld('DiscordSplash', {
|
|
|
|
signalReady: () => {
|
|
|
|
ipcRenderer.send('DISCORD_SPLASH_SCREEN_READY');
|
|
|
|
},
|
2021-12-13 18:30:38 +00:00
|
|
|
|
2021-12-09 16:25:14 +00:00
|
|
|
onStateUpdate: callback => {
|
|
|
|
ipcRenderer.on('DISCORD_SPLASH_UPDATE_STATE', (_, state) => {
|
|
|
|
callback(state);
|
|
|
|
});
|
|
|
|
},
|
2021-12-13 18:30:38 +00:00
|
|
|
|
2021-12-09 16:25:14 +00:00
|
|
|
openUrl: saferShellOpenExternal,
|
2021-12-13 18:30:38 +00:00
|
|
|
quitDiscord: () => ipcRenderer.send('DISCORD_SPLASH_SCREEN_QUIT'),
|
|
|
|
|
|
|
|
getDebugInfo: () => {
|
2021-12-17 15:08:06 +00:00
|
|
|
if (oaConfig.splashText === false) return '';
|
2021-12-17 14:42:11 +00:00
|
|
|
|
2021-12-13 18:30:38 +00:00
|
|
|
const buildInfo = require('../utils/buildInfo');
|
|
|
|
|
|
|
|
return `${buildInfo.releaseChannel} ${buildInfo.version}
|
|
|
|
OpenAsar ${urlParams.get('oaVersion')}`;
|
2021-12-16 16:52:25 +00:00
|
|
|
},
|
|
|
|
|
2021-12-27 20:10:06 +00:00
|
|
|
getCSS: callback => oaConfig.themeSync !== false ? ipcRenderer.on('DISCORD_GET_CSS', (_, value) => {
|
2021-12-16 16:52:25 +00:00
|
|
|
callback(value);
|
|
|
|
}) : {}
|
2021-12-09 16:25:14 +00:00
|
|
|
});
|