-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathindex.html
More file actions
327 lines (286 loc) · 10.5 KB
/
index.html
File metadata and controls
327 lines (286 loc) · 10.5 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
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!doctype html>
<html lang="zh-CN" dir="ltr">
<head>
<!-- 基础元数据 -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- 主题色 -->
<meta name="theme-color" content="#6366f1" media="(prefers-color-scheme: light)" />
<meta name="theme-color" content="#1e1b4b" media="(prefers-color-scheme: dark)" />
<!-- 描述和关键词 -->
<meta
name="description"
content="MetaHuman Engine - 开源 3D 数字人交互引擎,支持语音、视觉和对话能力。零配置,离线可用,生产级品质。"
data-i18n-meta="description"
/>
<meta
name="keywords"
content="digital human, 3D avatar, AI, voice interaction, computer vision, WebGL, Three.js, React, TypeScript, 数字人, 3D形象, 人工智能, 语音交互, 计算机视觉"
data-i18n-meta="keywords"
/>
<meta name="author" content="LessUp" />
<meta name="robots" content="index, follow" />
<!-- 开放图谱 / Open Graph -->
<meta property="og:type" content="website" />
<meta property="og:site_name" content="MetaHuman Engine" />
<meta
property="og:title"
content="MetaHuman Engine - 3D数字人交互引擎"
data-i18n-meta="og:title"
/>
<meta
property="og:description"
content="浏览器原生的 3D 数字人引擎,集成语音、视觉、对话能力。零配置,离线可用,生产级。"
data-i18n-meta="og:description"
/>
<meta property="og:url" content="${BASE_URL}" />
<meta property="og:image" content="${BASE_URL}og-image.png" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:locale" content="en_US" />
<meta property="og:locale:alternate" content="zh_CN" />
<!-- Twitter 卡片 -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@LessUpHQ" />
<meta name="twitter:creator" content="@LessUpHQ" />
<meta name="twitter:title" content="MetaHuman Engine - 3D Digital Human Platform" />
<meta
name="twitter:description"
content="Browser-native 3D digital human engine with voice, vision, and dialogue capabilities"
/>
<meta name="twitter:image" content="${BASE_URL}og-image.png" />
<!-- iOS Safari -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="apple-mobile-web-app-title" content="MetaHuman" data-i18n-meta="apple:title" />
<!-- Windows -->
<meta name="msapplication-TileColor" content="#6366f1" />
<meta name="msapplication-config" content="./browserconfig.xml" />
<!-- 移动端优化 -->
<meta name="mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<meta name="apple-touch-fullscreen" content="yes" />
<!-- PWA Manifest -->
<link rel="manifest" href="./manifest.json" />
<!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
<link rel="apple-touch-icon" href="./favicon.svg" />
<link rel="mask-icon" href="./favicon.svg" color="#6366f1" />
<!-- DNS 预解析 -->
<link rel="dns-prefetch" href="https://fonts.googleapis.com" />
<link rel="dns-prefetch" href="https://fonts.gstatic.com" />
<!-- 预连接 -->
<link rel="preconnect" href="https://fonts.googleapis.com" crossorigin />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<!-- 字体预加载 -->
<link
rel="preload"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
as="style"
/>
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
media="print"
onload="this.media = 'all'"
/>
<noscript
><link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"
/></noscript>
<!-- OpenSearch -->
<link
rel="search"
type="application/opensearchdescription+xml"
title="MetaHuman"
href="./opensearch.xml"
/>
<!-- Canonical -->
<link rel="canonical" href="${BASE_URL}" />
<!-- 替代语言 -->
<link rel="alternate" hreflang="en" href="${BASE_URL}" />
<link rel="alternate" hreflang="zh-CN" href="${BASE_URL}?lang=zh" />
<link rel="alternate" hreflang="x-default" href="${BASE_URL}" />
<!-- 安全性 -->
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' data: blob: https:; media-src 'self' blob: https:; connect-src 'self' https: wss:; frame-ancestors 'none'; base-uri 'self'; form-action 'self';"
/>
<!-- 语言检测 - 必须在其他脚本之前执行 -->
<script>
(function () {
// 简化的语言初始化,优先级与 src/lib/i18n.ts getCurrentLanguage() 一致
// URL 参数 > localStorage > 浏览器语言
const params = new URLSearchParams(window.location.search);
const urlLang = params.get('lang');
const storedLang = localStorage.getItem('preferred-lang');
const browserLang = navigator.language || '';
let lang = 'zh-CN';
if (urlLang === 'en') {
lang = 'en';
} else if (urlLang === 'zh') {
lang = 'zh-CN';
} else if (storedLang === 'en' || storedLang === 'zh-CN') {
lang = storedLang;
} else if (/^en/i.test(browserLang)) {
lang = 'en';
}
// 设置 HTML lang 属性
document.documentElement.lang = lang;
document.documentElement.setAttribute('data-lang', lang);
// 存储到 window 供 React 应用读取(首次渲染优化)
window.__INITIAL_LANG__ = lang;
})();
</script>
<!-- 性能优化脚本 -->
<script>
// 检测 WebGL 支持
(function () {
try {
var canvas = document.createElement('canvas');
var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
window.__WEBGL_SUPPORTED__ = !!gl;
} catch (e) {
window.__WEBGL_SUPPORTED__ = false;
}
})();
// 检测触摸设备
window.__TOUCH_DEVICE__ = 'ontouchstart' in window || navigator.maxTouchPoints > 0;
// 检测偏好减少动画
window.__REDUCE_MOTION__ = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
// 检测深色模式
window.__DARK_MODE__ = window.matchMedia('(prefers-color-scheme: dark)').matches;
</script>
<!-- 关键 CSS 内联 -->
<style>
/* 关键路径 CSS - 首屏渲染必需 */
*,
*::before,
*::after {
box-sizing: border-box;
}
html {
font-family:
'Inter',
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
sans-serif;
font-size: 16px;
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
scroll-behavior: smooth;
overflow-x: hidden;
}
body {
min-height: 100vh;
min-height: 100dvh; /* 动态视口高度 */
width: 100%;
max-width: 100vw;
background: #0a0a0a;
color: #fafafa;
overflow-x: hidden;
}
#root {
min-height: 100vh;
min-height: 100dvh;
}
/* 加载占位符 */
.loading-screen {
position: fixed;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
z-index: 9999;
transition:
opacity 0.3s ease,
visibility 0.3s ease;
}
.loading-screen.hidden {
opacity: 0;
visibility: hidden;
pointer-events: none;
}
.loading-spinner {
width: 48px;
height: 48px;
border: 3px solid rgba(99, 102, 241, 0.2);
border-top-color: #6366f1;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.loading-text {
margin-top: 1rem;
color: #a1a1aa;
font-size: 0.875rem;
}
/* WebGL 不支持提示 */
.no-webgl {
display: none;
text-align: center;
padding: 2rem;
}
.no-webgl.visible {
display: block;
}
</style>
<title data-i18n-meta="title">MetaHuman Engine - 开源 3D 数字人交互引擎</title>
</head>
<body>
<!-- 加载屏幕 -->
<div id="loading-screen" class="loading-screen">
<div class="loading-spinner"></div>
<p class="loading-text">Loading MetaHuman Engine...</p>
<div id="no-webgl" class="no-webgl">
<h2>WebGL Not Supported</h2>
<p>Your browser doesn't support WebGL, which is required for 3D rendering.</p>
<p>Please use a modern browser like Chrome, Firefox, or Safari.</p>
</div>
</div>
<!-- React 挂载点 -->
<div id="root"></div>
<!-- 隐藏加载屏幕脚本 -->
<script>
window.addEventListener('load', function () {
if (!window.__WEBGL_SUPPORTED__) {
document.getElementById('no-webgl').classList.add('visible');
}
// 延迟隐藏加载屏幕,确保 React 已挂载
setTimeout(function () {
var loader = document.getElementById('loading-screen');
if (loader) {
loader.classList.add('hidden');
setTimeout(function () {
loader.remove();
}, 300);
}
}, 500);
});
// 加载超时处理
setTimeout(function () {
var loader = document.getElementById('loading-screen');
if (loader && !loader.classList.contains('hidden')) {
var text = loader.querySelector('.loading-text');
if (text) {
text.textContent = 'Taking longer than expected...';
}
}
}, 10000);
</script>
<!-- 主应用脚本 -->
<script type="module" src="/src/main.tsx"></script>
</body>
</html>