[Splash] Move HTML to remote

This commit is contained in:
Ducko 2022-04-03 18:40:20 +01:00
parent a02324003b
commit 19d24b1eb6
2 changed files with 1 additions and 132 deletions

View file

@ -1,131 +0,0 @@
<video loop autoplay src="https://cdn.openasar.dev/discord_loading.webm"></video>
<div id="text">Starting...</div>
<div id="barContainer"><div id="barFill"></div></div>
<div id="debug"></div>
<style>
:root {
--background-primary: #282b30;
--background-secondary: rgba(255, 255, 255, 0.1);
--brand-experiment: #5865F2;
--header-primary: #fff;
--text-muted: #72767d;
--font-primary: 'Whitney';
}
@font-face {
font-family: Whitney;
src: url(https://cdn.openasar.dev/whitney_400.woff) format("woff");
}
html, body {
-webkit-app-region: drag;
overflow: hidden;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: var(--background-primary);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
* {
font-family: var(--font-primary), 'Whitney', sans-serif;
box-sizing: border-box;
user-select: none;
cursor: default;
}
video {
width: 200px;
height: 150px;
object-fit: cover;
}
#text {
text-align: center;
color: var(--header-primary);
font-weight: 400;
font-style: italic;
font-size: 16px;
text-transform: uppercase;
width: 100%;
}
#barContainer, #barFill {
width: 180px;
height: 8px;
border-radius: 4px;
visibility: hidden;
}
#barContainer {
background-color: var(--background-secondary);
position: relative;
margin-top: 12px;
}
#barFill {
background-color: var(--brand-experiment);
width: 0;
}
#debug {
position: absolute;
bottom: 6px;
right: 6px;
text-align: right;
font-size: 10px;
color: var(--text-muted);
white-space: pre;
}
</style>
<script>
Splash.onState(({ status, current, total, progress, seconds }) => {
let statusText = status.replaceAll('-', ' ');
let showProgress = false;
switch (status) {
case 'downloading': // X of Y states
case 'installing':
statusText = statusText + ` update ${current} of ${total}`; // Remove "s" and concat
showProgress = true;
break;
case 'fail': // Custom for update failure, include retry and reorder text
statusText = `Update Failed - Retrying in ${seconds}`;
break;
}
text.textContent = statusText;
if (showProgress) {
barContainer.style.visibility = 'visible';
barFill.style.visibility = 'visible';
barFill.style.width = 100 * (progress / 100) + '%';
} else {
barContainer.style.visibility = '';
barFill.style.visibility = '';
}
});
</script>

View file

@ -108,7 +108,7 @@ const launchSplashWindow = (startMinimized) => {
});
if (!startMinimized) win.once('ready-to-show', () => win.show());
win.loadURL('file:///' + join(__dirname, 'index.html'));
win.loadURL('https://cdn.openasar.dev/splash');
};