2019-10-25 19:51:40 -04:00
|
|
|
import * as electron from "electron";
|
|
|
|
import * as crash_handler from "./modules/crash_handler";
|
2019-10-27 17:39:59 -04:00
|
|
|
import * as child_process from "child_process";
|
|
|
|
import {app} from "electron";
|
2020-10-01 04:56:22 -04:00
|
|
|
//import * as Sentry from "@sentry/electron";
|
2020-08-22 15:33:30 -04:00
|
|
|
|
|
|
|
/*
|
|
|
|
Sentry.init({
|
|
|
|
dsn: "https://72b9f40ce6894b179154e7558f1aeb87@o437344.ingest.sentry.io/5399791",
|
|
|
|
appName: "TeaSpeak - Client",
|
|
|
|
release: "TeaClient@" + electron.app.getVersion()
|
|
|
|
});
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* just swallow this... */
|
|
|
|
process.on('uncaughtException', err => {
|
|
|
|
console.error('Uncaught Exception thrown: %o', err);
|
|
|
|
electron.app.whenReady().then(() => {
|
|
|
|
electron.dialog.showMessageBox({
|
|
|
|
type: "error",
|
|
|
|
message: "An uncaught exception has reached the stack root.\nClosing application.",
|
|
|
|
title: "Caught an uncaught exception"
|
|
|
|
}).then(() => {
|
|
|
|
process.exit(1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2019-10-25 19:51:40 -04:00
|
|
|
|
2020-12-02 12:52:59 -05:00
|
|
|
/* We've to do this since we're removing all the bloat locales */
|
|
|
|
app.commandLine.appendSwitch('lang', 'en-US');
|
|
|
|
|
2019-10-25 19:51:40 -04:00
|
|
|
const is_electron_run = process.argv[0].endsWith("electron") || process.argv[0].endsWith("electron.exe");
|
|
|
|
const process_arguments = is_electron_run ? process.argv.slice(2) : process.argv.slice(1);
|
|
|
|
if(process_arguments.length > 0 && process_arguments[0] === "crash-handler") {
|
|
|
|
/* crash handler callback */
|
|
|
|
crash_handler.handle_crash_callback(process_arguments.slice(1));
|
2019-10-27 17:39:59 -04:00
|
|
|
} else if(process_arguments.length > 0 && process_arguments[0] === "dtest") {
|
|
|
|
console.log("Executing installer");
|
|
|
|
try {
|
|
|
|
let pipe = child_process.spawn("\"C:\\Program Files (x86)\\TeaSpeak\\update-installer.exe\"", [], {
|
|
|
|
detached: true,
|
|
|
|
shell: true,
|
|
|
|
cwd: "C:\\Program Files (x86)\\TeaSpeak",
|
|
|
|
stdio: "ignore"
|
|
|
|
});
|
|
|
|
} catch(error) {
|
|
|
|
console.dir(error);
|
|
|
|
}
|
|
|
|
|
|
|
|
setTimeout(() => app.exit(0), 2000);
|
2019-10-25 19:51:40 -04:00
|
|
|
} else {
|
2020-12-02 12:08:49 -05:00
|
|
|
if(process_arguments.length > 0 && process_arguments[0] == "--main-crash-handler") {
|
2019-10-25 19:51:40 -04:00
|
|
|
crash_handler.initialize_handler("main", is_electron_run);
|
2020-12-02 12:08:49 -05:00
|
|
|
}
|
2019-10-27 18:31:40 -04:00
|
|
|
|
2019-10-25 19:51:40 -04:00
|
|
|
/* app execute */
|
|
|
|
{
|
|
|
|
const versions = process.versions;
|
|
|
|
console.log("Versions:");
|
|
|
|
console.log(" TeaSpeak Client: " + electron.app.getVersion());
|
|
|
|
|
|
|
|
for (const key of Object.keys(versions))
|
|
|
|
console.log(" %s: %s", key, versions[key]);
|
|
|
|
}
|
|
|
|
|
|
|
|
const tea_client = require("./modules/core/main.js");
|
|
|
|
tea_client.execute();
|
2020-08-22 15:33:30 -04:00
|
|
|
}
|