Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
303 lines (281 loc) · 10.8 KB
/
Copy pathindex.html
File metadata and controls
303 lines (281 loc) · 10.8 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/app-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta name="theme-color" content="#090d18" />
<title>EndProtocol</title>
<style>
#startup-splash {
position: fixed;
inset: 0;
z-index: 9999;
display: grid;
place-items: center;
overflow: hidden;
isolation: isolate;
background: #090d18;
color: #f3f5fb;
opacity: 1;
transition: opacity 420ms ease;
}
#startup-splash::before {
position: absolute;
z-index: -1;
inset: -64px;
background-image: var(--bg-image, none),
radial-gradient(circle at 15% 15%, color-mix(in oklch, var(--primary, #6366f1) 18%, transparent), transparent 42%),
radial-gradient(circle at 85% 80%, color-mix(in oklch, var(--accent, #a78bfa) 16%, transparent), transparent 38%),
linear-gradient(135deg, var(--background, #090d18), color-mix(in oklch, var(--background, #090d18) 72%, var(--primary, #6366f1)));
background-position: center, 15% 15%, 85% 80%, center;
background-size: cover, 70% 70%, 60% 60%, cover;
background-repeat: no-repeat;
opacity: var(--bg-image-opacity, 0.5);
filter: blur(var(--bg-blur, 16px));
content: "";
}
#startup-splash.is-hiding {
opacity: 0;
pointer-events: none;
}
.startup-splash-error {
width: 100%;
margin-top: 18px;
padding: 14px;
border: 1px solid rgba(255, 138, 138, 0.35);
border-radius: 14px;
background: rgba(120, 32, 32, 0.22);
color: #ffd9d9;
font: 12px/1.65 system-ui, sans-serif;
text-align: left;
box-sizing: border-box;
}
.startup-splash-error[hidden] {
display: none;
}
.startup-splash-error-detail {
max-height: 128px;
overflow: auto;
margin: 0;
white-space: pre-wrap;
word-break: break-word;
color: #f4caca;
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
font-size: 11px;
}
.startup-splash-error-status {
margin: 8px 0 0;
color: #c8d1e6;
word-break: break-all;
}
.startup-splash-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin-top: 10px;
}
.startup-splash-actions button {
appearance: none;
border: 1px solid rgba(190, 201, 230, 0.28);
border-radius: 8px;
background: rgba(255, 255, 255, 0.06);
color: #e8edfb;
cursor: pointer;
font: 12px/1 system-ui, sans-serif;
padding: 7px 10px;
transition: background 160ms ease, border-color 160ms ease;
}
.startup-splash-actions button:hover {
background: rgba(255, 255, 255, 0.12);
border-color: rgba(190, 201, 230, 0.5);
}
.startup-splash-content {
position: relative;
z-index: 1;
display: flex;
width: min(320px, calc(100vw - 48px));
flex-direction: column;
align-items: center;
transform: translateY(-12px);
}
.startup-splash-logo {
width: 88px;
height: 88px;
margin-bottom: 24px;
border-radius: 24px;
box-shadow: 0 0 52px rgba(105, 125, 255, 0.28);
animation: startup-logo-pulse 2.4s ease-in-out infinite;
}
.startup-splash-title {
margin: 0;
font: 650 22px/1.3 system-ui, sans-serif;
letter-spacing: 0.12em;
}
.startup-splash-status {
min-height: 20px;
margin: 10px 0 24px;
color: #9da8c1;
font: 13px/20px system-ui, sans-serif;
}
.startup-splash-track {
width: 100%;
height: 3px;
overflow: hidden;
border-radius: 999px;
background: rgba(190, 201, 230, 0.16);
}
.startup-splash-progress {
width: 8%;
height: 100%;
border-radius: inherit;
background: linear-gradient(90deg, #7287ff, #b4c1ff);
box-shadow: 0 0 12px rgba(130, 151, 255, 0.7);
transition: width 360ms ease;
}
@keyframes startup-logo-pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.035); }
}
@media (prefers-reduced-motion: reduce) {
.startup-splash-logo { animation: none; }
#startup-splash, .startup-splash-progress { transition-duration: 0ms; }
}
</style>
<script>
(function () {
try {
var saved = localStorage.getItem("theme");
var dark = saved
? saved === "dark"
: window.matchMedia("(prefers-color-scheme: dark)").matches;
var root = document.documentElement;
root.classList.toggle("dark", dark);
} catch (e) {}
})();
</script>
</head>
<body>
<div id="startup-splash" role="status" aria-live="polite">
<div class="startup-splash-content">
<img class="startup-splash-logo" src="/app-icon.png" alt="" />
<h1 class="startup-splash-title">EndProtocol</h1>
<p class="startup-splash-status" id="startup-splash-status"></p>
<div class="startup-splash-track" id="startup-splash-track" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="8">
<div class="startup-splash-progress" id="startup-splash-progress"></div>
</div>
<div class="startup-splash-error" id="startup-splash-error" hidden role="alert">
<p class="startup-splash-error-detail" id="startup-splash-error-detail"></p>
<p class="startup-splash-error-status" id="startup-splash-error-status"></p>
<div class="startup-splash-actions">
<button type="button" id="startup-splash-export">导出诊断日志</button>
<button type="button" id="startup-splash-open-logs">打开日志目录</button>
<button type="button" id="startup-splash-reload" onclick="window.location.reload()">重新加载</button>
</div>
</div>
</div>
</div>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script>
(function () {
var chinese = navigator.language.toLowerCase().startsWith("zh");
var status = document.getElementById("startup-splash-status");
var progress = document.getElementById("startup-splash-track");
if (status) status.textContent = chinese ? "正在启动…" : "Starting…";
if (progress) progress.setAttribute("aria-label", chinese ? "加载进度" : "Loading");
})();
</script>
<script>
// 若前端模块未能在 30 秒内执行(脚本加载/语法错误),由静态兜底给出提示。
(function () {
var chinese = navigator.language.toLowerCase().startsWith("zh");
window.__endprotocolBootTimer = window.setTimeout(function () {
var panel = document.getElementById("startup-splash-error");
var detail = document.getElementById("startup-splash-error-detail");
var status = document.getElementById("startup-splash-status");
if (!panel || !panel.hidden) return;
panel.hidden = false;
if (status) status.textContent = chinese ? "启动超时" : "Startup timed out";
if (detail) {
detail.textContent = chinese
? "前端脚本长时间未能启动。请点击「重新加载」;若仍失败,请检查安装文件完整性。"
: "The frontend script did not start in time. Click Reload; if it keeps failing, verify the installation files.";
}
var exportButton = document.getElementById("startup-splash-export");
var logsButton = document.getElementById("startup-splash-open-logs");
if (exportButton) exportButton.style.display = "none";
if (logsButton) logsButton.style.display = "none";
}, 30000);
})();
</script>
<script>
// 模块求值阶段的错误发生在 main.tsx 之内,此时 React 的崩溃处理器还没装上,
// 界面只会停在「正在启动…」而没有任何线索(例如 vendor chunk 抛
// `Cannot set properties of undefined (setting 'Activity')`)。
// 这里在文档最早期挂一次监听,把首个未捕获错误直接写进 Splash 的错误面板。
(function () {
var shown = false;
function describe(target) {
if (target && target.tagName) {
var url = target.src || target.href || "";
return (
"resource load failed: <" +
target.tagName.toLowerCase() +
"> " +
url
);
}
return "";
}
function show(detail) {
// main.tsx 启动后会清掉 __endprotocolBootTimer 并卸载静态面板;
// 那之后由 React 侧的崩溃弹窗接管,这里不再插手。
if (shown || window.__endprotocolBootTimer === undefined) return;
var panel = document.getElementById("startup-splash-error");
var detailElement = document.getElementById("startup-splash-error-detail");
var status = document.getElementById("startup-splash-status");
if (!panel) return;
shown = true;
panel.hidden = false;
if (status) {
status.textContent = navigator.language.toLowerCase().startsWith("zh")
? "启动失败"
: "Startup failed";
}
if (detailElement) detailElement.textContent = detail;
var exportButton = document.getElementById("startup-splash-export");
var logsButton = document.getElementById("startup-splash-open-logs");
if (exportButton) exportButton.style.display = "none";
if (logsButton) logsButton.style.display = "none";
}
window.addEventListener(
"error",
function (event) {
if (event.__endprotocolHandled) return;
var resource = describe(event.target);
if (resource) {
show(resource);
return;
}
var location = event.filename
? event.filename +
":" +
(event.lineno || 0) +
":" +
(event.colno || 0)
: "unknown location";
show((event.message || "Unknown error") + "\n" + location);
},
true,
);
window.addEventListener("unhandledrejection", function (event) {
var reason = event.reason;
var text =
(reason && (reason.stack || reason.message)) || String(reason);
show("Unhandled promise rejection\n" + text);
});
})();
</script>
</body>
</html>