mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-13 18:54:21 +01:00
This commit is contained in:
parent
aa5acf39cf
commit
f600cc1bde
4 changed files with 31 additions and 29 deletions
|
|
@ -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
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue