mirror of
https://gitlab.com/vyla-entertainment/home.git
synced 2026-11-13 13:47:21 -05:00
Completely rewrote the code, home builds locally rather on Gitlab, releases are done manually aswell
This commit is contained in:
760
ui/index.html
760
ui/index.html
@@ -14,97 +14,44 @@
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background: #000;
|
||||
color: #fff;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
canvas {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: block;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
.view-state {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 28px;
|
||||
pointer-events: none;
|
||||
width: 100%;
|
||||
animation: fadeIn 0.4s ease forwards;
|
||||
}
|
||||
|
||||
#ascii-logo {
|
||||
font-family: "Cascadia Mono", "Consolas", monospace;
|
||||
font-size: 11px;
|
||||
line-height: 1.15;
|
||||
color: rgba(255, 255, 255, .75);
|
||||
white-space: pre;
|
||||
margin: 0;
|
||||
user-select: none;
|
||||
text-shadow: 0 4px 12px rgba(0, 0, 0, .6);
|
||||
transform: scale(0.4);
|
||||
opacity: 0;
|
||||
animation: logoIn 1.1s cubic-bezier(.16, 1, .3, 1) forwards;
|
||||
.view-state.active {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
#status {
|
||||
font-size: 10px;
|
||||
font-weight: 500;
|
||||
letter-spacing: .08em;
|
||||
text-transform: uppercase;
|
||||
color: rgba(255, 255, 255, .4);
|
||||
opacity: 0;
|
||||
animation: statusIn .6s ease forwards .7s;
|
||||
}
|
||||
|
||||
@keyframes logoIn {
|
||||
0% {
|
||||
transform: scale(0.4);
|
||||
opacity: 0;
|
||||
filter: blur(6px);
|
||||
}
|
||||
|
||||
60% {
|
||||
opacity: 1;
|
||||
filter: blur(0);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
filter: blur(0);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes statusIn {
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(6px);
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.error-view {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
display: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #000;
|
||||
padding: 32px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 480px;
|
||||
text-align: center;
|
||||
@@ -114,9 +61,18 @@
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
margin: 0 auto 22px;
|
||||
}
|
||||
|
||||
.icon-error {
|
||||
color: #ff453a;
|
||||
}
|
||||
|
||||
.icon-loader {
|
||||
color: #ffffff;
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 22px;
|
||||
@@ -133,136 +89,620 @@
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
button {
|
||||
appearance: none;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
padding: 10px 18px;
|
||||
border-radius: 8px;
|
||||
padding: 11px 20px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: opacity .15s ease, transform .15s ease;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
button:hover:not(:disabled) {
|
||||
opacity: .85;
|
||||
}
|
||||
|
||||
button:active:not(:disabled) {
|
||||
transform: scale(.97);
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
cursor: default;
|
||||
opacity: .35;
|
||||
}
|
||||
|
||||
.primary {
|
||||
background: #fff;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.secondary {
|
||||
background: rgba(255, 255, 255, .1);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.progress-wrap {
|
||||
width: 100%;
|
||||
max-width: 240px;
|
||||
height: 4px;
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 999px;
|
||||
margin: 0 auto 28px;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.progress-fill {
|
||||
width: 0%;
|
||||
height: 100%;
|
||||
background: #0a84ff;
|
||||
transition: width 0.2s ease;
|
||||
}
|
||||
|
||||
.box5631 {
|
||||
transform-origin: 50% 50%;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-1 {
|
||||
9.09% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(12px, 12px);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(12px, 12px);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(12px, 12px);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(12px, 0px);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(-12px, 0px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(1) {
|
||||
animation: moveBox5631-1 4s infinite;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-2 {
|
||||
9.09% {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(12px, 12px);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(12px, 12px);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(12px, 12px);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(12px, 12px);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(0px, 12px);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(0px, 12px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(2) {
|
||||
animation: moveBox5631-2 4s infinite;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-3 {
|
||||
9.09% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(-12px, -12px);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(3) {
|
||||
animation: moveBox5631-3 4s infinite;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-4 {
|
||||
9.09% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(-12px, -12px);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(-12px, -12px);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(-12px, 0px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(4) {
|
||||
animation: moveBox5631-4 4s infinite;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-5 {
|
||||
9.09% {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(12px, -12px);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(5) {
|
||||
animation: moveBox5631-5 4s infinite;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-6 {
|
||||
9.09% {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(0px, 12px);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(-12px, 12px);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(-12px, 0px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(6) {
|
||||
animation: moveBox5631-6 4s infinite;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-7 {
|
||||
9.09% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(12px, 0);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(12px, -12px);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(12px, 0px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(7) {
|
||||
animation: moveBox5631-7 4s infinite;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-8 {
|
||||
9.09% {
|
||||
transform: translate(0, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(-12px, -12px);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(0px, -12px);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(12px, -12px);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(12px, 0px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0px);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(8) {
|
||||
animation: moveBox5631-8 4s infinite;
|
||||
}
|
||||
|
||||
@keyframes moveBox5631-9 {
|
||||
9.09% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
18.18% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
27.27% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
36.36% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
45.45% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
54.54% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
|
||||
63.63% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
72.73% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
81.81% {
|
||||
transform: translate(-24px, 0);
|
||||
}
|
||||
|
||||
90.90% {
|
||||
transform: translate(-12px, 0);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translate(0px, 0);
|
||||
}
|
||||
}
|
||||
|
||||
.box5631:nth-child(9) {
|
||||
animation: moveBox5631-9 4s infinite;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<canvas id="c"></canvas>
|
||||
<div id="view-loader" class="view-state active">
|
||||
<div class="container">
|
||||
<svg class="icon icon-loader" viewBox="-13 -13 45 45" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<circle class="box5631" cx="13" cy="1" r="5" />
|
||||
<circle class="box5631" cx="13" cy="1" r="5" />
|
||||
<circle class="box5631" cx="25" cy="25" r="5" />
|
||||
<circle class="box5631" cx="13" cy="13" r="5" />
|
||||
<circle class="box5631" cx="13" cy="13" r="5" />
|
||||
<circle class="box5631" cx="25" cy="13" r="5" />
|
||||
<circle class="box5631" cx="1" cy="25" r="5" />
|
||||
<circle class="box5631" cx="13" cy="25" r="5" />
|
||||
<circle class="box5631" cx="25" cy="25" r="5" />
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
<div class="overlay">
|
||||
<pre id="ascii-logo"></pre>
|
||||
<div id="status">Starting Vyla Home...</div>
|
||||
<h1>Starting Vyla Home</h1>
|
||||
<p id="status-msg">Initializing services...</p>
|
||||
|
||||
<div id="progress-wrap" class="progress-wrap">
|
||||
<div id="progress-fill" class="progress-fill"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="error-view" class="error-view">
|
||||
<div id="view-error" class="view-state">
|
||||
<div class="container">
|
||||
<svg class="icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<svg class="icon icon-error" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
||||
<circle cx="12" cy="12" r="10" />
|
||||
<line x1="12" y1="7" x2="12" y2="13" />
|
||||
<circle cx="12" cy="17" r="1" />
|
||||
</svg>
|
||||
|
||||
<h1>Couldn't start Vyla Home</h1>
|
||||
<p id="error-msg"></p>
|
||||
<button onclick="location.reload()">Try Again</button>
|
||||
|
||||
<div class="buttons">
|
||||
<button class="primary" onclick="location.reload()">Try Again</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
fetch('logo.txt').then(r => r.text()).then(t => {
|
||||
document.getElementById('ascii-logo').textContent = t;
|
||||
}).catch(() => { });
|
||||
const viewLoader = document.getElementById('view-loader');
|
||||
const viewError = document.getElementById('view-error');
|
||||
|
||||
const CHARS = ' .:-=+*#%@';
|
||||
const FONT_SIZE = 50;
|
||||
const canvas = document.getElementById('c');
|
||||
const ctx = canvas.getContext('2d');
|
||||
const statusMsg = document.getElementById('status-msg');
|
||||
const errorMsg = document.getElementById('error-msg');
|
||||
|
||||
let CW, CH, cols, rows, t = 0;
|
||||
let mouseX = -9999, mouseY = -9999, lastMouseMove = 0, mouseStrength = 0;
|
||||
const FADE_TIME = 250, SMOOTHING = 0.08;
|
||||
const progressWrap = document.getElementById('progress-wrap');
|
||||
const progressFill = document.getElementById('progress-fill');
|
||||
|
||||
function initFont() {
|
||||
ctx.font = FONT_SIZE + 'px "Courier New", monospace';
|
||||
CW = Math.ceil(ctx.measureText('M').width);
|
||||
CH = FONT_SIZE + 2;
|
||||
ctx.textBaseline = 'top';
|
||||
function showView(viewElement) {
|
||||
document.querySelectorAll('.view-state').forEach(el => el.classList.remove('active'));
|
||||
viewElement.classList.add('active');
|
||||
}
|
||||
|
||||
function resize() {
|
||||
canvas.width = window.innerWidth;
|
||||
canvas.height = window.innerHeight;
|
||||
initFont();
|
||||
cols = Math.ceil(canvas.width / CW) + 1;
|
||||
rows = Math.ceil(canvas.height / CH) + 1;
|
||||
}
|
||||
|
||||
window.addEventListener('resize', resize);
|
||||
window.addEventListener('mousemove', (e) => {
|
||||
const rect = canvas.getBoundingClientRect();
|
||||
mouseX = e.clientX - rect.left;
|
||||
mouseY = e.clientY - rect.top;
|
||||
lastMouseMove = performance.now();
|
||||
});
|
||||
|
||||
function plasma(cx, cy, tt) {
|
||||
const x = cx + Math.sin(cy * 3 + tt * 0.7) * 0.07;
|
||||
const y = cy + Math.cos(cx * 3 + tt * 0.5) * 0.07;
|
||||
let v =
|
||||
Math.sin(x * 10 + tt) +
|
||||
Math.sin(y * 10 + tt) +
|
||||
Math.sin((x + y) * 7 + tt) +
|
||||
Math.sin(Math.sqrt(x * x + y * y) * 12 - tt * 1.2) +
|
||||
Math.sin(x * 6 - tt * 0.8) +
|
||||
Math.sin(y * 8 + tt * 0.9);
|
||||
return (v / 6 + 1) / 2;
|
||||
}
|
||||
|
||||
function render() {
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
t += 0.03;
|
||||
const elapsed = performance.now() - lastMouseMove;
|
||||
const targetStrength = Math.max(0, 1 - elapsed / FADE_TIME);
|
||||
mouseStrength += (targetStrength - mouseStrength) * SMOOTHING;
|
||||
|
||||
for (let row = 0; row < rows; row++) {
|
||||
for (let col = 0; col < cols; col++) {
|
||||
const x = col * CW;
|
||||
const y = row * CH;
|
||||
const dx = x - mouseX;
|
||||
const dy = y - mouseY;
|
||||
const dist = Math.sqrt(dx * dx + dy * dy);
|
||||
const force = (7000 / (dist * dist + 1500)) * mouseStrength;
|
||||
const v = plasma(col / cols, row / rows, t);
|
||||
const brightness = Math.round(v * 60);
|
||||
const charIdx = Math.floor(v * (CHARS.length - 0.001));
|
||||
ctx.fillStyle = 'rgb(' + brightness + ',' + brightness + ',' + brightness + ')';
|
||||
ctx.fillText(CHARS[charIdx], x + dx * force, y + dy * force);
|
||||
if (window.__TAURI__ && window.__TAURI__.event) {
|
||||
window.__TAURI__.event.listen('status', (e) => {
|
||||
if (e.payload && e.payload.message) {
|
||||
statusMsg.textContent = e.payload.message;
|
||||
}
|
||||
}
|
||||
requestAnimationFrame(render);
|
||||
});
|
||||
|
||||
window.__TAURI__.event.listen('download-progress', (e) => {
|
||||
if (e.payload) {
|
||||
statusMsg.textContent = `Downloading update: ${e.payload.percent}%`;
|
||||
progressWrap.style.display = 'block';
|
||||
progressFill.style.width = `${e.payload.percent}%`;
|
||||
}
|
||||
});
|
||||
|
||||
window.__TAURI__.event.listen('error', (e) => {
|
||||
if (e.payload && e.payload.message) {
|
||||
errorMsg.textContent = e.payload.message;
|
||||
showView(viewError);
|
||||
}
|
||||
});
|
||||
|
||||
window.__TAURI__.event.listen('ready', (e) => {
|
||||
if (e.payload && e.payload.url) {
|
||||
window.location.href = e.payload.url;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
resize();
|
||||
render();
|
||||
|
||||
function checkBackend() {
|
||||
function pollBackend() {
|
||||
fetch('http://localhost:4890')
|
||||
.then(res => {
|
||||
if (res.ok) {
|
||||
window.location.href = 'http://localhost:4890';
|
||||
} else {
|
||||
setTimeout(checkBackend, 1000);
|
||||
}
|
||||
if (res.ok) window.location.href = 'http://localhost:4890';
|
||||
else setTimeout(pollBackend, 1000);
|
||||
})
|
||||
.catch(() => {
|
||||
setTimeout(checkBackend, 1000);
|
||||
});
|
||||
.catch(() => setTimeout(pollBackend, 1000));
|
||||
}
|
||||
|
||||
setTimeout(checkBackend, 1000);
|
||||
setTimeout(pollBackend, 1500);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user