feat(plugins): P1 插件外置(<资料目录>/plugins 覆盖内置、sha256 校验、blob 注入、来源标签);CSP 放行 blob:
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m11s
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m11s
This commit is contained in:
1 parent
2626c663c3
commit
5da4f255d8
5 files changed
+106
-10
No files matched your search
@@ -25,12 +25,22 @@
|
||||
if (!pluginItems.length && !remoteIdle.length && !remoteFailed.length) return el('div', { className: 'iwb-hint' }, '暂无已注册插件。插件随应用一起发布,启用后其面板 / 命令 / 节点类型才会出现。')
|
||||
return el('div', { className: 'iwb-set-page' },
|
||||
el('div', { className: 'iwb-set-page-title' }, '插件管理'),
|
||||
isDesk() && (() => {
|
||||
const F = (typeof window !== 'undefined') ? window.IWBStorageFile : null
|
||||
const extCount = (wRuntimePlugins || []).filter((r) => r && r.source === 'external').length
|
||||
const dirHint = (F && F.dir && F.dir()) ? (F.dir() + '/plugins/') : '资料目录/plugins/'
|
||||
return el('div', { className: 'iwb-hint' },
|
||||
'外部插件:' + dirHint + '(放 index.json + 插件 js 即可覆盖内置;' + (extCount ? '当前 ' + extCount + ' 个来自外部' : '当前全部来自内置') + ')。',
|
||||
)
|
||||
})(),
|
||||
el('div', { className: 'iwb-hint' }, (isDesk()
|
||||
? '插件随应用一起发布(离线可用),升级插件需要更新应用版本。停用只隐藏其入口:既有的插件节点仍照常渲染、运行与保存。'
|
||||
? '插件随应用发布(离线可用);外部插件放在资料目录 plugins/ 下可独立维护,不动本体。停用只隐藏其入口:既有的插件节点仍照常渲染、运行与保存。'
|
||||
: '内置插件随应用发布;带「远程」标签的插件来自同源 /plugins/index.json(KV 提供),更新只需上传到 KV、刷新即生效。停用只隐藏其入口:既有的插件节点仍照常渲染、运行与保存。')),
|
||||
pluginItems.map((p) => {
|
||||
return el('div', { key: p.id, className: 'iwb-plugin-row' },
|
||||
el('label', { className: 'iwb-label iwb-grow' },
|
||||
el('span', { className: 'iwb-hint', style: { marginRight: 6 } },
|
||||
((wRuntimePlugins || []).find((r) => r && r.id === p.id && r.source === 'external') ? '外部' : '内置')),
|
||||
el('input', {
|
||||
type: 'checkbox', checked: p.enabled, disabled: !p.compatible,
|
||||
onChange: (e) => { const r = PluginHost.setEnabled(p.id, e.target.checked); setPluginsRev((v) => v + 1); if (!r.ok) setMsg({ type: 'err', text: p.name + ':' + r.error }) },
|
||||
|
||||
Reference in new issue
Block a user