-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug.html
More file actions
273 lines (243 loc) · 10.2 KB
/
debug.html
File metadata and controls
273 lines (243 loc) · 10.2 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GitHub Pages 调试页面</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 20px;
background: #f5f5f5;
}
.container {
max-width: 800px;
margin: 0 auto;
background: white;
padding: 20px;
border-radius: 10px;
}
.test-item {
margin: 10px 0;
padding: 10px;
border-radius: 5px;
border-left: 4px solid #ddd;
}
.success {
background: #d4edda;
border-left-color: #28a745;
}
.error {
background: #f8d7da;
border-left-color: #dc3545;
}
.loading {
background: #fff3cd;
border-left-color: #ffc107;
}
.code {
font-family: monospace;
background: #f8f9fa;
padding: 2px 4px;
border-radius: 3px;
}
</style>
</head>
<body>
<div class="container">
<h1>🔧 GitHub Pages 调试页面</h1>
<div class="test-item">
<h3>📍 页面信息</h3>
<p><strong>当前URL:</strong> <span id="current-url"></span></p>
<p><strong>Base URL:</strong> <span id="base-url"></span></p>
<p><strong>协议:</strong> <span id="protocol"></span></p>
</div>
<div class="test-item">
<h3>📁 关键文件检查</h3>
<div id="file-checks">正在检查...</div>
</div>
<div class="test-item">
<h3>🖼️ 图片文件检查</h3>
<div id="image-checks">正在检查...</div>
</div>
<div class="test-item">
<h3>🎮 3D模型文件检查</h3>
<div id="model-checks">正在检查...</div>
</div>
<div class="test-item">
<h3>📊 检查结果</h3>
<div id="results">等待检查完成...</div>
</div>
<div class="test-item">
<h3>🔧 解决方案</h3>
<div id="solutions"></div>
</div>
</div>
<script>
// 更新页面信息
document.getElementById('current-url').textContent = window.location.href;
document.getElementById('base-url').textContent = window.location.origin + window.location.pathname.replace(/[^/]*$/, '');
document.getElementById('protocol').textContent = window.location.protocol;
// 需要检查的关键文件
const criticalFiles = [
'main.dart.js',
'flutter_bootstrap.js',
'flutter.js',
'assets/AssetManifest.json',
'assets/AssetManifest.bin.json',
'assets/FontManifest.json',
'manifest.json',
'favicon.png'
];
// 需要检查的图片文件
const imageFiles = [
'assets/assets/images/events/event1.png',
'assets/assets/images/events/event2.png',
'assets/assets/images/events/event3.png',
'assets/assets/images/avatars/1.png',
'assets/assets/images/avatars/user_avatar.png'
];
// 需要检查的3D模型文件
const modelFiles = [
'assets/assets/models/bommieBoy.glb',
'assets/assets/models/bommieGirl.glb',
'assets/assets/models/bommie.glb'
];
let results = {
criticalSuccess: 0,
criticalError: 0,
imageSuccess: 0,
imageError: 0,
modelSuccess: 0,
modelError: 0
};
async function checkFile(url) {
try {
const response = await fetch(url, { method: 'HEAD' });
return {
success: response.ok,
status: response.status,
size: response.headers.get('content-length') || '未知'
};
} catch (error) {
return {
success: false,
status: 'ERROR',
error: error.message
};
}
}
async function checkCriticalFiles() {
const container = document.getElementById('file-checks');
container.innerHTML = '';
for (const file of criticalFiles) {
const result = await checkFile(file);
const div = document.createElement('div');
div.className = result.success ? 'success' : 'error';
if (result.success) {
div.innerHTML = `✅ <span class="code">${file}</span> - 状态: ${result.status}, 大小: ${result.size} bytes`;
results.criticalSuccess++;
} else {
div.innerHTML = `❌ <span class="code">${file}</span> - 状态: ${result.status}${result.error ? `, 错误: ${result.error}` : ''}`;
results.criticalError++;
}
container.appendChild(div);
}
}
async function checkImageFiles() {
const container = document.getElementById('image-checks');
container.innerHTML = '';
for (const file of imageFiles) {
const result = await checkFile(file);
const div = document.createElement('div');
div.className = result.success ? 'success' : 'error';
if (result.success) {
div.innerHTML = `✅ <span class="code">${file}</span> - 状态: ${result.status}, 大小: ${result.size} bytes`;
results.imageSuccess++;
} else {
div.innerHTML = `❌ <span class="code">${file}</span> - 状态: ${result.status}${result.error ? `, 错误: ${result.error}` : ''}`;
results.imageError++;
}
container.appendChild(div);
}
}
async function checkModelFiles() {
const container = document.getElementById('model-checks');
container.innerHTML = '';
for (const file of modelFiles) {
const result = await checkFile(file);
const div = document.createElement('div');
div.className = result.success ? 'success' : 'error';
if (result.success) {
const sizeMB = result.size ? (parseInt(result.size) / 1024 / 1024).toFixed(2) + ' MB' : '未知';
div.innerHTML = `✅ <span class="code">${file}</span> - 状态: ${result.status}, 大小: ${sizeMB}`;
results.modelSuccess++;
} else {
div.innerHTML = `❌ <span class="code">${file}</span> - 状态: ${result.status}${result.error ? `, 错误: ${result.error}` : ''}`;
results.modelError++;
}
container.appendChild(div);
}
}
function updateResults() {
const container = document.getElementById('results');
container.innerHTML = `
<p><strong>关键文件:</strong> 成功 ${results.criticalSuccess}, 失败 ${results.criticalError}</p>
<p><strong>图片文件:</strong> 成功 ${results.imageSuccess}, 失败 ${results.imageError}</p>
<p><strong>3D模型:</strong> 成功 ${results.modelSuccess}, 失败 ${results.modelError}</p>
<p><strong>总体状态:</strong> ${(results.criticalError === 0 && results.imageError === 0 && results.modelError === 0) ? '✅ 所有文件正常' : '❌ 发现问题'}</p>
`;
updateSolutions();
}
function updateSolutions() {
const container = document.getElementById('solutions');
if (results.criticalError > 0) {
container.innerHTML = `
<div class="error">
<h4>❌ 发现关键文件缺失</h4>
<p>有 ${results.criticalError} 个关键文件无法访问,这会导致应用无法正常运行。</p>
<p><strong>解决方案:</strong></p>
<ol>
<li>检查GitHub仓库中是否包含所有文件</li>
<li>确保文件名大小写正确</li>
<li>重新上传缺失的文件</li>
<li>等待GitHub Pages更新 (5-10分钟)</li>
</ol>
</div>
`;
} else if (results.imageError > 0) {
container.innerHTML = `
<div class="error">
<h4>⚠️ 发现图片文件问题</h4>
<p>有 ${results.imageError} 个图片文件无法访问,应用功能正常但图片不显示。</p>
<p><strong>解决方案:</strong></p>
<ol>
<li>检查 assets/assets/images/ 目录是否完整上传</li>
<li>确保 .nojekyll 文件存在</li>
<li>清除浏览器缓存</li>
<li>等待GitHub Pages更新</li>
</ol>
</div>
`;
} else {
container.innerHTML = `
<div class="success">
<h4>🎉 所有文件检查通过!</h4>
<p>所有关键文件和图片都能正常访问,应用应该可以正常运行。</p>
<p><a href="index.html">🏠 返回主应用</a></p>
</div>
`;
}
}
// 开始检查
async function runChecks() {
await checkCriticalFiles();
await checkImageFiles();
await checkModelFiles();
updateResults();
}
// 页面加载完成后开始检查
window.addEventListener('load', runChecks);
</script>
</body>
</html>