diff --git a/.memory/worklog.json b/.memory/worklog.json
index 842d2f7..e9d94a2 100644
--- a/.memory/worklog.json
+++ b/.memory/worklog.json
@@ -335,6 +335,13 @@
"message": "auto-save 2026-04-19 23:02 (~1)",
"hash": "84d1d75",
"files_changed": 1
+ },
+ {
+ "ts": "2026-04-19T23:08:15+08:00",
+ "type": "commit",
+ "message": "auto-save 2026-04-19 23:08 (~1)",
+ "hash": "8c7a8e1",
+ "files_changed": 1
}
]
}
diff --git a/orchestrator/src/admin-ui.ts b/orchestrator/src/admin-ui.ts
index 46169e0..9ecc81c 100644
--- a/orchestrator/src/admin-ui.ts
+++ b/orchestrator/src/admin-ui.ts
@@ -154,6 +154,20 @@ export const USER_VIEW_HTML = String.raw`
+
+
+
+
🎮 HTML 实时预览(沙盒 iframe,JS 可跑)
+
+
+
+
+
+
@@ -208,6 +222,7 @@ function userView() {
selectedType: '',
selectedContent: '',
selectedUrl: '',
+ htmlMode: 'preview',
get sortedFiles() {
return [...this.files].sort((a, b) => b.mtime - a.mtime);
},
@@ -260,19 +275,26 @@ function userView() {
this.selectedSize = f.size;
const ext = f.path.slice(f.path.lastIndexOf('.')).toLowerCase();
const isImage = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg'].includes(ext);
+ const isHtml = ['.html', '.htm'].includes(ext);
const url = '../api/file?userId=' + encodeURIComponent(this.userId) + '&path=' + encodeURIComponent(f.path) + '&token=' + encodeURIComponent(this.token);
if (isImage) {
this.selectedType = 'image';
this.selectedUrl = url;
+ return;
+ }
+ const r = await fetch(url);
+ if (!r.ok) {
+ this.selectedType = 'error';
+ this.selectedContent = '加载失败: ' + await r.text();
+ return;
+ }
+ const content = await r.text();
+ this.selectedContent = content;
+ if (isHtml) {
+ this.selectedType = 'html';
+ this.htmlMode = 'preview';
} else {
- const r = await fetch(url);
- if (r.ok) {
- this.selectedType = 'text';
- this.selectedContent = await r.text();
- } else {
- this.selectedType = 'error';
- this.selectedContent = '加载失败: ' + await r.text();
- }
+ this.selectedType = 'text';
}
},
iconFor(path) {
@@ -282,7 +304,7 @@ function userView() {
'.json': '{}', '.md': '📝', '.txt': '📄',
'.csv': '📊', '.tsv': '📊', '.xlsx': '📊',
'.png': '🖼', '.jpg': '🖼', '.jpeg': '🖼', '.gif': '🖼', '.webp': '🖼',
- '.html': '🌐', '.css': '🎨',
+ '.html': '🎮', '.htm': '🎮', '.css': '🎨',
'.pdf': '📕', '.zip': '📦',
})[ext] ?? '📄';
},