feat: 设置面板添加代理配置 — web_search/web_fetch走HTTP代理(Clash等)
This commit is contained in:
@@ -231,6 +231,21 @@ export async function setupIPC(): Promise<void> {
|
||||
return { success: true };
|
||||
});
|
||||
|
||||
// ── 代理设置(web_search/web_fetch 走代理)──
|
||||
ipcMain.handle('proxy:set', (_, url: string) => {
|
||||
if (url) {
|
||||
process.env.HTTP_PROXY = url;
|
||||
process.env.HTTPS_PROXY = url;
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
||||
sendLog('info', `🌐 代理已设置`, url);
|
||||
} else {
|
||||
delete process.env.HTTP_PROXY;
|
||||
delete process.env.HTTPS_PROXY;
|
||||
delete process.env.NODE_TLS_REJECT_UNAUTHORIZED;
|
||||
sendLog('info', `🌐 代理已禁用`);
|
||||
}
|
||||
});
|
||||
|
||||
// ── Workspace IPC ──
|
||||
|
||||
// 获取工作空间目录
|
||||
|
||||
+2
-1
@@ -20,7 +20,8 @@ contextBridge.exposeInMainWorld('metonaDesktop', {
|
||||
execute: (toolName: string, args: Record<string, unknown>) => ipcRenderer.invoke('tool:execute', toolName, args),
|
||||
getConfig: () => ipcRenderer.invoke('tool:getConfig'),
|
||||
setAllowedDirs: (dirs: string[]) => ipcRenderer.invoke('tool:setAllowedDirs', dirs),
|
||||
setTimeouts: (timeouts: { http?: number; mcp?: number }) => ipcRenderer.invoke('tool:setTimeouts', timeouts)
|
||||
setTimeouts: (timeouts: { http?: number; mcp?: number }) => ipcRenderer.invoke('tool:setTimeouts', timeouts),
|
||||
setProxy: (url: string) => ipcRenderer.invoke('proxy:set', url)
|
||||
},
|
||||
notify: (title: string, body: string) => ipcRenderer.invoke('notify', title, body),
|
||||
window: {
|
||||
|
||||
Reference in New Issue
Block a user