aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-09-16 18:17:04 +0200
committer0neGal <mail@0negal.com>2023-09-16 18:17:04 +0200
commitf3e5e1596a22c3df38a8c00a5ceadf8a5dd2967a (patch)
treea5ae56bdc7baedc22930697de9cefc171705410d /src/index.js
parent53c19052738a4a9cc43feca31e8231c844b4d2b5 (diff)
downloadViper-f3e5e1596a22c3df38a8c00a5ceadf8a5dd2967a.tar.gz
Viper-f3e5e1596a22c3df38a8c00a5ceadf8a5dd2967a.zip
added buttons for fixing some problems and alike
I will likely add more buttons in the future, but for now this is most of the ones a user could need to repair problems.
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js50
1 files changed, 47 insertions, 3 deletions
diff --git a/src/index.js b/src/index.js
index a097525..220d490 100644
--- a/src/index.js
+++ b/src/index.js
@@ -81,11 +81,55 @@ function start() {
});
ipcMain.on("minimize", () => {win.minimize()});
- ipcMain.on("relaunch", () => {app.relaunch(); app.exit()});
+ ipcMain.on("relaunch", () => {
+ app.relaunch({
+ args: process.argv.slice(1)
+ });
+
+ app.exit(0);
+ });
+
ipcMain.on("kill-game", () => {
kill.game();
});
+ ipcMain.on("kill-origin", () => {
+ kill.origin();
+ });
+
+ ipcMain.on("delete-request-cache", () => {
+ requests.delete_cache();
+ });
+
+ ipcMain.on("delete-install-cache", () => {
+ let delete_dirs = [
+ path.join(app.getPath("cache"), "vipertmp"),
+ path.join(settings.gamepath, "northstar.zip")
+ ]
+
+ for (let i = 0; i < delete_dirs.length; i++) {
+ if (fs.existsSync(delete_dirs[i])) {
+ fs.rmSync(delete_dirs[i], {recursive: true});
+ }
+ }
+ });
+
+ ipcMain.on("reset-config", async () => {
+ let confirmation = await win_show.confirm(
+ lang("gui.settings.miscbuttons.reset_config_alert")
+ )
+
+ if (confirmation) {
+ fs.rmSync("viper.json");
+
+ app.relaunch({
+ args: process.argv.slice(1)
+ });
+
+ app.exit(0);
+ }
+ });
+
// passthrough to renderer from main
ipcMain.on("win-log", (event, ...args) => {send("log", ...args)});
ipcMain.on("win-alert", (event, msg, id) => {
@@ -207,12 +251,12 @@ ipcMain.on("setlang", (event, lang) => {
settings.save();
});
-ipcMain.on("update-northstar", async () => {
+ipcMain.on("update-northstar", async (e, force_install) => {
if (await is_running.game()) {
return win_show.alert(lang("general.auto_updates.game_running"));
}
- update.northstar();
+ update.northstar(force_install);
})
ipcMain.on("setpath-cli", () => {gamepath.set()});