[Splash > UI] Add version info in corner

This commit is contained in:
Ducko 2021-12-13 18:30:38 +00:00
parent 46f57c95f3
commit 9bd97701d5
3 changed files with 29 additions and 22 deletions

View File

@ -5,6 +5,8 @@
<div id="bar-container"></div> <div id="bar-container"></div>
<div id="bar-fill"></div> <div id="bar-fill"></div>
<div id="debug"></div>
<style> <style>
@font-face { @font-face {
font-family: Whitney; font-family: Whitney;
@ -82,6 +84,17 @@
transform: translate(0%, -50%); transform: translate(0%, -50%);
left: 10%; left: 10%;
} }
#debug {
position: absolute;
bottom: 6px;
right: 6px;
text-align: right;
font-size: 10px;
color: #72767d;
white-space: pre;
}
</style> </style>
<script> <script>
@ -107,4 +120,6 @@
barFill.style.display = ''; barFill.style.display = '';
} }
}); });
document.querySelector('#debug').textContent = DiscordSplash.getDebugInfo();
</script> </script>

View File

@ -1,36 +1,28 @@
"use strict"; const { app, contextBridge, ipcRenderer } = require('electron');
const { const { saferShellOpenExternal } = require('../utils/securityUtils');
app,
contextBridge,
ipcRenderer
} = require('electron');
const {
saferShellOpenExternal
} = require('../utils/securityUtils');
contextBridge.exposeInMainWorld('DiscordSplash', { contextBridge.exposeInMainWorld('DiscordSplash', {
getReleaseChannel: () => {
const buildInfo = require('../utils/buildInfo');
return buildInfo.releaseChannel;
},
signalReady: () => { signalReady: () => {
ipcRenderer.send('DISCORD_SPLASH_SCREEN_READY'); ipcRenderer.send('DISCORD_SPLASH_SCREEN_READY');
}, },
onStateUpdate: callback => { onStateUpdate: callback => {
ipcRenderer.on('DISCORD_SPLASH_UPDATE_STATE', (_, state) => { ipcRenderer.on('DISCORD_SPLASH_UPDATE_STATE', (_, state) => {
callback(state); callback(state);
}); });
}, },
onQuoteUpdate: callback => {
ipcRenderer.on('DISCORD_SPLASH_SCREEN_QUOTE', (_, quote) => {
callback(quote);
});
},
openUrl: saferShellOpenExternal, openUrl: saferShellOpenExternal,
quitDiscord: () => { quitDiscord: () => ipcRenderer.send('DISCORD_SPLASH_SCREEN_QUIT'),
ipcRenderer.send('DISCORD_SPLASH_SCREEN_QUIT');
getDebugInfo: () => {
const buildInfo = require('../utils/buildInfo');
const urlParams = new URLSearchParams(window.location.search);
return `${buildInfo.releaseChannel} ${buildInfo.version}
OpenAsar ${urlParams.get('oaVersion')}`;
} }
}); });

View File

@ -487,7 +487,7 @@ function launchSplashWindow(startMinimized) {
pathname: _path.default.join(__dirname, 'index.html') pathname: _path.default.join(__dirname, 'index.html')
}); });
splashWindow.loadURL(splashUrl); splashWindow.loadURL(splashUrl + '?oaVersion=' + global.oaVersion);
log('Splash', `Loading window (with url ${splashUrl})`); log('Splash', `Loading window (with url ${splashUrl})`);
} }