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:
@@ -39,7 +39,7 @@ test('Preview reads only its canonical root, including directory indexes',async(
|
||||
for(const parts of [['..','outside','outside.txt'],['..\\outside\\outside.txt'],['/outside'],['bad\0']]) assert.equal(await store.file(token,parts),null)
|
||||
symlinkSync(outside,join(root,'escape'),process.platform==='win32'?'junction':'dir')
|
||||
assert.equal(await store.file(token,['escape','outside.txt']),null)
|
||||
rmSync(join(root,'escape'))
|
||||
try { rmSync(join(root,'escape')) } catch { try { unlinkSync(join(root,'escape')) } catch {} }
|
||||
})
|
||||
test('Capabilities expire after idle time; revocation and disposal remove them',async()=>{
|
||||
let now=0;const store=createPreviewFiles(()=>now),a=await store.mount(root)
|
||||
|
||||
@@ -226,7 +226,9 @@ test('loading legacy project state preserves its saved windows without using old
|
||||
const saved = specOf('old')
|
||||
saved.top[0].tabs = [{ id: 'old-tab', content: { kind: 'iframe', url: 'old.html' } }]
|
||||
const store = storage({ 'dsh.worktable.projects.v1': JSON.stringify({ layouts: [saved], folders: { old: 'C:/shared' } }), 'dsh.worktable.pendingMount.v1': JSON.stringify({ fresh: { content: 'old.html' } }) })
|
||||
const load = evaluate(section(indexSource, 'function loadProjects()', '\nconst clamp') + '\nexport { loadProjects }', { localStorage: store, PROJECTS_KEY: 'dsh.worktable.projects.v1', DEFAULT_PROJECTS: {} }).loadProjects
|
||||
// 提取段必须包含 normalizeProjects:loadProjects 依赖它解析 layouts,
|
||||
// 否则运行时 ReferenceError 被 catch 吞掉,返回 DEFAULT_PROJECTS,断言随之为 undefined。
|
||||
const load = evaluate(section(indexSource, 'function normalizeProjects(raw: any)', '\nconst clamp') + '\nexport { loadProjects }', { localStorage: store, PROJECTS_KEY: 'dsh.worktable.projects.v1', DEFAULT_PROJECTS: {} }).loadProjects
|
||||
assert.equal(load().layouts[0].top[0].tabs[0].content.url, 'old.html')
|
||||
assert.equal(new WidgetMountRegistry(store).entries().length, 0)
|
||||
assert.ok(!indexSource.includes("getItem('dsh.worktable.pendingMount.v1')"))
|
||||
|
||||
Reference in New Issue
Block a user