From 5b1407638ae4c77ce5a45fae88facc2e9a9c1713 Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Thu, 25 Jan 2024 14:10:18 +0100 Subject: [PATCH 1/2] add dialog for unhandled errors --- main.js | 10 +++++++ package-lock.json | 66 +++++++++++++++++++++++++++++++++++++++++++++-- package.json | 1 + 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 029267b..e5574dc 100644 --- a/main.js +++ b/main.js @@ -2,6 +2,16 @@ const { app, BrowserWindow, Menu, ipcMain, dialog, shell } = require( "electron", ); + +const unhandled = require("electron-unhandled"); +unhandled({ + logger: console.error, + showDialog: true, + reportButton: () => { + shell.openExternal("https://ez-pp.farm/discord"); + }, +}); + const path = require("path"); const serve = require("electron-serve"); const loadURL = serve({ directory: "public" }); diff --git a/package-lock.json b/package-lock.json index 28a167b..47ca3fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ezpplauncher-next", - "version": "2.0.0", + "version": "2.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ezpplauncher-next", - "version": "2.0.0", + "version": "2.1.0", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -18,6 +18,7 @@ "custom-electron-titlebar": "^4.2.7", "discord-auto-rpc": "^1.0.17", "electron-serve": "^1.1.0", + "electron-unhandled": "^4.0.1", "fkill": "^7.2.1", "get-window-by-name": "^2.0.0", "regedit-rs": "^1.0.2", @@ -3720,6 +3721,14 @@ "node": ">= 10.0.0" } }, + "node_modules/electron-is-dev": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz", + "integrity": "sha512-3X99K852Yoqu9AcW50qz3ibYBWY79/pBhlMCab8ToEWS48R0T9tyxRiQhwylE7zQdXrMnx2JKqUJyMPmt5FBqA==", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/electron-publish": { "version": "24.8.1", "resolved": "https://registry.npmjs.org/electron-publish/-/electron-publish-24.8.1.tgz", @@ -3787,6 +3796,46 @@ "integrity": "sha512-f7/be56VjRRQk+Ric6PmIrEtPcIqsn3tElyAu9Sh6egha2VLJ82qwkcOdcnT06W+Pb6RUulV1ckzrGbKzVcTHg==", "dev": true }, + "node_modules/electron-unhandled": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/electron-unhandled/-/electron-unhandled-4.0.1.tgz", + "integrity": "sha512-6BsLnBg+i96eUnbaIFZyYdyfNX3f80/Nlfqy34YEMxXT9JP3ddNsNnUeiOF8ezN4+et4t4D37gjghKTP0V3jyw==", + "dependencies": { + "clean-stack": "^2.1.0", + "electron-is-dev": "^2.0.0", + "ensure-error": "^2.0.0", + "lodash.debounce": "^4.0.8", + "serialize-error": "^8.1.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/electron-unhandled/node_modules/serialize-error": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-8.1.0.tgz", + "integrity": "sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ==", + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/electron-unhandled/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/electron/node_modules/@types/node": { "version": "18.19.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.6.tgz", @@ -3818,6 +3867,14 @@ "once": "^1.4.0" } }, + "node_modules/ensure-error": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ensure-error/-/ensure-error-2.1.0.tgz", + "integrity": "sha512-+BMSJHw9gxiJAAp2ZR1E0TNcL09dD3lOvkl7WVm4+Y6xnes/pMetP/TzCHiDduh8ihNDjbGfuYxl7l4PA1xZ8A==", + "engines": { + "node": ">=8" + } + }, "node_modules/entities": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", @@ -5266,6 +5323,11 @@ "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", "dev": true }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" + }, "node_modules/lodash.memoize": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", diff --git a/package.json b/package.json index 5a642c8..c8742db 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "custom-electron-titlebar": "^4.2.7", "discord-auto-rpc": "^1.0.17", "electron-serve": "^1.1.0", + "electron-unhandled": "^4.0.1", "fkill": "^7.2.1", "get-window-by-name": "^2.0.0", "regedit-rs": "^1.0.2", -- 2.34.1 From 0b679d320fb4dfae07e0d4dcd98b8bac3f0816ec Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Thu, 25 Jan 2024 14:19:35 +0100 Subject: [PATCH 2/2] remove console logging --- src/App.svelte | 1 - src/pages/Login.svelte | 1 - 2 files changed, 2 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 67d7185..614df61 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -83,7 +83,6 @@ }); window.addEventListener("alert", (e) => { - console.log((e as CustomEvent).detail); const toastMessage = (e as CustomEvent).detail; switch (toastMessage.type) { case "success": { diff --git a/src/pages/Login.svelte b/src/pages/Login.svelte index 00c5cf7..002dcd1 100644 --- a/src/pages/Login.svelte +++ b/src/pages/Login.svelte @@ -80,7 +80,6 @@ const resultData = customEvent.detail; const isGuest = "guest" in resultData; const wasSuccessful = "user" in resultData; - console.log(resultData); if (isGuest) { currentPage.set(Page.Launch); res(); -- 2.34.1