feat(plugins): 依赖互调 + SQLite 存储,契约 0.3.0
This commit is contained in:
@@ -470,6 +470,16 @@ export function registerIpc(): AgentService {
|
||||
if (typeof id !== 'string' || typeof enabled !== 'boolean') throw new Error('invalid plugin toggle')
|
||||
return getPluginHost().setEnabled(id, enabled)
|
||||
})
|
||||
// 打开插件私有数据目录(资源管理器中显示;不存在则先建)
|
||||
handle('plugins:openDataDir', (_e, id: unknown) => {
|
||||
if (typeof id !== 'string' || !/^[a-z][a-z0-9-]*$/.test(id)) throw new Error('invalid plugin id')
|
||||
return getPluginHost().openPluginDataDir(id)
|
||||
})
|
||||
// 清除插件全部存储数据(设置页二次确认后调用;连接关闭 + 删数据目录)
|
||||
handle('plugins:clearData', (_e, id: unknown) => {
|
||||
if (typeof id !== 'string' || !/^[a-z][a-z0-9-]*$/.test(id)) throw new Error('invalid plugin id')
|
||||
return getPluginHost().clearPluginData(id)
|
||||
})
|
||||
handle('plugins:reload', () => getPluginHost().reload())
|
||||
handle('plugins:openView', (_e, view: unknown, params: unknown) => {
|
||||
if (typeof view !== 'string' || !view) throw new Error('invalid view')
|
||||
|
||||
Reference in New Issue
Block a user