feat(shell): 插件密码加密、失败熔断与客户端自动更新(v1.11.3)
- 插件配置中 format=password 字段改为 AES-256-GCM 密文落盘(本机密钥,历史明文自动迁移) - 同一插件连续失败 3 次自动禁用(仅统计进程启动后失败),升级自动解除 - 检测到新版本后台下载,空闲窗口提前提示并自动重启升级,设置页可配安全窗口
This commit is contained in:
@@ -136,4 +136,29 @@ function findByName(name) {
|
||||
return find(name);
|
||||
}
|
||||
|
||||
module.exports = { pluginRoot, listLocalPlugins, readManifest, fieldsFromSchema, pluginSchema, find };
|
||||
// 按插件 id 取密码字段名(format=password)。
|
||||
// 目录名与 manifest.id 可能不一致:生产机安装目录用 xq0078,仓库里是「XQ0078 中文名」。
|
||||
// 先按目录名直查,失败再遍历比对 manifest.id,避免配置加密因命名差异静默失效。
|
||||
function passwordKeysOf(pluginId) {
|
||||
const localCrypto = require("./local-crypto"); // 延迟 require:本模块被 config 间接依赖,避免加载期环
|
||||
try {
|
||||
return localCrypto.passwordKeys(find(pluginId).fields);
|
||||
} catch (_) { /* 目录名不等于 id:继续遍历 */ }
|
||||
try {
|
||||
for (const entry of listLocalPlugins()) {
|
||||
const schema = pluginSchema(entry.id);
|
||||
if (schema.id === pluginId) return localCrypto.passwordKeys(schema.fields);
|
||||
}
|
||||
} catch (_) { /* 忽略 */ }
|
||||
return [];
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
pluginRoot,
|
||||
listLocalPlugins,
|
||||
readManifest,
|
||||
fieldsFromSchema,
|
||||
pluginSchema,
|
||||
find,
|
||||
passwordKeysOf,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user