From 0f0e3de9353c06dfaabc00682b4c2fd9c5f48924 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Wed, 14 Jul 2021 01:12:14 +0200 Subject: Kartik Fox Nest! --- crash/wrapper.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'crash') diff --git a/crash/wrapper.js b/crash/wrapper.js index ba5a8b9..16ecfd9 100644 --- a/crash/wrapper.js +++ b/crash/wrapper.js @@ -1,8 +1,6 @@ const { app, BrowserWindow } = require('electron') -if (require('fs').existsSync(require('os').userInfo().homedir + "/.kartik/config/lang.txt")) { - lp = require('fs').readFileSync(require('os').userInfo().homedir + "/.kartik/config/lang.txt").toString(); -} +lp = "en"; function createWindow () { const win = new BrowserWindow({ -- cgit From 44210691ee8444509ac466a362337af77f2bcd49 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Tue, 20 Jul 2021 01:30:23 +0200 Subject: Commit --- crash/client.js | 164 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 95 insertions(+), 69 deletions(-) (limited to 'crash') diff --git a/crash/client.js b/crash/client.js index e70467f..95cc342 100644 --- a/crash/client.js +++ b/crash/client.js @@ -1,8 +1,40 @@ +taglines = [ + "Who set us up the engine?", + "Everything's going as planned. No, really, that was supposed to happen.", + "Uh... Did I do that? (oops)", + "Oops.", + "Why did you do that?", + "I feel sad now :(", + "My bad.", + "I'm sorry, Dave. I'm afraid I can't do that.", + "I let you down. Sorry :(", + "On the bright side, I bought you a teddy bear!", + "Oh - I know what I did wrong!", + "Hey, that tickles! Hehehe!", + "I blame Microsoft.", + "Don't be sad. I'll do better next time, pinky swear!", + "Don't be sad, have a hug! <3", + "I just don't know what went wrong :(", + "Shall we play a game?", + "Quite honestly, I wouldn't worry myself about that.", + "Sorry :(", + "Surprise! Haha. Well, this is awkward.", + "Would you like a cupcake?", + "Hi. I'm Kartik, and I'm a crashaholic.", + "Ooh. Shiny.", + "This doesn't make any sense!", + "Why is it breaking :(", + "Don't do that.", + "Ouch. That hurt :(", + "You're mean.", + "But it works on my machine.", + "Welp, I guess it's broken now.", + "¯\\_(ツ)_/¯", + "*boop*" +] + if (native) { function crash(error) { - try { - require('@electron/remote').getCurrentWindow().hide(); - } catch (e) {} id = new Date().toISOString().replaceAll(":", "-"); try { @@ -13,72 +45,79 @@ if (native) { } - report = "\n"; - report += "Kartik Crash Report\n\nPlease send this to the developers so they can fix the problem and deploy a patch to all players.\n\nStack Trace:\n" - error.stack.split("\n").forEach((line) => { - report += " " + line + "\n"; - }) - report += "\n\nSystem Information:\n" - report += " " + "Kartik"+require('@electron/remote').getCurrentWindow().channel + "(" + pkg.name + ") " +pkg.version + " [" + pkg.serial + "]\n"; + try { + pubver = require('../package.json').version; + } catch (e) { + pubver = require('./package.json').version; + } + pvpart = pubver.split("."); + if (pvpart.length === 3) { + intver = pvpart[0] + "." + pvpart[1]; + } else { + intver = "unknown"; + } - report += " " + require('os').type() + " (" + require('os').version() + ", " + require('os').arch() +") version " + require('os').release() + "\n"; - cores = require('os').cpus() - if (cores.length > 1) { - report += " " + cores.length + " processors"; + if (require('@electron/remote').getCurrentWindow().mods.length > 0) { + release = "mods+" + require('@electron/remote').getCurrentWindow().mods.length; } else { - report += " " + cores.length + " processor"; + release = "official"; } - report += "\n\nKartik Components:\n"; - Object.keys(process.versions).forEach((e) => { - v = process.versions[e]; - report += " " + e + "@" + v + "\n"; + report = "---- Kartik Crash Report ----\n"; + report += "// " + taglines[Math.floor(Math.random() * taglines.length)] + "\n\n" + + report += "Time: " + new Date().toUTCString() + "\n\n"; + error.stack.split("\n").forEach((line) => { + report += line + "\n"; }) - require('fs').writeFileSync(require('os').userInfo().homedir + "/.kartik/crashes/" + id + ".txt", report); - if (error.message !== "Invalid display" && error.message !== "Out of memory") { + report += "\n\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n" + + "---------------------------------------------------------------------------------------\n\n"; - fetch("https://kartik.hopto.org/telemetry/report/?report=" + btoa(report.replaceAll(require('os').userInfo().username, ""))) + report += "-- Head --\nThread: Renderer #" + process.pid + "\n\n" - .then(() => { - if (require('os').platform() === "win32") { - require('child_process').execSync("runtime\\kartik-crash.bat"); - } else if (require('os').platform() === "darwin") { - require('child_process').execSync("./runtime/kartik-crash-mac.sh"); - } else { - require('child_process').execSync("./runtime/kartik-crash.sh"); - } - require('@electron/remote').getCurrentWindow().destroy(); + report += "-- Initialization --\nDetails: " + require('@electron/remote').getCurrentWindow().cmdlineargs.join(" ") + "\n\n" - window.close(); - require('@electron/remote').getCurrentWindow().close(); - }) - .catch(() => { - if (require('os').platform() === "win32") { - require('child_process').execSync("runtime\\kartik-crash.bat"); - } else if (require('os').platform() === "darwin") { + report += "-- System Details --\nDetails: \n"; - require('child_process').execSync("./runtime/kartik-crash-mac.sh"); - } else { - require('child_process').execSync("./runtime/kartik-crash.sh"); - } - require('@electron/remote').getCurrentWindow().destroy(); - window.close(); - require('@electron/remote').getCurrentWindow().close(); - }) - } else { - if (require('os').platform() === "win32") { - require('child_process').execSync("runtime\\kartik-crash.bat"); - } else if (require('os').platform() === "darwin") { - require('child_process').execSync("./runtime/kartik-crash-mac.sh"); + report += " Kartik Version: " + pkg.version + "\n"; + try { + channel = require('../package.json').channel; + } catch (e) { + channel = require('./package.json').channel; + } + report += " Kartik Version ID: " + intver + "/" + channel + "+" + release + "\n"; + report += " Kartik Version SKU: " + pkg.serial + "\n"; + report += " Operating System: " + require('os').type() + " (" + require('os').arch() + ") version " + require('os').release() + "\n"; + report += " Electron Version: " + process.versions.electron + "\n"; + report += " Electron VM Version: " + process.versions.v8 + "\n"; + report += " Node Version: " + process.versions.node + "\n"; + report += " Memory: " + process.memoryUsage().heapUsed + " bytes (" + Math.round(process.memoryUsage().heapUsed / 1000000) + " MB) / " + process.memoryUsage().heapTotal + " bytes (" + Math.round(process.memoryUsage().heapTotal / 1000000) + " MB) up to " + process.memoryUsage().rss + " bytes (" + Math.round(process.memoryUsage().rss / 1000000) + " MB)\n"; + report += " CPUs: " + require('os').cpus().length + "\n"; + if (require('@electron/remote').getCurrentWindow().mods.length > 0) { + report += " KMP Mods:\n"; + for (mod of require('@electron/remote').getCurrentWindow().mods) { + report += " " + mod + "\n"; + } + } + report += " Is Modded: "; + if (require('@electron/remote').getCurrentWindow().mods.length > 0) { + report += "Definitely; Client brand changed to 'kmp-client'" + } else if (require('@electron/remote').getCurrentWindow().invalidfiles.length > 0) { + if (require('@electron/remote').getCurrentWindow().invalidfiles.length > 1) { + report += "Very likely; " + require('@electron/remote').getCurrentWindow().invalidfiles.length + " signatures invalidated"; } else { - require('child_process').execSync("./runtime/kartik-crash.sh"); + report += "Very likely; " + require('@electron/remote').getCurrentWindow().invalidfiles.length + " signature invalidated"; } - - require('@electron/remote').getCurrentWindow().destroy(); - window.close(); - require('@electron/remote').getCurrentWindow().close(); + } else { + report += "Probably not. All signatures remains and client brand is untouched."; } + report += "\n"; + report += " CPU: " + require('os').cpus().length + "x " + require('os').cpus()[0].model.trim() + "\n"; + + require('fs').copyFileSync(homedir + "/.kartik/current.kfn", homedir + "/.kartik/crashed.kfn"); + require('fs').writeFileSync(require('os').userInfo().homedir + "/.kartik/crashes/" + id + ".txt", report); + require('@electron/remote').getCurrentWindow().webContents.send("crashreport", report); } window.onerror = (_a, _b, _c, _d, error) => { @@ -98,17 +137,4 @@ if (native) { crash(new Error("Unknown error")); } }) - - /*setInterval(() => { - try { - if (document.body.clientWidth >= (screen.width - 50) || document.body.clientHeight >= (screen.height - 50) || require('@electron/remote').getCurrentWindow().pwidth >= (screen.width - 50) || require('@electron/remote').getCurrentWindow().pheight >= (screen.height - 50) || require('@electron/remote').getCurrentWindow().scale < 0.9) { - - if (!location.href.includes("credits.html")) { - error("CrashManager", "Invalid display, crashing"); - crash(new Error("Invalid display")); - // TODO: Instead reset the size and restart - } - } - } catch (e) {} - }, 2000)*/ } -- cgit From d5a620cf09b835db2bccd99556525c90b458719f Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 5 Aug 2021 17:21:23 +0200 Subject: i18n for 21.08 --- crash/client.js | 280 +++++++++++++++++++++++++++---------------------------- crash/crash.html | 144 ++++++++++++++-------------- crash/wrapper.js | 76 +++++++-------- 3 files changed, 250 insertions(+), 250 deletions(-) (limited to 'crash') diff --git a/crash/client.js b/crash/client.js index 95cc342..2323d18 100644 --- a/crash/client.js +++ b/crash/client.js @@ -1,140 +1,140 @@ -taglines = [ - "Who set us up the engine?", - "Everything's going as planned. No, really, that was supposed to happen.", - "Uh... Did I do that? (oops)", - "Oops.", - "Why did you do that?", - "I feel sad now :(", - "My bad.", - "I'm sorry, Dave. I'm afraid I can't do that.", - "I let you down. Sorry :(", - "On the bright side, I bought you a teddy bear!", - "Oh - I know what I did wrong!", - "Hey, that tickles! Hehehe!", - "I blame Microsoft.", - "Don't be sad. I'll do better next time, pinky swear!", - "Don't be sad, have a hug! <3", - "I just don't know what went wrong :(", - "Shall we play a game?", - "Quite honestly, I wouldn't worry myself about that.", - "Sorry :(", - "Surprise! Haha. Well, this is awkward.", - "Would you like a cupcake?", - "Hi. I'm Kartik, and I'm a crashaholic.", - "Ooh. Shiny.", - "This doesn't make any sense!", - "Why is it breaking :(", - "Don't do that.", - "Ouch. That hurt :(", - "You're mean.", - "But it works on my machine.", - "Welp, I guess it's broken now.", - "¯\\_(ツ)_/¯", - "*boop*" -] - -if (native) { - function crash(error) { - id = new Date().toISOString().replaceAll(":", "-"); - - try { - global.pkg = require('./package.json'); - } catch (e) { - console.warn(e); - global.pkg = require('../package.json'); - - } - - try { - pubver = require('../package.json').version; - } catch (e) { - pubver = require('./package.json').version; - } - pvpart = pubver.split("."); - if (pvpart.length === 3) { - intver = pvpart[0] + "." + pvpart[1]; - } else { - intver = "unknown"; - } - - if (require('@electron/remote').getCurrentWindow().mods.length > 0) { - release = "mods+" + require('@electron/remote').getCurrentWindow().mods.length; - } else { - release = "official"; - } - - report = "---- Kartik Crash Report ----\n"; - report += "// " + taglines[Math.floor(Math.random() * taglines.length)] + "\n\n" - - report += "Time: " + new Date().toUTCString() + "\n\n"; - error.stack.split("\n").forEach((line) => { - report += line + "\n"; - }) - - report += "\n\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n" + - "---------------------------------------------------------------------------------------\n\n"; - - report += "-- Head --\nThread: Renderer #" + process.pid + "\n\n" - - report += "-- Initialization --\nDetails: " + require('@electron/remote').getCurrentWindow().cmdlineargs.join(" ") + "\n\n" - - report += "-- System Details --\nDetails: \n"; - - report += " Kartik Version: " + pkg.version + "\n"; - try { - channel = require('../package.json').channel; - } catch (e) { - channel = require('./package.json').channel; - } - report += " Kartik Version ID: " + intver + "/" + channel + "+" + release + "\n"; - report += " Kartik Version SKU: " + pkg.serial + "\n"; - report += " Operating System: " + require('os').type() + " (" + require('os').arch() + ") version " + require('os').release() + "\n"; - report += " Electron Version: " + process.versions.electron + "\n"; - report += " Electron VM Version: " + process.versions.v8 + "\n"; - report += " Node Version: " + process.versions.node + "\n"; - report += " Memory: " + process.memoryUsage().heapUsed + " bytes (" + Math.round(process.memoryUsage().heapUsed / 1000000) + " MB) / " + process.memoryUsage().heapTotal + " bytes (" + Math.round(process.memoryUsage().heapTotal / 1000000) + " MB) up to " + process.memoryUsage().rss + " bytes (" + Math.round(process.memoryUsage().rss / 1000000) + " MB)\n"; - report += " CPUs: " + require('os').cpus().length + "\n"; - if (require('@electron/remote').getCurrentWindow().mods.length > 0) { - report += " KMP Mods:\n"; - for (mod of require('@electron/remote').getCurrentWindow().mods) { - report += " " + mod + "\n"; - } - } - report += " Is Modded: "; - if (require('@electron/remote').getCurrentWindow().mods.length > 0) { - report += "Definitely; Client brand changed to 'kmp-client'" - } else if (require('@electron/remote').getCurrentWindow().invalidfiles.length > 0) { - if (require('@electron/remote').getCurrentWindow().invalidfiles.length > 1) { - report += "Very likely; " + require('@electron/remote').getCurrentWindow().invalidfiles.length + " signatures invalidated"; - } else { - report += "Very likely; " + require('@electron/remote').getCurrentWindow().invalidfiles.length + " signature invalidated"; - } - } else { - report += "Probably not. All signatures remains and client brand is untouched."; - } - report += "\n"; - report += " CPU: " + require('os').cpus().length + "x " + require('os').cpus()[0].model.trim() + "\n"; - - require('fs').copyFileSync(homedir + "/.kartik/current.kfn", homedir + "/.kartik/crashed.kfn"); - require('fs').writeFileSync(require('os').userInfo().homedir + "/.kartik/crashes/" + id + ".txt", report); - require('@electron/remote').getCurrentWindow().webContents.send("crashreport", report); - } - - window.onerror = (_a, _b, _c, _d, error) => { - if (typeof error != "undefined") { - crash(error); - } else { - error("CrashManager", "An exception was thrown without details about it"); - crash(new Error("Unknown error")); - } - } - - process.on('uncaughtException', (error) => { - if (typeof error != "undefined") { - crash(error); - } else { - error("CrashManager", "An exception was thrown without details about it"); - crash(new Error("Unknown error")); - } - }) -} +taglines = [ + "Who set us up the engine?", + "Everything's going as planned. No, really, that was supposed to happen.", + "Uh... Did I do that? (oops)", + "Oops.", + "Why did you do that?", + "I feel sad now :(", + "My bad.", + "I'm sorry, Dave. I'm afraid I can't do that.", + "I let you down. Sorry :(", + "On the bright side, I bought you a teddy bear!", + "Oh - I know what I did wrong!", + "Hey, that tickles! Hehehe!", + "I blame Microsoft.", + "Don't be sad. I'll do better next time, pinky swear!", + "Don't be sad, have a hug! <3", + "I just don't know what went wrong :(", + "Shall we play a game?", + "Quite honestly, I wouldn't worry myself about that.", + "Sorry :(", + "Surprise! Haha. Well, this is awkward.", + "Would you like a cupcake?", + "Hi. I'm Kartik, and I'm a crashaholic.", + "Ooh. Shiny.", + "This doesn't make any sense!", + "Why is it breaking :(", + "Don't do that.", + "Ouch. That hurt :(", + "You're mean.", + "But it works on my machine.", + "Welp, I guess it's broken now.", + "¯\\_(ツ)_/¯", + "*boop*" +] + +if (native) { + function crash(error) { + id = new Date().toISOString().replaceAll(":", "-"); + + try { + global.pkg = require('./package.json'); + } catch (e) { + console.warn(e); + global.pkg = require('../package.json'); + + } + + try { + pubver = require('../package.json').version; + } catch (e) { + pubver = require('./package.json').version; + } + pvpart = pubver.split("."); + if (pvpart.length === 3) { + intver = pvpart[0] + "." + pvpart[1]; + } else { + intver = "unknown"; + } + + if (require('@electron/remote').getCurrentWindow().mods.length > 0) { + release = "mods+" + require('@electron/remote').getCurrentWindow().mods.length; + } else { + release = "official"; + } + + report = "---- Kartik Crash Report ----\n"; + report += "// " + taglines[Math.floor(Math.random() * taglines.length)] + "\n\n" + + report += "Time: " + new Date().toUTCString() + "\n\n"; + error.stack.split("\n").forEach((line) => { + report += line + "\n"; + }) + + report += "\n\n\nA detailed walkthrough of the error, its code path and all known details is as follows:\n" + + "---------------------------------------------------------------------------------------\n\n"; + + report += "-- Head --\nThread: Renderer #" + process.pid + "\n\n" + + report += "-- Initialization --\nDetails: " + require('@electron/remote').getCurrentWindow().cmdlineargs.join(" ") + "\n\n" + + report += "-- System Details --\nDetails: \n"; + + report += " Kartik Version: " + pkg.version + "\n"; + try { + channel = require('../package.json').channel; + } catch (e) { + channel = require('./package.json').channel; + } + report += " Kartik Version ID: " + intver + "/" + channel + "+" + release + "\n"; + report += " Kartik Version SKU: " + pkg.serial + "\n"; + report += " Operating System: " + require('os').type() + " (" + require('os').arch() + ") version " + require('os').release() + "\n"; + report += " Electron Version: " + process.versions.electron + "\n"; + report += " Electron VM Version: " + process.versions.v8 + "\n"; + report += " Node Version: " + process.versions.node + "\n"; + report += " Memory: " + process.memoryUsage().heapUsed + " bytes (" + Math.round(process.memoryUsage().heapUsed / 1000000) + " MB) / " + process.memoryUsage().heapTotal + " bytes (" + Math.round(process.memoryUsage().heapTotal / 1000000) + " MB) up to " + process.memoryUsage().rss + " bytes (" + Math.round(process.memoryUsage().rss / 1000000) + " MB)\n"; + report += " CPUs: " + require('os').cpus().length + "\n"; + if (require('@electron/remote').getCurrentWindow().mods.length > 0) { + report += " KMP Mods:\n"; + for (mod of require('@electron/remote').getCurrentWindow().mods) { + report += " " + mod + "\n"; + } + } + report += " Is Modded: "; + if (require('@electron/remote').getCurrentWindow().mods.length > 0) { + report += "Definitely; Client brand changed to 'kmp-client'" + } else if (require('@electron/remote').getCurrentWindow().invalidfiles.length > 0) { + if (require('@electron/remote').getCurrentWindow().invalidfiles.length > 1) { + report += "Very likely; " + require('@electron/remote').getCurrentWindow().invalidfiles.length + " signatures invalidated"; + } else { + report += "Very likely; " + require('@electron/remote').getCurrentWindow().invalidfiles.length + " signature invalidated"; + } + } else { + report += "Probably not. All signatures remains and client brand is untouched."; + } + report += "\n"; + report += " CPU: " + require('os').cpus().length + "x " + require('os').cpus()[0].model.trim() + "\n"; + + require('fs').copyFileSync(homedir + "/.kartik/current.kfn", homedir + "/.kartik/crashed.kfn"); + require('fs').writeFileSync(require('os').userInfo().homedir + "/.kartik/crashes/" + id + ".txt", report); + require('@electron/remote').getCurrentWindow().webContents.send("crashreport", report); + } + + window.onerror = (_a, _b, _c, _d, error) => { + if (typeof error != "undefined") { + crash(error); + } else { + error("CrashManager", "An exception was thrown without details about it"); + crash(new Error("Unknown error")); + } + } + + process.on('uncaughtException', (error) => { + if (typeof error != "undefined") { + crash(error); + } else { + error("CrashManager", "An exception was thrown without details about it"); + crash(new Error("Unknown error")); + } + }) +} diff --git a/crash/crash.html b/crash/crash.html index ec4e5ca..c698dcd 100644 --- a/crash/crash.html +++ b/crash/crash.html @@ -1,72 +1,72 @@ - - - - - - - - - - -
- -
-
-

-

-

-

-
- - - - + + + + + + + + + + +
+ +
+
+

+

+

+

+
+ + + + diff --git a/crash/wrapper.js b/crash/wrapper.js index 16ecfd9..4c291bd 100644 --- a/crash/wrapper.js +++ b/crash/wrapper.js @@ -1,39 +1,39 @@ -const { app, BrowserWindow } = require('electron') - -lp = "en"; - -function createWindow () { - const win = new BrowserWindow({ - width: 800, - height: 375, - resizeable: false, - resizable: false, - maximizable: false, - bgColor: "#ffffff", - title: "Kartik", - webPreferences: { - nodeIntegration: true, - contextIsolation: false, - enableRemoteModule: true, - webviewTag: true - } - }) - - win.lp = lp; - win.loadFile('crash.html') - win.setMenu(null); -} - -app.whenReady().then(createWindow) - -app.on('window-all-closed', () => { - if (process.platform !== 'darwin') { - app.quit() - } -}) - -app.on('activate', () => { - if (BrowserWindow.getAllWindows().length === 0) { - createWindow() - } +const { app, BrowserWindow } = require('electron') + +lp = "en"; + +function createWindow () { + const win = new BrowserWindow({ + width: 800, + height: 375, + resizeable: false, + resizable: false, + maximizable: false, + bgColor: "#ffffff", + title: "Kartik", + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + enableRemoteModule: true, + webviewTag: true + } + }) + + win.lp = lp; + win.loadFile('crash.html') + win.setMenu(null); +} + +app.whenReady().then(createWindow) + +app.on('window-all-closed', () => { + if (process.platform !== 'darwin') { + app.quit() + } +}) + +app.on('activate', () => { + if (BrowserWindow.getAllWindows().length === 0) { + createWindow() + } }) \ No newline at end of file -- cgit