Skip to content

Commit

Permalink
fix: checkProxy for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-AshishRanjan committed Jan 17, 2024
1 parent a7655a3 commit 0b18cfc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const createWindow = () => {
},
// autoHideMenuBar: true,
icon: path.join(__dirname, "./assets/icons/icon_512.png"),
roundedCorners: true,
});
mainWindow.setIcon(path.join(__dirname, "./assets/icons/icon_512.png"));
// and load the index.html of the app.
Expand Down Expand Up @@ -65,6 +66,7 @@ const createDynamicWindow = (file) => {
fullscreenable: false,
resizable: false,
icon: path.join(__dirname, "./assets/icons/icon_512.png"),
roundedCorners: true,
});

dynamicWindow.setIcon(path.join(__dirname, "./assets/icons/icon_512.png"));
Expand All @@ -88,6 +90,7 @@ const createURLWindow = (file) => {
autoHideMenuBar: true,
resizable: false,
icon: path.join(__dirname, "./assets/icons/icon_512.png"),
roundedCorners: true,
});

dynamicWindow.setIcon(path.join(__dirname, "./assets/icons/icon_512.png"));
Expand Down Expand Up @@ -206,6 +209,11 @@ const menu = [
click: () => createURLWindow(),
accelerator: "CmdOrCtrl+F",
},
{
label: "Open Dev Tools",
click: () => mainWindow.webContents.openDevTools(),
accelerator: "CmdOrCtrl+O",
},
],
},
]
Expand Down Expand Up @@ -265,11 +273,11 @@ const checkProxy = () => {
linuxProxy = undefined;
}
mainWindow.webContents.send("proxy:check:success", {
msg: `current system proxy : ${currentProxy}`,
msg: `current system proxy : ${linuxProxy}`,
proxy: linuxProxy,
});
dynamicWindow.webContents.send("proxy:check:success", {
msg: `current system proxy : ${currentProxy}`,
msg: `current system proxy : ${linuxProxy}`,
proxy: linuxProxy,
});
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ const checkCurrentProxy = (callback) => {
console.log({ currentProxy });
if (process.platform === "linux") {
// checking proxy
if (currentProxy.includes("HTTP_PROXY")) {
if (stdout.includes("HTTP_PROXY")) {
// proxy present
const temp = currentProxy.split("HTTP_PROXY=");
const linuxProxy = temp[temp.length - 1];
console.log({linuxProxy});
callback(linuxProxy, null);
} else {
// no proxy
Expand Down

0 comments on commit 0b18cfc

Please sign in to comment.