fix: renderer 模块改经 IPC+Blob URL 装载(绕开 dev http 源 CORS);插件页改为全局/项目作用域切换
This commit is contained in:
@@ -397,6 +397,13 @@ export function registerIpc(): AgentService {
|
||||
|
||||
ipcMain.handle('plugins:list', () => getPluginHost().list())
|
||||
ipcMain.handle('plugins:uiState', () => getPluginHost().uiState())
|
||||
// 外置插件来源目录(设置页「打开目录」)
|
||||
ipcMain.handle('plugins:dirs', () => getPluginHost().pluginDirs())
|
||||
// 外置插件渲染层模块源码(渲染层以 Blob URL import,绕开 dev http 源对 plugin:// 的 CORS 限制)
|
||||
ipcMain.handle('plugins:readRenderer', (_e, id: unknown) => {
|
||||
if (typeof id !== 'string' || !/^[a-z][a-z0-9-]*$/.test(id)) throw new Error('invalid plugin id')
|
||||
return getPluginHost().readRendererSource(id)
|
||||
})
|
||||
ipcMain.handle('plugins:setEnabled', (_e, id: unknown, enabled: unknown) => {
|
||||
if (typeof id !== 'string' || typeof enabled !== 'boolean') throw new Error('invalid plugin toggle')
|
||||
return getPluginHost().setEnabled(id, enabled)
|
||||
|
||||
Reference in New Issue
Block a user