feat: 二级页面、孤儿路由防护、iframe 全屏与 DS Bot 侧栏隐藏 (v0.5.3-local.5)
借鉴同线分支 dsh-worktable 0.5.2-local.9 的四项改造,逐项评估后移植: - 二级页面:LayoutSpec.parentId + layoutTree 树形侧栏 + 折叠/展开。 仅一级嵌套;删父项目不级联删子页面(提升为顶级,避免误删用户内容)。 管理面板加「+新增二级页面」,继承父项目文件夹。 - 孤儿路由防护:register 遇 duplicate 路由只 warn 不抛,避免热重载时 旧 fiber 未释放导致新 fiber 激活失败、侧边栏抽屉整体消失。 - iframe allowFullScreen:项目窗格里的 HTML 看板可全屏。 - DS Bot 侧栏隐藏:由本插件注入 CSS,替代改 ds-bot/client.js 的做法 (ds-bot 随应用升级,改源码必丢)。nav.bt-home-nav 带标签选择器避免误伤。 未移植对方的状态防清空(stateStore.serverKeys):本仓 hostState.ts 已有 hydrated 守卫(读完宿主前禁写、读不到整场不写)与更细的 6 段退避重试, 覆盖面更强。 顺带修三个 Windows 兼容缺陷,否则 pack 门禁过不去: - release-prep.mjs:tar 加 --force-local(GNU tar 把 C: 当 rsh 主机) - preview-files.test.mjs:rmSync 删 junction 失败,加 unlinkSync 兜底 - widget-mount.test.mjs:提取段缺 normalizeProjects 依赖,起点前移 验证:npm run pack 全绿(139 项兼容回归 + 工厂门禁 10/10 + 结构 7 文件 + 独立安装 import + 锚点 14 场景 + Chromium 分栏 5 场景 + 服务端 3 场景)。 双资产同源 sha256 cf633ad7…。
This commit is contained in:
+130
-115
@@ -247,112 +247,112 @@ function injectThemeBridge(html, external = false) {
|
||||
}
|
||||
|
||||
// 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">
|
||||
\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: var(--dsw-font-family, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif);
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.dshell { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-height: 100%; }
|
||||
/* \u6587\u5B57\u5C42\u7EA7 */
|
||||
.dshell-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); }
|
||||
.dshell-sub { margin: 0; font-size: 12px; color: var(--dsw-alias-label-secondary, #9aa4b2); }
|
||||
.dshell-muted { color: var(--dsw-alias-label-tertiary, #6b7280); font-size: 11.5px; }
|
||||
/* \u5361\u7247 */
|
||||
.dshell-card { border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); padding: 12px 14px; }
|
||||
.dshell-card + .dshell-card { margin-top: 10px; }
|
||||
/* \u6309\u94AE\uFF08\u7EFF\u8272\u4E3B\u6309\u94AE / \u5E7D\u7075\u6309\u94AE / \u5371\u9669\uFF09 */
|
||||
.dshell-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid transparent; background: #3fb950; color: #0b0e14; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
|
||||
.dshell-btn:hover { filter: brightness(1.08); }
|
||||
.dshell-btnGhost { background: transparent; border-color: var(--dsw-alias-border-l1, #262b36); color: var(--dsw-alias-label-secondary, #9aa4b2); }
|
||||
.dshell-btnGhost:hover { color: var(--dsw-alias-label-primary, #e6e8eb); border-color: var(--dsw-alias-border-l2, #3a4150); }
|
||||
.dshell-btnDanger { background: transparent; border-color: #f85149; color: #f85149; }
|
||||
/* \u72B6\u6001\u5FBD\u6807\uFF08\u5706\u70B9 + \u6587\u5B57\uFF1B\u7EFF=\u5DF2\u5B8C\u6210 \u9EC4=\u5F85\u529E/\u5F85\u53D1\u5E03 \u7070=\u672A\u5F00\u59CB\uFF09 */
|
||||
.dshell-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l1, #262b36); font-size: 11.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); }
|
||||
.dshell-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); }
|
||||
.dshell-badgeDone { color: #3fb950; border-color: rgba(63,185,80,.4); }
|
||||
.dshell-badgeDone::before { background: #3fb950; box-shadow: 0 0 5px #3fb950; }
|
||||
.dshell-badgeWait { color: #d29922; border-color: rgba(210,153,34,.4); }
|
||||
.dshell-badgeWait::before { background: #d29922; box-shadow: 0 0 5px #d29922; }
|
||||
.dshell-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); }
|
||||
.dshell-dotDone { background: #3fb950; box-shadow: 0 0 5px #3fb950; }
|
||||
.dshell-dotWait { background: #d29922; box-shadow: 0 0 5px #d29922; }
|
||||
/* \u6807\u7B7E\u9875 */
|
||||
.dshell-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); }
|
||||
.dshell-tab { padding: 7px 12px; font-size: 12.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); cursor: pointer; border: none; background: none; font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; }
|
||||
.dshell-tabOn { color: var(--dsw-alias-label-primary, #e6e8eb); border-bottom-color: var(--dsw-alias-state-accent-primary, #4f8ef7); }
|
||||
/* \u5217\u8868 */
|
||||
.dshell-list { display: flex; flex-direction: column; gap: 6px; }
|
||||
.dshell-listItem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); cursor: pointer; }
|
||||
.dshell-listItem:hover { border-color: var(--dsw-alias-border-l2, #3a4150); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.05)); }
|
||||
.dshell-listItemTitle { font-size: 12.5px; color: var(--dsw-alias-label-primary, #e6e8eb); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.dshell-listItemMeta { flex: none; font-size: 11px; color: var(--dsw-alias-label-tertiary, #6b7280); }
|
||||
/* \u7F51\u683C / \u7EDF\u8BA1 */
|
||||
.dshell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
|
||||
.dshell-stat { padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); }
|
||||
.dshell-statLabel { font-size: 11px; color: var(--dsw-alias-label-secondary, #9aa4b2); }
|
||||
.dshell-statValue { font-size: 20px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); }
|
||||
.dshell-statDelta { font-size: 11px; color: #3fb950; }
|
||||
/* \u8FDB\u5EA6\u6761 */
|
||||
.dshell-progress { height: 6px; border-radius: 3px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.06)); overflow: hidden; }
|
||||
.dshell-progressBar { height: 100%; border-radius: 3px; background: #3fb950; }
|
||||
/* \u8F93\u5165 */
|
||||
.dshell-input, .dshell-textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); color: var(--dsw-alias-label-primary, #e6e8eb); font: inherit; font-size: 12.5px; outline: none; }
|
||||
.dshell-input:focus, .dshell-textarea:focus { border-color: var(--dsw-alias-state-accent-primary, #4f8ef7); }
|
||||
/* \u8868\u683C */
|
||||
.dshell-table { width: 100%; border-collapse: collapse; font-size: 12px; }
|
||||
.dshell-table th, .dshell-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); }
|
||||
.dshell-table th { color: var(--dsw-alias-label-secondary, #9aa4b2); font-weight: 500; }
|
||||
/* \u952E\u503C\u5BF9 */
|
||||
.dshell-kv { display: flex; flex-direction: column; gap: 6px; }
|
||||
.dshell-kvRow { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
|
||||
.dshell-kvKey { color: var(--dsw-alias-label-secondary, #9aa4b2); }
|
||||
.dshell-kvValue { color: var(--dsw-alias-label-primary, #e6e8eb); text-align: right; }
|
||||
/* \u5206\u5272\u7EBF */
|
||||
.dshell-divider { height: 1px; background: var(--dsw-alias-border-l1, #262b36); margin: 6px 0; }
|
||||
/* \u6EDA\u52A8\u6761 */
|
||||
::-webkit-scrollbar { width: 10px; height: 10px; }
|
||||
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 5px; }
|
||||
::-webkit-scrollbar-track { background: transparent; }
|
||||
var dshell_default = `/* dsh-worktable \u539F\u751F\u76AE\u80A4 \xB7 DSH \u8BBE\u8BA1\u7CFB\u7EDF\u7EC4\u4EF6\u5E93\r
|
||||
\u7528\u6CD5\uFF1A<link rel="stylesheet" href="/api/worktable/template/dshell.css">\r
|
||||
\u989C\u8272\u4E00\u5F8B\u8D70 DSH \u4E3B\u9898\u53D8\u91CF\uFF08--dsw-alias-*\uFF09\uFF0C\u81EA\u52A8\u9002\u914D\u660E\u6697\u4E3B\u9898\u3002\r
|
||||
\u4E3B\u9898\u6765\u6E90\u4F18\u5148\u7EA7\uFF1A\r
|
||||
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\r
|
||||
\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\r
|
||||
2) \u72EC\u7ACB\u6253\u5F00\uFF1A\u7528\u4E0B\u9762 :root \u7684\u515C\u5E95\uFF0C\u5E76\u6309\u7CFB\u7EDF\u6DF1\u6D45\u8272\u5207\u6362\u3002\r
|
||||
\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\r
|
||||
2026-11 \u4ECE 0.5.x \u7EBF\u6062\u590D\u65F6\u518D\u6B21\u8E29\u5230\uFF0CREQ-20261117-0013 \u4E00\u5E76\u4FEE\u6389\uFF09\u3002 */\r
|
||||
:root {\r
|
||||
color-scheme: light dark;\r
|
||||
--dsw-alias-bg-base: #ffffff;\r
|
||||
--dsw-alias-fill-l1: rgba(16, 24, 40, .03);\r
|
||||
--dsw-alias-border-l1: #e4e7ec;\r
|
||||
--dsw-alias-border-l2: #d0d5dd;\r
|
||||
--dsw-alias-label-primary: #101828;\r
|
||||
--dsw-alias-label-secondary: #475467;\r
|
||||
--dsw-alias-label-tertiary: #98a2b3;\r
|
||||
--dsw-alias-state-accent-primary: #2f6feb;\r
|
||||
}\r
|
||||
@media (prefers-color-scheme: dark) {\r
|
||||
:root {\r
|
||||
--dsw-alias-bg-base: #0b0e14;\r
|
||||
--dsw-alias-fill-l1: rgba(255, 255, 255, .02);\r
|
||||
--dsw-alias-border-l1: #262b36;\r
|
||||
--dsw-alias-border-l2: #3a4150;\r
|
||||
--dsw-alias-label-primary: #e6e8eb;\r
|
||||
--dsw-alias-label-secondary: #9aa4b2;\r
|
||||
--dsw-alias-label-tertiary: #6b7280;\r
|
||||
--dsw-alias-state-accent-primary: #4f8ef7;\r
|
||||
}\r
|
||||
}\r
|
||||
* { box-sizing: border-box; }\r
|
||||
html, body { margin: 0; padding: 0; }\r
|
||||
body {\r
|
||||
background: var(--dsw-alias-bg-base, #0b0e14);\r
|
||||
color: var(--dsw-alias-label-primary, #e6e8eb);\r
|
||||
font-family: var(--dsw-font-family, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif);\r
|
||||
font-size: 13px;\r
|
||||
line-height: 1.6;\r
|
||||
}\r
|
||||
.dshell { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-height: 100%; }\r
|
||||
/* \u6587\u5B57\u5C42\u7EA7 */\r
|
||||
.dshell-title { margin: 0; font-size: 16px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); }\r
|
||||
.dshell-sub { margin: 0; font-size: 12px; color: var(--dsw-alias-label-secondary, #9aa4b2); }\r
|
||||
.dshell-muted { color: var(--dsw-alias-label-tertiary, #6b7280); font-size: 11.5px; }\r
|
||||
/* \u5361\u7247 */\r
|
||||
.dshell-card { border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); padding: 12px 14px; }\r
|
||||
.dshell-card + .dshell-card { margin-top: 10px; }\r
|
||||
/* \u6309\u94AE\uFF08\u7EFF\u8272\u4E3B\u6309\u94AE / \u5E7D\u7075\u6309\u94AE / \u5371\u9669\uFF09 */\r
|
||||
.dshell-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 1px solid transparent; background: #3fb950; color: #0b0e14; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }\r
|
||||
.dshell-btn:hover { filter: brightness(1.08); }\r
|
||||
.dshell-btnGhost { background: transparent; border-color: var(--dsw-alias-border-l1, #262b36); color: var(--dsw-alias-label-secondary, #9aa4b2); }\r
|
||||
.dshell-btnGhost:hover { color: var(--dsw-alias-label-primary, #e6e8eb); border-color: var(--dsw-alias-border-l2, #3a4150); }\r
|
||||
.dshell-btnDanger { background: transparent; border-color: #f85149; color: #f85149; }\r
|
||||
/* \u72B6\u6001\u5FBD\u6807\uFF08\u5706\u70B9 + \u6587\u5B57\uFF1B\u7EFF=\u5DF2\u5B8C\u6210 \u9EC4=\u5F85\u529E/\u5F85\u53D1\u5E03 \u7070=\u672A\u5F00\u59CB\uFF09 */\r
|
||||
.dshell-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--dsw-alias-border-l1, #262b36); font-size: 11.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); }\r
|
||||
.dshell-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); }\r
|
||||
.dshell-badgeDone { color: #3fb950; border-color: rgba(63,185,80,.4); }\r
|
||||
.dshell-badgeDone::before { background: #3fb950; box-shadow: 0 0 5px #3fb950; }\r
|
||||
.dshell-badgeWait { color: #d29922; border-color: rgba(210,153,34,.4); }\r
|
||||
.dshell-badgeWait::before { background: #d29922; box-shadow: 0 0 5px #d29922; }\r
|
||||
.dshell-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dsw-alias-label-tertiary, #6b7280); }\r
|
||||
.dshell-dotDone { background: #3fb950; box-shadow: 0 0 5px #3fb950; }\r
|
||||
.dshell-dotWait { background: #d29922; box-shadow: 0 0 5px #d29922; }\r
|
||||
/* \u6807\u7B7E\u9875 */\r
|
||||
.dshell-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); }\r
|
||||
.dshell-tab { padding: 7px 12px; font-size: 12.5px; color: var(--dsw-alias-label-secondary, #9aa4b2); cursor: pointer; border: none; background: none; font: inherit; border-bottom: 2px solid transparent; margin-bottom: -1px; }\r
|
||||
.dshell-tabOn { color: var(--dsw-alias-label-primary, #e6e8eb); border-bottom-color: var(--dsw-alias-state-accent-primary, #4f8ef7); }\r
|
||||
/* \u5217\u8868 */\r
|
||||
.dshell-list { display: flex; flex-direction: column; gap: 6px; }\r
|
||||
.dshell-listItem { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); cursor: pointer; }\r
|
||||
.dshell-listItem:hover { border-color: var(--dsw-alias-border-l2, #3a4150); background: var(--dsw-alias-fill-l1, rgba(255,255,255,.05)); }\r
|
||||
.dshell-listItemTitle { font-size: 12.5px; color: var(--dsw-alias-label-primary, #e6e8eb); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\r
|
||||
.dshell-listItemMeta { flex: none; font-size: 11px; color: var(--dsw-alias-label-tertiary, #6b7280); }\r
|
||||
/* \u7F51\u683C / \u7EDF\u8BA1 */\r
|
||||
.dshell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }\r
|
||||
.dshell-stat { padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 10px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.02)); }\r
|
||||
.dshell-statLabel { font-size: 11px; color: var(--dsw-alias-label-secondary, #9aa4b2); }\r
|
||||
.dshell-statValue { font-size: 20px; font-weight: 600; color: var(--dsw-alias-label-primary, #e6e8eb); }\r
|
||||
.dshell-statDelta { font-size: 11px; color: #3fb950; }\r
|
||||
/* \u8FDB\u5EA6\u6761 */\r
|
||||
.dshell-progress { height: 6px; border-radius: 3px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.06)); overflow: hidden; }\r
|
||||
.dshell-progressBar { height: 100%; border-radius: 3px; background: #3fb950; }\r
|
||||
/* \u8F93\u5165 */\r
|
||||
.dshell-input, .dshell-textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--dsw-alias-border-l1, #262b36); border-radius: 8px; background: var(--dsw-alias-fill-l1, rgba(255,255,255,.03)); color: var(--dsw-alias-label-primary, #e6e8eb); font: inherit; font-size: 12.5px; outline: none; }\r
|
||||
.dshell-input:focus, .dshell-textarea:focus { border-color: var(--dsw-alias-state-accent-primary, #4f8ef7); }\r
|
||||
/* \u8868\u683C */\r
|
||||
.dshell-table { width: 100%; border-collapse: collapse; font-size: 12px; }\r
|
||||
.dshell-table th, .dshell-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--dsw-alias-border-l1, #262b36); }\r
|
||||
.dshell-table th { color: var(--dsw-alias-label-secondary, #9aa4b2); font-weight: 500; }\r
|
||||
/* \u952E\u503C\u5BF9 */\r
|
||||
.dshell-kv { display: flex; flex-direction: column; gap: 6px; }\r
|
||||
.dshell-kvRow { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }\r
|
||||
.dshell-kvKey { color: var(--dsw-alias-label-secondary, #9aa4b2); }\r
|
||||
.dshell-kvValue { color: var(--dsw-alias-label-primary, #e6e8eb); text-align: right; }\r
|
||||
/* \u5206\u5272\u7EBF */\r
|
||||
.dshell-divider { height: 1px; background: var(--dsw-alias-border-l1, #262b36); margin: 6px 0; }\r
|
||||
/* \u6EDA\u52A8\u6761 */\r
|
||||
::-webkit-scrollbar { width: 10px; height: 10px; }\r
|
||||
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 5px; }\r
|
||||
::-webkit-scrollbar-track { background: transparent; }\r
|
||||
`;
|
||||
|
||||
// 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 <!-- \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';
|
||||
var dshell_default2 = '<!doctype html>\r\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\r\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 -->\r\n<html lang="zh-CN">\r\n<head>\r\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\r\n \u72EC\u7ACB\u6253\u5F00 / \u5D4C\u5957 iframe \u65F6\u663E\u5F0F\u5F15\u5165\u4E0B\u9762\u8FD9\u4E00\u884C\u5373\u53EF\uFF1A\r\n <script src="/api/worktable/template/theme.js"></script> -->\r\n <meta charset="utf-8" />\r\n <meta name="viewport" content="width=device-width, initial-scale=1" />\r\n <title>\u6211\u7684\u7A97\u53E3</title>\r\n <link rel="stylesheet" href="/api/worktable/template/dshell.css" />\r\n</head>\r\n<body>\r\n <div class="dshell">\r\n <!-- \u6807\u9898\u533A -->\r\n <h1 class="dshell-title">\u7A97\u53E3\u6807\u9898</h1>\r\n <p class="dshell-sub">\u4E00\u53E5\u8BDD\u8BF4\u660E\u8FD9\u4E2A\u7A97\u53E3\u505A\u4EC0\u4E48\u3002</p>\r\n\r\n <!-- \u72B6\u6001\u5FBD\u6807\uFF1A\u5DF2\u5B8C\u6210 dshell-badgeDone / \u8FDB\u884C\u4E2D dshell-badgeWait / \u9ED8\u8BA4 -->\r\n <div>\r\n <span class="dshell-badge dshell-badgeDone">\u5DF2\u5B8C\u6210</span>\r\n <span class="dshell-badge dshell-badgeWait">\u8FDB\u884C\u4E2D</span>\r\n <span class="dshell-badge">\u672A\u5F00\u59CB</span>\r\n </div>\r\n\r\n <!-- \u6807\u7B7E\u9875 -->\r\n <div class="dshell-tabs">\r\n <button class="dshell-tab dshell-tabOn">\u6982\u89C8</button>\r\n <button class="dshell-tab">\u8BE6\u60C5</button>\r\n <button class="dshell-tab">\u8BBE\u7F6E</button>\r\n </div>\r\n\r\n <!-- \u7EDF\u8BA1\u5361\u7247\u7F51\u683C -->\r\n <div class="dshell-grid">\r\n <div class="dshell-stat">\r\n <div class="dshell-statLabel">\u603B\u6570</div>\r\n <div class="dshell-statValue">128</div>\r\n <div class="dshell-statDelta">+12.4%</div>\r\n </div>\r\n <div class="dshell-stat">\r\n <div class="dshell-statLabel">\u8FDB\u884C\u4E2D</div>\r\n <div class="dshell-statValue">7</div>\r\n </div>\r\n <div class="dshell-stat">\r\n <div class="dshell-statLabel">\u5DF2\u5B8C\u6210</div>\r\n <div class="dshell-statValue">121</div>\r\n </div>\r\n </div>\r\n\r\n <!-- \u5217\u8868 -->\r\n <div class="dshell-list">\r\n <div class="dshell-listItem">\r\n <span class="dshell-listItemTitle">\u6761\u76EE\u4E00\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898</span>\r\n <span class="dshell-listItemMeta">\u6628\u5929</span>\r\n </div>\r\n <div class="dshell-listItem">\r\n <span class="dshell-listItemTitle">\u6761\u76EE\u4E8C\uFF1A\u793A\u4F8B\u5185\u5BB9\u6807\u9898</span>\r\n <span class="dshell-badge dshell-badgeDone">\u5DF2\u53D1\u5E03</span>\r\n </div>\r\n </div>\r\n\r\n <!-- \u5361\u7247 + \u952E\u503C\u5BF9 -->\r\n <div class="dshell-card">\r\n <h2 class="dshell-sub" style="margin:0 0 8px">\u8BE6\u60C5</h2>\r\n <div class="dshell-kv">\r\n <div class="dshell-kvRow"><span class="dshell-kvKey">\u5B57\u6BB5 A</span><span class="dshell-kvValue">\u503C A</span></div>\r\n <div class="dshell-kvRow"><span class="dshell-kvKey">\u5B57\u6BB5 B</span><span class="dshell-kvValue">\u503C B</span></div>\r\n </div>\r\n <div class="dshell-divider"></div>\r\n <div class="dshell-progress"><div class="dshell-progressBar" style="width:72%"></div></div>\r\n </div>\r\n\r\n <!-- \u64CD\u4F5C\u533A -->\r\n <div style="display:flex;gap:8px">\r\n <button class="dshell-btn">\u4E3B\u8981\u64CD\u4F5C</button>\r\n <button class="dshell-btn dshell-btnGhost">\u6B21\u8981\u64CD\u4F5C</button>\r\n </div>\r\n </div>\r\n</body>\r\n</html>\r\n';
|
||||
|
||||
// src/index.ts
|
||||
function baseDshHome() {
|
||||
@@ -382,7 +382,7 @@ function resolveDshHomeSafe() {
|
||||
cachedDshHome = baseDshHome();
|
||||
return cachedDshHome;
|
||||
}
|
||||
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.4";
|
||||
var PLUGIN_VERSION = false ? "dev" : "0.5.3-local.5";
|
||||
var name = "dsh-worktable";
|
||||
var inject = ["webServer", "sessions"];
|
||||
var HEALTH_PATH = "/api/worktable/health";
|
||||
@@ -651,20 +651,35 @@ function apply(ctx) {
|
||||
}
|
||||
})();
|
||||
};
|
||||
const register = (route, publicAsset = false) => ctx.effect(() => webServer.register({
|
||||
...route,
|
||||
handler: async (req, res) => {
|
||||
if (!publicAsset && route.path !== HEALTH_PATH) {
|
||||
const rejected = await requestRejection(ctx, req);
|
||||
if (rejected !== void 0) {
|
||||
if (route.path === "/api/worktable/state") stateLog("REJECT " + req.method + " -> " + rejected);
|
||||
json(res, rejected, { error: rejectionText(rejected) });
|
||||
return;
|
||||
const register = (route, publicAsset = false) => {
|
||||
let dispose;
|
||||
try {
|
||||
dispose = webServer.register({
|
||||
...route,
|
||||
handler: async (req, res) => {
|
||||
if (!publicAsset && route.path !== HEALTH_PATH) {
|
||||
const rejected = await requestRejection(ctx, req);
|
||||
if (rejected !== void 0) {
|
||||
if (route.path === "/api/worktable/state") stateLog("REJECT " + req.method + " -> " + rejected);
|
||||
json(res, rejected, { error: rejectionText(rejected) });
|
||||
return;
|
||||
}
|
||||
}
|
||||
return route.handler(req, res);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
if (String(err).includes("duplicate")) {
|
||||
ctx.logger?.warn("[dsh-worktable] \u8DEF\u7531\u5DF2\u88AB\u5360\u7528\uFF08\u70ED\u91CD\u8F7D\u6CC4\u6F0F\u81EA\u4FDD\uFF09\uFF0C\u8DF3\u8FC7: " + route?.path);
|
||||
return;
|
||||
}
|
||||
return route.handler(req, res);
|
||||
throw err;
|
||||
}
|
||||
}), "dsh-worktable: " + route.path);
|
||||
try {
|
||||
ctx.effect(() => dispose, "dsh-worktable: " + route.path);
|
||||
} catch {
|
||||
}
|
||||
};
|
||||
register({
|
||||
kind: "exact",
|
||||
path: "/api/worktable/preview",
|
||||
|
||||
Reference in New Issue
Block a user