-
Notifications
You must be signed in to change notification settings - Fork 79
Expand file tree
/
Copy pathindex.html
More file actions
182 lines (176 loc) · 7.74 KB
/
index.html
File metadata and controls
182 lines (176 loc) · 7.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Backend.AI">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="theme-color" content="#fff">
<base href="/">
<link rel="icon" href="manifest/favicon.ico">
<link rel="apple-touch-icon" sizes="256x256" href="manifest/backend-ai.iconset/icon_256x256@2x.png">
<link rel="icon" type="image/png" sizes="32x32" href="manifest/backend-ai.iconset/icon_32x32@1x.png">
<link rel="icon" type="image/png" sizes="16x16" href="manifest/backend-ai.iconset/icon_16x16@1x.png">
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" href="resources/fonts/roboto/roboto.css">
<link rel="stylesheet" href="resources/fonts/ubuntu/ubuntu.css">
<link rel="stylesheet" href="resources/webui.css">
<link rel="stylesheet" href="resources/custom.css">
<script src="manifest/app.js"></script>
<title>Backend.AI</title>
<!-- Critical inline CSS: ensures splash is visible before external CSS loads -->
<style>
body { margin: 0; background-color: rgba(247, 247, 246, 1); }
body.dark-theme { background-color: #191919; }
#splash {
position: fixed; top: 0; left: 0; width: 100%; height: 100%;
z-index: 10000; display: flex; align-items: center; justify-content: center;
background-color: rgba(247, 247, 246, 1); transition: opacity 0.3s ease-out;
}
body.dark-theme #splash { background-color: #191919; }
.splash-hidden { opacity: 0; pointer-events: none; }
</style>
<script nonce="{{nonce}}">
globalThis.isElectron = isElectron();
if (isElectron) {
globalThis.electronInitialHref = window.location.href;
}
globalThis.enableSW = true;
globalThis.packageVersion = "26.5.0-alpha.0";
globalThis.buildNumber = "7865";
globalThis.baiNonce = "{{nonce}}";
// DO NOT CHANGE BELOW LINE
// DEV_JS_INJECTING
</script>
<!-- DO NOT CHANGE BELOW LINE -->
<!-- REACT_BUNDLE_INJECTING FOR DEV-->
</head>
<body>
<script nonce="{{nonce}}">
//To avoid flickering when first loading the page, we add a class to the body to indicate the theme.
const storedThemeMode = localStorage.getItem('backendaiwebui.settings.themeMode');
const systemPrefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
// ahooks stores JSON-serialized values, so parse the stored themeMode
let parsedThemeMode;
try { parsedThemeMode = storedThemeMode ? JSON.parse(storedThemeMode) : null; } catch(e) { parsedThemeMode = null; }
if (parsedThemeMode === 'dark') {
globalThis.isDarkMode = true;
} else if (parsedThemeMode === 'light') {
globalThis.isDarkMode = false;
} else {
// 'system' or unset: use system preference
globalThis.isDarkMode = systemPrefersDark;
}
if (globalThis.isDarkMode) {
document.body.classList.add('dark-theme');
}
// Set body background immediately to prevent white flash before CSS loads
document.body.style.backgroundColor = globalThis.isDarkMode ? '#191919' : 'rgba(247, 247, 246, 1)';
</script>
<div>
<div id="react-root"></div>
<div id="splash" class="splash">
<div class="splash-drag-area"></div>
<div class="splash-card">
<div class="splash-header">
<div class="logo"></div>
</div>
<div class="splash-information">
<ul>
<li>Backend.AI Web UI <span id="version-detail" class="detail"></span></li>
<li><span id="license-detail"></span></li>
<li><span id="mode-detail" class="detail"></span> <span id="build-detail" class="detail"></span></li>
</ul>
<ul>
<li>Powered by open-source software</li>
<li class="copyright">Copyright © 2015-2026 Lablup Inc.</li>
</ul>
</div>
<div class="splash-loading">
<div class="sk-folding-cube">
<div class="sk-cube1 sk-cube"></div>
<div class="sk-cube2 sk-cube"></div>
<div class="sk-cube3 sk-cube"></div>
<div class="sk-cube4 sk-cube"></div>
</div>
<div id="loading-message" class="loading-message">Loading components...</div>
</div>
</div>
</div>
<noscript>
<p>Could not render Backend.AI Web UI. Check that JavaScript is enabled.</p>
</noscript>
<!-- Backend.AI client classes are now initialized by React global-stores.ts -->
<script nonce="{{nonce}}">
document.getElementById('version-detail').innerText = globalThis.packageVersion;
document.getElementById('build-detail').innerText = ' Build ' + globalThis.buildVersion;
document.getElementById('license-detail').innerText = '';
if (globalThis.isElectron) {
document.getElementById('mode-detail').innerText = 'App';
} else {
document.getElementById('mode-detail').innerText = 'WebServer';
}
if (globalThis.isIE) {
alert('Internet Explorer is not supported. Please visit with modern browsers.');
document.getElementById('loading-message').innerText = 'Not supported browser.';
document.getElementById('loading-message').style.color = 'red';
}
if (window.location.hostname !== '127.0.0.1' &&
!window.location.hostname.endsWith('localhost') &&
'enableSW' in globalThis &&
globalThis.enableSW === true) {
// Service worker routine.
if ('serviceWorker' in navigator && globalThis.isElectron === false) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/sw.js');
});
}
}
// Splash fade-out: React-driven dismissal.
// React calls window.__dismissSplash() when meaningful UI is ready
// (sider/header for logged-in, login form for logged-out).
// MutationObserver serves as a fallback for independent routes
// (/verify-email, /change-password, etc.) that render content quickly.
(function () {
var splash = document.getElementById('splash');
if (!splash) return;
var dismissed = false;
var observer = null;
var fallbackTimer = null;
function dismiss() {
if (dismissed) return;
dismissed = true;
if (observer) observer.disconnect();
if (fallbackTimer) clearTimeout(fallbackTimer);
splash.classList.add('splash-hidden');
splash.addEventListener('transitionend', function handler(e) {
if (e.propertyName === 'opacity') {
splash.removeEventListener('transitionend', handler);
splash.remove();
}
});
// Safety net: remove even if transitionend never fires (e.g. prefers-reduced-motion)
setTimeout(function () { if (splash.parentNode) splash.remove(); }, 1000);
}
// Primary trigger: called by React when the visible UI is ready.
// Cancels the MutationObserver fallback timer to prevent premature dismissal.
window.__dismissSplash = dismiss;
// Fallback: MutationObserver for routes that don't explicitly call __dismissSplash
// (e.g. /verify-email, /change-password). Uses a longer delay to avoid racing
// with React-driven dismissal on normal routes.
var reactRoot = document.getElementById('react-root');
if (reactRoot) {
observer = new MutationObserver(function () {
if (reactRoot.childNodes.length > 0) {
observer.disconnect();
fallbackTimer = setTimeout(dismiss, 3000);
}
});
observer.observe(reactRoot, { childList: true });
}
// Ultimate safety fallback
setTimeout(dismiss, 10000);
})();
</script>
</body>
</html>