🐛 Set proxy

This commit is contained in:
Daniel 2023-10-09 00:09:37 +08:00
parent 7b10f042b5
commit b589a93f13
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 7 additions and 4 deletions

View file

@ -737,6 +737,13 @@ app.whenReady().then(() => {
break;
case "setProxy":
event.sender.session.closeAllConnections().then(() => {
if (data.proxyURL.startsWith("://")) {
event.sender.session.setProxy({mode: "system"}).then(() => {
console.log("network proxy [system]");
});
return;
}
event.sender.session.setProxy({proxyRules: data.proxyURL}).then(() => {
console.log("network proxy [" + data.proxyURL + "]");
});

View file

@ -8,10 +8,6 @@ import {Constants} from "../../constants";
export const setProxy = () => {
/// #if !BROWSER
if ("" === window.siyuan.config.system.networkProxy.scheme) {
console.log("network proxy [system]");
return;
}
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}`