feat(plugins): P3 开发者模式(plugins/local/<id>/plugin.js 免签名加载)+ SDK 文档与示例插件
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m22s
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m22s
This commit is contained in:
1 parent
1008370733
commit
49b8cb3abd
7 files changed
+225
-7
No files matched your search
@@ -88,7 +88,8 @@ const root = path.resolve(__dirname, '..')
|
||||
const appJs = fs.readFileSync(path.join(root, 'app.js'), 'utf8')
|
||||
assert.ok(/script\.integrity = integrity; script\.crossOrigin = 'anonymous'/.test(appJs), 'loader 应把 integrity 交给浏览器强制校验')
|
||||
assert.ok(/record\.status = 'bad-entry'; record\.error = 'integrity 格式不合法'/.test(appJs), 'integrity 格式不合法应拒绝加载')
|
||||
assert.ok(/if \(!integrity\) \{ record\.status = 'bad-entry'; record\.error = 'integrity 缺失(拒绝加载)'; continue \}/.test(appJs), '缺失 integrity 应拒绝加载(fail-closed)')
|
||||
// 2026-11-17:本地开发插件(source=local)免 integrity,其余(市场/内置)仍然 fail-closed
|
||||
assert.ok(/if \(!integrity && !isLocalEntry\) \{ record\.status = 'bad-entry'; record\.error = 'integrity 缺失(拒绝加载)'; continue \}/.test(appJs), '缺失 integrity 应拒绝加载(fail-closed,本地开发插件除外)')
|
||||
assert.ok(!/record\.integrity = integrity \|\| 'missing'/.test(appJs), '不应再有「缺失记为 missing 并继续加载」的过渡分支')
|
||||
|
||||
console.log('plugin integrity checks passed')
|
||||
|
||||
@@ -150,7 +150,7 @@ const MAX_SRC_COMPONENT_LINES = 531
|
||||
// ② 同时守「app.js 占总源码 ≤ 40%」(2026-11-12 实测 38.4%)—— app.js 可以涨,
|
||||
// 但必须涨得比 src 慢;功能继续加,占比自然往下走;
|
||||
// ③ Workbench 单函数上限**不动**(3,091)—— 那才是真坏味道的护栏,总量松它不松。
|
||||
const MAX_APP_JS_LINES = 8840 // 2026-11-17:市场请求改走原生 HTTP(+2 行 helper) // 2026-11-17 桌面版:插件市场(索引拉取/下载/sha256/写入 plugins/)约 +53 行;待抽到 src/runtime-plugin-market.js 后回调
|
||||
const MAX_APP_JS_LINES = 8890 // 2026-11-17 P3:开发者模式本地插件加载器(+37 行) // 2026-11-17:市场请求改走原生 HTTP(+2 行 helper) // 2026-11-17 桌面版:插件市场(索引拉取/下载/sha256/写入 plugins/)约 +53 行;待抽到 src/runtime-plugin-market.js 后回调
|
||||
const MAX_APP_JS_SHARE = 0.40
|
||||
|
||||
// ── 历史记账(供回溯,逐条保留)──────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user