fix(plugins): 加载阶段不再写启用状态;启动时先快照用户开关再双向应用(关掉的插件重启后保持关闭)
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m21s
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 1m21s
This commit is contained in:
1 parent
d83f7f5eef
commit
5dba56363a
2 files changed
+10
-7
No files matched your search
@@ -46,9 +46,8 @@
|
||||
const H = host()
|
||||
const registered = !!(H && typeof H.list === 'function' && H.list().some(function (p) { return p.id === record.id }))
|
||||
record.status = registered ? 'loaded' : 'not-registered'
|
||||
// 自愈:只要脚本成功注册,就把启用状态写回 true
|
||||
// (此前只在「已经启用」时写,导致状态里残留的 false 永远翻不回来,界面显示已加载但开关是关的)
|
||||
if (registered) { try { H.setEnabled(record.id, true) } catch (e) { /* ignore */ } }
|
||||
// 不在加载阶段写启用状态:否则会把用户关掉的插件又打开
|
||||
// (启用/停用由 app.js 加载完成后按持久化状态统一应用)
|
||||
return record.status === 'loaded'
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user