This commit is contained in:
Vanessa 2023-10-08 23:41:10 +08:00
parent aa5acf39cf
commit f600cc1bde
4 changed files with 31 additions and 29 deletions

View file

@ -1,9 +1,10 @@
/// #if !BROWSER
import {getCurrentWindow} from "@electron/remote";
import {ipcRenderer} from "electron";
/// #endif
import {Dialog} from "../../dialog";
import {isMobile} from "../../util/functions";
import {fetchPost} from "../../util/fetch";
import {Constants} from "../../constants";
export const setProxy = () => {
/// #if !BROWSER
@ -11,13 +12,9 @@ export const setProxy = () => {
console.log("network proxy [system]");
return;
}
const session = getCurrentWindow().webContents.session;
session.closeAllConnections().then(() => {
const proxyURL = `${window.siyuan.config.system.networkProxy.scheme}://${window.siyuan.config.system.networkProxy.host}:${window.siyuan.config.system.networkProxy.port}`;
session.setProxy({proxyRules: proxyURL}).then(
() => console.log("network proxy [" + proxyURL + "]"),
);
ipcRenderer.send(Constants.SIYUAN_CMD, {
cmd: "setProxy",
proxyURL: `${window.siyuan.config.system.networkProxy.scheme}://${window.siyuan.config.system.networkProxy.host}:${window.siyuan.config.system.networkProxy.port}`
});
/// #endif
};