feat(theme): 恢复主题桥,工作台页重新跟随 DSH 深浅色 (REQ-20261117-0013)
问题:Gitea 0.5.x 线缺了 qiudl 0.4.x 分支的整套主题桥能力,升级后所有工作台
产物页都不再跟随 DSH 主题(浅色/深色/跟随系统全部失效),页面各自锁死自己的配色。
这是升级引入的真实回归,比单个页面的配色问题严重得多。
移植内容(来自 qiudl 0.4.9-rc.2,theme.ts 无外部依赖,纯函数 + 浏览器脚本):
- 新增 src/theme.ts(191 行):THEME_BRIDGE_JS / injectThemeBridge / 前缀判定
- 模板路由补 /api/worktable/template/theme.js(独立打开/嵌套 iframe 显式引用)
- 站点路由对 .html/.htm 自动注入主题桥(幂等:已含 data-wt-theme-bridge 则原样)
- 新增 04_test/theme-bridge.test.mjs(7 个回归用例,含接线防漏)
顺带修两处写死项(同属「不跟随主题」根因):
- dshell.css::root{color-scheme:dark} → color-scheme:light dark + 浅/深两套
兜底 token(历史事故:写死深色会让所有页面锁死深色)
- dshell.css:正文字体改走 var(--dsw-font-family, ...)
版本 0.5.3-local.3 -> 0.5.3-local.4
验证:build 通过;client-factory-gate 10/10;主题桥测试 7/7;兼容回归 105/105;
release-prep 全过(结构断言、独立安装 import、split anchor dom 14 场景、
sidebar popup、真实 Chromium split margin 5 场景、server home 3 场景)
This commit is contained in:
+166
-6
@@ -117,17 +117,174 @@ function createPreviewFiles(now = () => Date.now()) {
|
||||
};
|
||||
}
|
||||
|
||||
// src/theme.ts
|
||||
var THEME_VAR_PREFIXES = ["--dsw-", "--dsh-", "--ds-"];
|
||||
var THEME_BRIDGE_ID = "wt-theme-bridge";
|
||||
var THEME_JS_PATH = "/api/worktable/template/theme.js";
|
||||
var THEME_BRIDGE_JS = `(function () {
|
||||
var PREFIXES = ${JSON.stringify(THEME_VAR_PREFIXES)};
|
||||
if (window.__wtThemeBridgeInstalled) return;
|
||||
window.__wtThemeBridgeInstalled = true;
|
||||
function ok(name) {
|
||||
if (!name || name.slice(0, 2) !== '--') return false;
|
||||
for (var i = 0; i < PREFIXES.length; i++) if (name.slice(0, PREFIXES[i].length) === PREFIXES[i]) return true;
|
||||
return false;
|
||||
}
|
||||
/** \u5411\u4E0A\u627E\u5230\u6700\u5916\u5C42\u540C\u6E90\u7956\u5148\u7A97\u53E3\uFF1B\u8DE8\u57DF\u6216\u5230\u9876\u5C31\u505C\u3002 */
|
||||
function hostWindow() {
|
||||
var w = window;
|
||||
try {
|
||||
for (var i = 0; i < 12; i++) {
|
||||
var p = w.parent;
|
||||
if (!p || p === w) break;
|
||||
if (!p.document || !p.document.documentElement) break;
|
||||
w = p;
|
||||
}
|
||||
} catch (e) { /* \u8DE8\u57DF\uFF1A\u505C\u5728\u5F53\u524D\u5C42 */ }
|
||||
return w === window ? null : w;
|
||||
}
|
||||
function hostVars(host) {
|
||||
var out = [];
|
||||
try {
|
||||
var el = host.document.body || host.document.documentElement;
|
||||
if (!el) return out;
|
||||
var cs = host.getComputedStyle(el);
|
||||
for (var i = 0; i < cs.length; i++) {
|
||||
var n = cs[i];
|
||||
if (!ok(n)) continue;
|
||||
var v = cs.getPropertyValue(n);
|
||||
if (v && v.trim()) out.push([n, v.trim()]);
|
||||
}
|
||||
out.dark = el.hasAttribute && el.hasAttribute('data-ds-dark-theme');
|
||||
} catch (e) { /* \u8BFB\u4E0D\u5230\u5C31\u9000\u56DE\u7CFB\u7EDF\u504F\u597D */ }
|
||||
return out;
|
||||
}
|
||||
function systemDark() {
|
||||
try { return !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches); } catch (e) { return false; }
|
||||
}
|
||||
/** \u9875\u9762\u81EA\u5E26\u4E3B\u9898\u5F00\u5173\uFF1F\uFF08\u9875\u9762\u4F18\u5148\uFF0C\u6865\u4E0D\u62A2\uFF09
|
||||
* 1) \u8FD0\u884C\u65F6\u663E\u5F0F\uFF1Awindow.__wtThemeBridgeManual = true
|
||||
* 2) \u6807\u8BB0\uFF1A<html data-wt-theme-mode="manual">
|
||||
* 3) \u8001\u5DE5\u4F5C\u53F0\u9875\u517C\u5BB9\uFF1A<html data-wb-theme> \u6216 localStorage['dwb.theme']\uFF08\u65E5\u8BB0\u5DE5\u4F5C\u53F0 / ai\u9012\u5F52\u5B66\u4E60\u7528\u8FD9\u5957\uFF09
|
||||
* \u663E\u5F0F\u8DDF\u968F\uFF1A<html data-wt-theme-mode="auto">\uFF08\u6216 <html data-wt-theme-key="\u81EA\u5DF1\u7684\u952E">\uFF09\uFF1D**\u5FFD\u7565**\u4E0A\u9762 3) \u7684
|
||||
* legacy \u5224\u5B9A\uFF0C\u5F3A\u5236\u8DDF\u5BBF\u4E3B\u2014\u2014\u540C\u6E90\u9875\u9762\u5171\u7528\u4E00\u4E2A localStorage \u952E\u65F6\uFF0C\u8FD9\u6761\u662F"\u6211\u53EA\u60F3\u8DDF\u5BBF\u4E3B"\u7684\u552F\u4E00\u529E\u6CD5\u3002 */
|
||||
function pageManual() {
|
||||
try {
|
||||
if (window.__wtThemeBridgeManual) return true;
|
||||
var el = document.documentElement;
|
||||
if (el) {
|
||||
var mode = el.getAttribute && el.getAttribute('data-wt-theme-mode');
|
||||
if (mode === 'manual') return true;
|
||||
if (mode === 'auto' || mode === 'host') return false;
|
||||
if (el.hasAttribute && el.hasAttribute('data-wt-theme-key')) return false;
|
||||
if (el.hasAttribute && el.hasAttribute('data-wb-theme')) return true;
|
||||
}
|
||||
var v = null;
|
||||
try { v = localStorage.getItem('dwb.theme'); } catch (e) { v = null; }
|
||||
if (v === 'dark' || v === 'light') return true;
|
||||
} catch (e) { /* \u8BFB\u4E0D\u5230\u5C31\u6309\u975E\u624B\u52A8\u5904\u7406 */ }
|
||||
return false;
|
||||
}
|
||||
var applied = [];
|
||||
/** \u6E05\u6389\u6865\u5199\u8FC7\u7684\u5185\u8054 token\uFF1A\u5207\u5230\u624B\u52A8\u4E3B\u9898\u65F6\u5FC5\u987B\u8BA9\u4F4D\u7ED9\u9875\u9762\u81EA\u5DF1\u7684\u6837\u5F0F\u8868\u503C\u3002 */
|
||||
function clearApplied() {
|
||||
var root = document.documentElement;
|
||||
for (var i = 0; i < applied.length; i++) {
|
||||
try { root.style.removeProperty(applied[i]); } catch (e) {}
|
||||
try { if (document.body) document.body.style.removeProperty(applied[i]); } catch (e) {}
|
||||
}
|
||||
applied = [];
|
||||
}
|
||||
function apply() {
|
||||
if (pageManual()) { clearApplied(); return; }
|
||||
var host = hostWindow();
|
||||
var vars = host ? hostVars(host) : [];
|
||||
var dark = host ? !!vars.dark : systemDark();
|
||||
var root = document.documentElement;
|
||||
for (var i = 0; i < vars.length; i++) root.style.setProperty(vars[i][0], vars[i][1]);
|
||||
root.style.colorScheme = dark ? 'dark' : 'light';
|
||||
if (document.body) {
|
||||
for (var j = 0; j < vars.length; j++) document.body.style.setProperty(vars[j][0], vars[j][1]);
|
||||
if (dark) document.body.setAttribute('data-ds-dark-theme', '');
|
||||
else document.body.removeAttribute('data-ds-dark-theme');
|
||||
}
|
||||
applied = vars.map(function (p) { return p[0]; });
|
||||
}
|
||||
apply();
|
||||
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', apply, { once: true });
|
||||
// \u9875\u9762\u81EA\u5DF1\u5207\u4E3B\u9898\uFF08data-wb-theme / data-wt-theme-mode\uFF09\u65F6\u7ACB\u523B\u91CD\u65B0\u5224\u5B9A\uFF0C\u522B\u7B49\u8F6E\u8BE2
|
||||
try {
|
||||
var MO0 = window.MutationObserver;
|
||||
if (MO0) new MO0(function () { apply(); }).observe(document.documentElement, { attributes: true, attributeFilter: ['data-wb-theme', 'data-wt-theme-mode'] });
|
||||
} catch (e) { /* \u5FFD\u7565 */ }
|
||||
var host = hostWindow();
|
||||
if (host) {
|
||||
try {
|
||||
var MO = host.MutationObserver || window.MutationObserver;
|
||||
var mo = new MO(function () { apply(); });
|
||||
var opts = { attributes: true, attributeFilter: ['style', 'class', 'data-ds-dark-theme'] };
|
||||
mo.observe(host.document.documentElement, opts);
|
||||
if (host.document.body) mo.observe(host.document.body, opts);
|
||||
host.document.addEventListener('DOMContentLoaded', function () { try { mo.observe(host.document.body, opts); } catch (e) {} apply(); });
|
||||
} catch (e) { /* \u89C2\u6D4B\u5931\u8D25\u9760\u4E0B\u9762\u7684\u515C\u5E95\u8F6E\u8BE2 */ }
|
||||
}
|
||||
try {
|
||||
var mq = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)');
|
||||
if (mq) { if (mq.addEventListener) mq.addEventListener('change', apply); else if (mq.addListener) mq.addListener(apply); }
|
||||
} catch (e) { /* \u5FFD\u7565 */ }
|
||||
window.__wtThemeBridgeApply = apply;
|
||||
setInterval(apply, 5000); // \u515C\u5E95\uFF1A\u5BBF\u4E3B\u6362\u4E3B\u9898\u4E5F\u53EF\u80FD\u53EA\u6362\u6837\u5F0F\u8868\u3001\u4E0D\u52A8\u5C5E\u6027
|
||||
})();`;
|
||||
function injectThemeBridge(html, external = false) {
|
||||
const src = String(html ?? "");
|
||||
if (!src || src.includes(THEME_BRIDGE_ID)) return src;
|
||||
const tag = external ? `<script id="${THEME_BRIDGE_ID}" data-wt-theme-bridge src="${THEME_JS_PATH}"></script>` : `<script id="${THEME_BRIDGE_ID}" data-wt-theme-bridge>${THEME_BRIDGE_JS}</script>`;
|
||||
const head = /<\/head\s*>/i.exec(src);
|
||||
if (head) return src.slice(0, head.index) + tag + src.slice(head.index);
|
||||
const body = /<\/body\s*>/i.exec(src);
|
||||
if (body) return src.slice(0, body.index) + tag + src.slice(body.index);
|
||||
return tag + src;
|
||||
}
|
||||
|
||||
// template/dshell.css
|
||||
var dshell_default = `/* dsh-worktable \u539F\u751F\u76AE\u80A4 \xB7 DSH \u8BBE\u8BA1\u7CFB\u7EDF\u7EC4\u4EF6\u5E93
|
||||
\u7528\u6CD5\uFF1A<link rel="stylesheet" href="/api/worktable/template/dshell.css">
|
||||
\u6240\u6709\u989C\u8272\u8D70 DSH \u4E3B\u9898\u53D8\u91CF\uFF08--dsw-alias-*\uFF09\uFF0C\u81EA\u52A8\u9002\u914D\u660E\u6697\u4E3B\u9898\u3002 */
|
||||
:root { color-scheme: dark; }
|
||||
\u989C\u8272\u4E00\u5F8B\u8D70 DSH \u4E3B\u9898\u53D8\u91CF\uFF08--dsw-alias-*\uFF09\uFF0C\u81EA\u52A8\u9002\u914D\u660E\u6697\u4E3B\u9898\u3002
|
||||
\u4E3B\u9898\u6765\u6E90\u4F18\u5148\u7EA7\uFF1A
|
||||
1) \u5DE5\u4F5C\u53F0\u5185\uFF1A\u4E3B\u9898\u6865\uFF08\u7AD9\u70B9\u8DEF\u7531\u81EA\u52A8\u6CE8\u5165\uFF0C\u6216\u663E\u5F0F\u5F15 /api/worktable/template/theme.js\uFF09
|
||||
\u628A\u5BBF\u4E3B body \u4E0A\u7684 --dsw-*/--dsh-*/--ds-* \u955C\u50CF\u6210\u9875\u9762\u5185\u8054\u6837\u5F0F \u2192 \u8DDF\u968F DSH \u7684 \u6D45\u8272/\u6DF1\u8272/\u8DDF\u968F\u7CFB\u7EDF\uFF1B
|
||||
2) \u72EC\u7ACB\u6253\u5F00\uFF1A\u7528\u4E0B\u9762 :root \u7684\u515C\u5E95\uFF0C\u5E76\u6309\u7CFB\u7EDF\u6DF1\u6D45\u8272\u5207\u6362\u3002
|
||||
\u6CE8\u610F\uFF1A\u4E0D\u8981\u5728\u8FD9\u91CC\u5199\u6B7B\u6DF1\u8272\uFF08\u65E7\u7248 :root{color-scheme:dark} \u4F1A\u8BA9\u6240\u6709\u9875\u9762\u9501\u6B7B\u6DF1\u8272\uFF0C
|
||||
2026-11 \u4ECE 0.5.x \u7EBF\u6062\u590D\u65F6\u518D\u6B21\u8E29\u5230\uFF0CREQ-20261117-0013 \u4E00\u5E76\u4FEE\u6389\uFF09\u3002 */
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
--dsw-alias-bg-base: #ffffff;
|
||||
--dsw-alias-fill-l1: rgba(16, 24, 40, .03);
|
||||
--dsw-alias-border-l1: #e4e7ec;
|
||||
--dsw-alias-border-l2: #d0d5dd;
|
||||
--dsw-alias-label-primary: #101828;
|
||||
--dsw-alias-label-secondary: #475467;
|
||||
--dsw-alias-label-tertiary: #98a2b3;
|
||||
--dsw-alias-state-accent-primary: #2f6feb;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--dsw-alias-bg-base: #0b0e14;
|
||||
--dsw-alias-fill-l1: rgba(255, 255, 255, .02);
|
||||
--dsw-alias-border-l1: #262b36;
|
||||
--dsw-alias-border-l2: #3a4150;
|
||||
--dsw-alias-label-primary: #e6e8eb;
|
||||
--dsw-alias-label-secondary: #9aa4b2;
|
||||
--dsw-alias-label-tertiary: #6b7280;
|
||||
--dsw-alias-state-accent-primary: #4f8ef7;
|
||||
}
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
html, body { margin: 0; padding: 0; }
|
||||
body {
|
||||
background: var(--dsw-alias-bg-base, #0b0e14);
|
||||
color: var(--dsw-alias-label-primary, #e6e8eb);
|
||||
font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
|
||||
font-family: var(--dsw-font-family, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif);
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
@@ -195,7 +352,7 @@ body {
|
||||
`;
|
||||
|
||||
// template/dshell.html
|
||||
var dshell_default2 = '<!doctype html>\n<!-- dsh-worktable \u539F\u751F\u76AE\u80A4\u6A21\u677F\uFF1A\u65B0\u9875\u9762\u4EE5\u6B64\u4E3A\u57FA\u7840\uFF0C\u66FF\u6362\u4E0B\u9762\u793A\u4F8B\u5185\u5BB9\u5373\u53EF\u3002\n \u6837\u5F0F\u8868\u7531\u63D2\u4EF6\u63D0\u4F9B\uFF08\u968F\u4E3B\u9898\u81EA\u52A8\u9002\u914D\uFF09\uFF0C\u4E0D\u8981\u590D\u5236\u6216\u6539\u5199\u5B83\u3002 -->\n<html lang="zh-CN">\n<head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <title>\u6211\u7684\u7A97\u53E3</title>\n <link rel="stylesheet" href="/api/worktable/template/dshell.css" />\n</head>\n<body>\n <div class="dshell">\n <!-- \u6807\u9898\u533A -->\n <h1 class="dshell-title">\u7A97\u53E3\u6807\u9898</h1>\n <p class="dshell-sub">\u4E00\u53E5\u8BDD\u8BF4\u660E\u8FD9\u4E2A\u7A97\u53E3\u505A\u4EC0\u4E48\u3002</p>\n\n <!-- \u72B6\u6001\u5FBD\u6807\uFF1A\u5DF2\u5B8C\u6210 dshell-badgeDone / \u8FDB\u884C\u4E2D dshell-badgeWait / \u9ED8\u8BA4 -->\n <div>\n <span class="dshell-badge dshell-badgeDone">\u5DF2\u5B8C\u6210</span>\n <span class="dshell-badge dshell-badgeWait">\u8FDB\u884C\u4E2D</span>\n <span class="dshell-badge">\u672A\u5F00\u59CB</span>\n </div>\n\n <!-- \u6807\u7B7E\u9875 -->\n <div class="dshell-tabs">\n <button class="dshell-tab dshell-tabOn">\u6982\u89C8</button>\n <button class="dshell-tab">\u8BE6\u60C5</button>\n <button class="dshell-tab">\u8BBE\u7F6E</button>\n </div>\n\n <!-- \u7EDF\u8BA1\u5361\u7247\u7F51\u683C -->\n <div class="dshell-grid">\n <div class="dshell-stat">\n <div class="dshell-statLabel">\u603B\u6570</div>\n <div class="dshell-statValue">128</div>\n <div class="dshell-statDelta">+12.4%</div>\n </div>\n <div class="dshell-stat">\n <div class="dshell-statLabel">\u8FDB\u884C\u4E2D</div>\n <div class="dshell-statValue">7</div>\n </div>\n <div class="dshell-stat">\n <div class="dshell-statLabel">\u5DF2\u5B8C\u6210</div>\n <div class="dshell-statValue">121</div>\n </div>\n </div>\n\n <!-- \u5217\u8868 -->\n <div class="dshell-list">\n <div class="dshell-listItem">\n <span class="dshell-listItemTitle">\u6761\u76EE\u4E00\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898</span>\n <span class="dshell-listItemMeta">\u6628\u5929</span>\n </div>\n <div class="dshell-listItem">\n <span class="dshell-listItemTitle">\u6761\u76EE\u4E8C\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898</span>\n <span class="dshell-badge dshell-badgeDone">\u5DF2\u53D1\u5E03</span>\n </div>\n </div>\n\n <!-- \u5361\u7247 + \u952E\u503C\u5BF9 -->\n <div class="dshell-card">\n <h2 class="dshell-sub" style="margin:0 0 8px">\u8BE6\u60C5</h2>\n <div class="dshell-kv">\n <div class="dshell-kvRow"><span class="dshell-kvKey">\u5B57\u6BB5 A</span><span class="dshell-kvValue">\u503C A</span></div>\n <div class="dshell-kvRow"><span class="dshell-kvKey">\u5B57\u6BB5 B</span><span class="dshell-kvValue">\u503C B</span></div>\n </div>\n <div class="dshell-divider"></div>\n <div class="dshell-progress"><div class="dshell-progressBar" style="width:72%"></div></div>\n </div>\n\n <!-- \u64CD\u4F5C\u533A -->\n <div style="display:flex;gap:8px">\n <button class="dshell-btn">\u4E3B\u8981\u64CD\u4F5C</button>\n <button class="dshell-btn dshell-btnGhost">\u6B21\u8981\u64CD\u4F5C</button>\n </div>\n </div>\n</body>\n</html>\n';
|
||||
var dshell_default2 = '<!doctype html>\n<!-- dsh-worktable \u539F\u751F\u76AE\u80A4\u6A21\u677F\uFF1A\u65B0\u9875\u9762\u4EE5\u6B64\u4E3A\u57FA\u7840\uFF0C\u66FF\u6362\u4E0B\u9762\u793A\u4F8B\u5185\u5BB9\u5373\u53EF\u3002\n \u6837\u5F0F\u8868\u7531\u63D2\u4EF6\u63D0\u4F9B\uFF08\u968F\u4E3B\u9898\u81EA\u52A8\u9002\u914D\uFF09\uFF0C\u4E0D\u8981\u590D\u5236\u6216\u6539\u5199\u5B83\u3002 -->\n<html lang="zh-CN">\n<head>\n <!-- \u4E3B\u9898\u8DDF\u968F\uFF1A\u7AD9\u70B9\u8DEF\u7531\uFF08/api/worktable/site/**\uFF09\u5DF2\u81EA\u52A8\u6CE8\u5165\u4E3B\u9898\u6865\uFF0C\u65E0\u9700\u624B\u5199\uFF1B\n \u72EC\u7ACB\u6253\u5F00 / \u5D4C\u5957 iframe \u65F6\u663E\u5F0F\u5F15\u5165\u4E0B\u9762\u8FD9\u4E00\u884C\u5373\u53EF\uFF1A\n <script src="/api/worktable/template/theme.js"></script> -->\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <title>\u6211\u7684\u7A97\u53E3</title>\n <link rel="stylesheet" href="/api/worktable/template/dshell.css" />\n</head>\n<body>\n <div class="dshell">\n <!-- \u6807\u9898\u533A -->\n <h1 class="dshell-title">\u7A97\u53E3\u6807\u9898</h1>\n <p class="dshell-sub">\u4E00\u53E5\u8BDD\u8BF4\u660E\u8FD9\u4E2A\u7A97\u53E3\u505A\u4EC0\u4E48\u3002</p>\n\n <!-- \u72B6\u6001\u5FBD\u6807\uFF1A\u5DF2\u5B8C\u6210 dshell-badgeDone / \u8FDB\u884C\u4E2D dshell-badgeWait / \u9ED8\u8BA4 -->\n <div>\n <span class="dshell-badge dshell-badgeDone">\u5DF2\u5B8C\u6210</span>\n <span class="dshell-badge dshell-badgeWait">\u8FDB\u884C\u4E2D</span>\n <span class="dshell-badge">\u672A\u5F00\u59CB</span>\n </div>\n\n <!-- \u6807\u7B7E\u9875 -->\n <div class="dshell-tabs">\n <button class="dshell-tab dshell-tabOn">\u6982\u89C8</button>\n <button class="dshell-tab">\u8BE6\u60C5</button>\n <button class="dshell-tab">\u8BBE\u7F6E</button>\n </div>\n\n <!-- \u7EDF\u8BA1\u5361\u7247\u7F51\u683C -->\n <div class="dshell-grid">\n <div class="dshell-stat">\n <div class="dshell-statLabel">\u603B\u6570</div>\n <div class="dshell-statValue">128</div>\n <div class="dshell-statDelta">+12.4%</div>\n </div>\n <div class="dshell-stat">\n <div class="dshell-statLabel">\u8FDB\u884C\u4E2D</div>\n <div class="dshell-statValue">7</div>\n </div>\n <div class="dshell-stat">\n <div class="dshell-statLabel">\u5DF2\u5B8C\u6210</div>\n <div class="dshell-statValue">121</div>\n </div>\n </div>\n\n <!-- \u5217\u8868 -->\n <div class="dshell-list">\n <div class="dshell-listItem">\n <span class="dshell-listItemTitle">\u6761\u76EE\u4E00\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898</span>\n <span class="dshell-listItemMeta">\u6628\u5929</span>\n </div>\n <div class="dshell-listItem">\n <span class="dshell-listItemTitle">\u6761\u76EE\u4E8C\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898</span>\n <span class="dshell-badge dshell-badgeDone">\u5DF2\u53D1\u5E03</span>\n </div>\n </div>\n\n <!-- \u5361\u7247 + \u952E\u503C\u5BF9 -->\n <div class="dshell-card">\n <h2 class="dshell-sub" style="margin:0 0 8px">\u8BE6\u60C5</h2>\n <div class="dshell-kv">\n <div class="dshell-kvRow"><span class="dshell-kvKey">\u5B57\u6BB5 A</span><span class="dshell-kvValue">\u503C A</span></div>\n <div class="dshell-kvRow"><span class="dshell-kvKey">\u5B57\u6BB5 B</span><span class="dshell-kvValue">\u503C B</span></div>\n </div>\n <div class="dshell-divider"></div>\n <div class="dshell-progress"><div class="dshell-progressBar" style="width:72%"></div></div>\n </div>\n\n <!-- \u64CD\u4F5C\u533A -->\n <div style="display:flex;gap:8px">\n <button class="dshell-btn">\u4E3B\u8981\u64CD\u4F5C</button>\n <button class="dshell-btn dshell-btnGhost">\u6B21\u8981\u64CD\u4F5C</button>\n </div>\n </div>\n</body>\n</html>\n';
|
||||
|
||||
// src/index.ts
|
||||
function baseDshHome() {
|
||||
@@ -225,7 +382,7 @@ function resolveDshHomeSafe() {
|
||||
cachedDshHome = baseDshHome();
|
||||
return cachedDshHome;
|
||||
}
|
||||
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.3";
|
||||
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.4";
|
||||
var name = "dsh-worktable";
|
||||
var inject = ["webServer", "sessions"];
|
||||
var HEALTH_PATH = "/api/worktable/health";
|
||||
@@ -638,6 +795,9 @@ function apply(ctx) {
|
||||
if (rel === "/dshell.css") {
|
||||
res.writeHead(200, { "content-type": "text/css; charset=utf-8", "cache-control": "no-store" });
|
||||
res.end(dshell_default);
|
||||
} else if (rel === "/theme.js") {
|
||||
res.writeHead(200, { "content-type": "text/javascript; charset=utf-8", "cache-control": "no-store" });
|
||||
res.end(THEME_BRIDGE_JS);
|
||||
} else {
|
||||
res.writeHead(200, { "content-type": "text/html; charset=utf-8", "cache-control": "no-store" });
|
||||
res.end(dshell_default2);
|
||||
@@ -701,7 +861,7 @@ function apply(ctx) {
|
||||
"referrer-policy": "no-referrer",
|
||||
"x-content-type-options": "nosniff"
|
||||
});
|
||||
res.end(data);
|
||||
res.end(ext === "html" || ext === "htm" ? Buffer.from(injectThemeBridge(data.toString("utf8")), "utf8") : data);
|
||||
} catch (err) {
|
||||
json(res, 404, { error: String(err) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user