Skip to content

Commit

Permalink
3.3.2 properly fix linux
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-nettica committed Feb 2, 2025
1 parent e7940b1 commit e781da3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
6 changes: 3 additions & 3 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
"deb",
"rpm"
],
"desktop": {
"Exec": "\"/opt/Nettica Agent/nettica.agent\" --no-sandbox %U"
}
"executableArgs": [
"--no-sandbox"
]
},

"win": {
Expand Down
24 changes: 21 additions & 3 deletions src/components/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ let xPath = null;
let NetticaServersPath = appData + "\\nettica\\";
if (os.platform() == "linux") {
xPath = `"/opt/Nettica Agent/nettica.agent" --no-sandbox %U`; // have to fix it up because of the space in the path, add the --no-sandbox for new versions of linux
xPath = `/opt/Nettica\\ Agent/nettica.agent`; // must have this exactly as it is in order to properly fix the bug in AutoLauncher
NetticaServersPath = "/etc/nettica/";
}
Expand Down Expand Up @@ -1999,11 +1999,29 @@ export default {
});
}
},
setAutoLaunch() {
async setAutoLaunch() {
if (this.autoLaunch) {
autoLauncher.enable();
await autoLauncher.enable();
// autoLauncher can't properly create the desktop file on linux,
// so copy it from /usr/share/applications because it's correct there
if (os.platform() == "linux") {
const src = "/usr/share/applications/nettica.agent.desktop";
const dest = `${os.homedir()}/.config/autostart/nettica.agent.desktop`;
const autostartDir = `${os.homedir()}/.config/autostart`;
if (!fs.existsSync(autostartDir)) {
fs.mkdirSync(autostartDir, { recursive: true });
}
fs.copyFile(src, dest, (err) => {
if (err) {
console.error("Error copying file:", err);
} else {
console.log("File copied to autostart directory");
}
});
}
} else {
autoLauncher.disable();
// we don't need to remove the file if linux, autoLauncher can manage that
}
},
loadNetwork(config) {
Expand Down

0 comments on commit e781da3

Please sign in to comment.