Don't start the app as root

This commit is contained in:
WolverinDEV 2021-05-02 11:36:47 +02:00
parent 44e03dd00f
commit 177d6582ea
2 changed files with 31 additions and 17 deletions

View File

@ -725,8 +725,12 @@ export async function prepareUpdateExecute(targetVersion: UpdateVersion, callbac
callbackLog("error",
"We don't have permissions to write to all files.\n" +
"Please close this client and execute the following command:\n" +
`sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"` + "\n\n" +
"Please do the following steps:\n" +
"1. Close this client\n" +
"2. Execute this command:\n" +
` sudo "${updateInstallerExecutable}" "${installLogFile}" "${installConfigFile}"` + "\n" +
"3. Start the client again\n\n" +
"Note:\n" +
"We've already copied that command to your clipboard."
);
return;

View File

@ -46,6 +46,8 @@ async function handleAppReady() {
}
console.log("Update success: %o. Update data: %o", success, data);
const isRootExec = process.getuid && process.getuid() === 0;
let title;
let type;
let message;
@ -63,10 +65,14 @@ async function handleAppReady() {
message = "Update has been successfully installed!\nWhat do you want to do next?";
buttons.push({
key: "Launch client",
callback: async () => false
});
if(!isRootExec) {
/* Don't start the app automatically if we're still having root privileges */
buttons.push({
key: "Launch client",
callback: async () => false
});
}
if(data.parse_success && data.log_file) {
buttons.push({
key: "Open update log",
@ -90,17 +96,21 @@ async function handleAppReady() {
message += "\nUnknown error! Lookup the console for more details.";
}
buttons.push({
key: "Ignore",
callback: async () => false
});
buttons.push({
key: "Retry update",
callback: async () => {
await showUpdateWindow();
return true;
}
});
if(!isRootExec) {
/* Don't start the app automatically if we're still having root privileges */
buttons.push({
key: "Ignore",
callback: async () => false
});
buttons.push({
key: "Retry update",
callback: async () => {
await showUpdateWindow();
return true;
}
});
}
if(data.parse_success && data.log_file) {
buttons.push({
key: "Open update log",