Add auto-launch and bunch of other things

This commit is contained in:
smartfrigde 2022-05-14 21:02:09 +02:00
parent 6663b6de5f
commit 5893f5bea9
8 changed files with 101 additions and 105 deletions

143
package-lock.json generated
View file

@ -10,13 +10,12 @@
"hasInstallScript": true, "hasInstallScript": true,
"license": "OSL-3.0", "license": "OSL-3.0",
"dependencies": { "dependencies": {
"easy-auto-launch": "^6.0.2",
"electron-context-menu": "https://github.com/ArmCord/electron-context-menu.git", "electron-context-menu": "https://github.com/ArmCord/electron-context-menu.git",
"electron-editor-context-menu": "^1.1.1",
"v8-compile-cache": "^2.3.0", "v8-compile-cache": "^2.3.0",
"ws": "^8.6.0" "ws": "^8.6.0"
}, },
"devDependencies": { "devDependencies": {
"@types/electron-json-storage": "^4.5.0",
"@types/node": "^17.0.33", "@types/node": "^17.0.33",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
@ -232,12 +231,6 @@
"@types/ms": "*" "@types/ms": "*"
} }
}, },
"node_modules/@types/electron-json-storage": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@types/electron-json-storage/-/electron-json-storage-4.5.0.tgz",
"integrity": "sha512-wzDtkJHEENo4yLARfPjdYD6Foa7IORXFiNYLacZ6lJThkrGUWh5vlSSMu925ov5zv8tQHtajn2O7BpHcBtqU3g==",
"dev": true
},
"node_modules/@types/fs-extra": { "node_modules/@types/fs-extra": {
"version": "9.0.13", "version": "9.0.13",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
@ -485,6 +478,11 @@
"node": ">= 10.0.0" "node": ">= 10.0.0"
} }
}, },
"node_modules/applescript": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/applescript/-/applescript-1.0.0.tgz",
"integrity": "sha1-u4evVoytA0pOSMS9r2Bno6JwExc="
},
"node_modules/argparse": { "node_modules/argparse": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@ -1311,6 +1309,20 @@
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
"dev": true "dev": true
}, },
"node_modules/easy-auto-launch": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/easy-auto-launch/-/easy-auto-launch-6.0.2.tgz",
"integrity": "sha512-UhrWpPlPB2YKQXU+hw2kIfQzVecDnYsLUiFdLkKv3eCUtxmCcfEcAjxk8P6RMc8IjCoW8N9ALpJh5n0R1h/z1A==",
"dependencies": {
"applescript": "^1.0.0",
"mkdirp": "^1.0.4",
"untildify": "^4.0.0",
"winreg": "^1.2.4"
},
"engines": {
"node": ">=4.0.0"
}
},
"node_modules/ejs": { "node_modules/ejs": {
"version": "3.1.8", "version": "3.1.8",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz",
@ -1459,18 +1471,6 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/electron-editor-context-menu": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/electron-editor-context-menu/-/electron-editor-context-menu-1.1.1.tgz",
"integrity": "sha1-3DAJjg37N/YmKOQzAxJMfzN5Vy0=",
"dependencies": {
"lodash.clonedeep": "^4.3.0",
"lodash.defaults": "^4.0.1",
"lodash.isarray": "^4.0.0",
"lodash.isempty": "^4.1.2",
"lodash.isfunction": "^3.0.8"
}
},
"node_modules/electron-is-dev": { "node_modules/electron-is-dev": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz", "resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz",
@ -2359,32 +2359,6 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true "dev": true
}, },
"node_modules/lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8="
},
"node_modules/lodash.defaults": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
"integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw="
},
"node_modules/lodash.isarray": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-4.0.0.tgz",
"integrity": "sha1-KspJayjEym1yZxUxNZDALm6jRAM=",
"deprecated": "This package is deprecated. Use Array.isArray."
},
"node_modules/lodash.isempty": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz",
"integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4="
},
"node_modules/lodash.isfunction": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz",
"integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw=="
},
"node_modules/lowercase-keys": { "node_modules/lowercase-keys": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
@ -2497,7 +2471,6 @@
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"dev": true,
"bin": { "bin": {
"mkdirp": "bin/cmd.js" "mkdirp": "bin/cmd.js"
}, },
@ -3302,7 +3275,6 @@
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
"integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==",
"dev": true,
"engines": { "engines": {
"node": ">=8" "node": ">=8"
} }
@ -3467,6 +3439,11 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/winreg": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.4.tgz",
"integrity": "sha1-ugZWKbepJRMOFXeRCM9UCZDpjRs="
},
"node_modules/wrap-ansi": { "node_modules/wrap-ansi": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
@ -3757,12 +3734,6 @@
"@types/ms": "*" "@types/ms": "*"
} }
}, },
"@types/electron-json-storage": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/@types/electron-json-storage/-/electron-json-storage-4.5.0.tgz",
"integrity": "sha512-wzDtkJHEENo4yLARfPjdYD6Foa7IORXFiNYLacZ6lJThkrGUWh5vlSSMu925ov5zv8tQHtajn2O7BpHcBtqU3g==",
"dev": true
},
"@types/fs-extra": { "@types/fs-extra": {
"version": "9.0.13", "version": "9.0.13",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz",
@ -3977,6 +3948,11 @@
} }
} }
}, },
"applescript": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/applescript/-/applescript-1.0.0.tgz",
"integrity": "sha1-u4evVoytA0pOSMS9r2Bno6JwExc="
},
"argparse": { "argparse": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@ -4614,6 +4590,17 @@
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=",
"dev": true "dev": true
}, },
"easy-auto-launch": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/easy-auto-launch/-/easy-auto-launch-6.0.2.tgz",
"integrity": "sha512-UhrWpPlPB2YKQXU+hw2kIfQzVecDnYsLUiFdLkKv3eCUtxmCcfEcAjxk8P6RMc8IjCoW8N9ALpJh5n0R1h/z1A==",
"requires": {
"applescript": "^1.0.0",
"mkdirp": "^1.0.4",
"untildify": "^4.0.0",
"winreg": "^1.2.4"
}
},
"ejs": { "ejs": {
"version": "3.1.8", "version": "3.1.8",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz",
@ -4731,18 +4718,6 @@
"unused-filename": "^2.1.0" "unused-filename": "^2.1.0"
} }
}, },
"electron-editor-context-menu": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/electron-editor-context-menu/-/electron-editor-context-menu-1.1.1.tgz",
"integrity": "sha1-3DAJjg37N/YmKOQzAxJMfzN5Vy0=",
"requires": {
"lodash.clonedeep": "^4.3.0",
"lodash.defaults": "^4.0.1",
"lodash.isarray": "^4.0.0",
"lodash.isempty": "^4.1.2",
"lodash.isfunction": "^3.0.8"
}
},
"electron-is-dev": { "electron-is-dev": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz", "resolved": "https://registry.npmjs.org/electron-is-dev/-/electron-is-dev-2.0.0.tgz",
@ -5428,31 +5403,6 @@
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
"dev": true "dev": true
}, },
"lodash.clonedeep": {
"version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8="
},
"lodash.defaults": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz",
"integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw="
},
"lodash.isarray": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-4.0.0.tgz",
"integrity": "sha1-KspJayjEym1yZxUxNZDALm6jRAM="
},
"lodash.isempty": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.isempty/-/lodash.isempty-4.4.0.tgz",
"integrity": "sha1-b4bL7di+TsmHvpqvM8loTbGzHn4="
},
"lodash.isfunction": {
"version": "3.0.9",
"resolved": "https://registry.npmjs.org/lodash.isfunction/-/lodash.isfunction-3.0.9.tgz",
"integrity": "sha512-AirXNj15uRIMMPihnkInB4i3NHeb4iBtNg9WRWuK2o31S+ePwwNmDPaTL3o7dTJ+VXNZim7rFs4rxN4YU1oUJw=="
},
"lowercase-keys": { "lowercase-keys": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
@ -5531,8 +5481,7 @@
"mkdirp": { "mkdirp": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
"dev": true
}, },
"modify-filename": { "modify-filename": {
"version": "1.1.0", "version": "1.1.0",
@ -6167,8 +6116,7 @@
"untildify": { "untildify": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz", "resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
"integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw=="
"dev": true
}, },
"unused-filename": { "unused-filename": {
"version": "2.1.0", "version": "2.1.0",
@ -6301,6 +6249,11 @@
"string-width": "^4.0.0" "string-width": "^4.0.0"
} }
}, },
"winreg": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/winreg/-/winreg-1.2.4.tgz",
"integrity": "sha1-ugZWKbepJRMOFXeRCM9UCZDpjRs="
},
"wrap-ansi": { "wrap-ansi": {
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",

View file

@ -33,6 +33,7 @@
"typescript": "^4.6.3" "typescript": "^4.6.3"
}, },
"dependencies": { "dependencies": {
"easy-auto-launch": "^6.0.2",
"electron-context-menu": "https://github.com/ArmCord/electron-context-menu.git", "electron-context-menu": "https://github.com/ArmCord/electron-context-menu.git",
"v8-compile-cache": "^2.3.0", "v8-compile-cache": "^2.3.0",
"ws": "^8.6.0" "ws": "^8.6.0"

View file

@ -96,6 +96,7 @@
windowStyle: "default", windowStyle: "default",
channel: "stable", channel: "stable",
armcordCSP: true, armcordCSP: true,
autoLaunch: true,
minimizeToTray: true, minimizeToTray: true,
automaticPatches: false, automaticPatches: false,
mods: "cumcord", mods: "cumcord",
@ -126,6 +127,7 @@
windowStyle: "default", windowStyle: "default",
channel: options.channel, channel: options.channel,
armcordCSP: true, armcordCSP: true,
autoLaunch: true,
minimizeToTray: true, minimizeToTray: true,
automaticPatches: false, automaticPatches: false,
mods: options.mod, mods: options.mod,
@ -141,6 +143,7 @@
armcordCSP: true, armcordCSP: true,
minimizeToTray: true, minimizeToTray: true,
automaticPatches: false, automaticPatches: false,
autoLaunch: true,
mods: "none", mods: "none",
inviteWebsocket: true, inviteWebsocket: true,
blurType: "acrylic" blurType: "acrylic"

View file

@ -7,6 +7,7 @@ import "./extensions/plugin";
import "./tray"; import "./tray";
import {createCustomWindow, createNativeWindow, createTabsHost} from "./window"; import {createCustomWindow, createNativeWindow, createTabsHost} from "./window";
import "./shortcuts"; import "./shortcuts";
import AutoLaunch from "easy-auto-launch";
export var settings: any; export var settings: any;
export var customTitlebar: boolean; export var customTitlebar: boolean;
@ -25,7 +26,17 @@ if (process.platform == "linux") {
} }
checkIfConfigExists(); checkIfConfigExists();
var AutoLauncher = new AutoLaunch({
name: 'ArmCord',
path: '/Applications/ArmCord.app',
});
app.whenReady().then(async () => { app.whenReady().then(async () => {
if (await getConfig("autoLaunch") == "true") {
AutoLauncher.enable()
} else {
AutoLauncher.disable()
}
switch (await getConfig("windowStyle")) { switch (await getConfig("windowStyle")) {
case "default": case "default":
createCustomWindow(); createCustomWindow();

View file

@ -15,7 +15,7 @@ export function createSettingsWindow() {
} else { } else {
settingsWindow = new BrowserWindow({ settingsWindow = new BrowserWindow({
width: 500, width: 500,
height: 500, height: 555,
title: "ArmCord Settings", title: "ArmCord Settings",
darkTheme: true, darkTheme: true,
frame: true, frame: true,

View file

@ -40,6 +40,12 @@
<input class="tgl tgl-light left" id="websocket" type="checkbox" /> <input class="tgl tgl-light left" id="websocket" type="checkbox" />
<label class="tgl-btn left" for="websocket"></label> <label class="tgl-btn left" for="websocket"></label>
</div> </div>
<br />
<div class="switch">
<label class="header">Auto launch</label>
<input class="tgl tgl-light left" id="autolaunch" type="checkbox" />
<label class="tgl-btn left" for="autolaunch"></label>
</div>
<div class="switch"> <div class="switch">
<select name="channel" id="channel" class="left"> <select name="channel" id="channel" class="left">
<option value="stable">Stable</option> <option value="stable">Stable</option>
@ -71,6 +77,7 @@
document.getElementById("mod").value = await settings.get("mods"); document.getElementById("mod").value = await settings.get("mods");
document.getElementById("channel").value = await settings.get("channel"); document.getElementById("channel").value = await settings.get("channel");
document.getElementById("theme").value = await settings.get("windowStyle"); document.getElementById("theme").value = await settings.get("windowStyle");
document.getElementById("autolaunch").checked = await settings.get("autoLaunch");
} }
loadSettings(); loadSettings();
document.getElementById("save").addEventListener("click", function () { document.getElementById("save").addEventListener("click", function () {
@ -83,6 +90,7 @@
automaticPatches: document.getElementById("patches").checked, automaticPatches: document.getElementById("patches").checked,
mods: document.getElementById("mod").value, mods: document.getElementById("mod").value,
blurType: "acrylic", blurType: "acrylic",
autoLaunch: document.getElementById("autolaunch").checked,
inviteWebsocket: document.getElementById("websocket").checked, inviteWebsocket: document.getElementById("websocket").checked,
doneSetup: true doneSetup: true
}); });

View file

@ -2,6 +2,7 @@ import * as fs from "fs";
import {app, dialog} from "electron"; import {app, dialog} from "electron";
import path from "path"; import path from "path";
export var firstRun: boolean; export var firstRun: boolean;
export var isSetup: boolean;
export var contentPath: string; export var contentPath: string;
//utillity functions that are used all over the codebase or just too obscure to be put in the file used in //utillity functions that are used all over the codebase or just too obscure to be put in the file used in
export function addStyle(styleString: string) { export function addStyle(styleString: string) {
@ -21,7 +22,7 @@ export async function sleep(ms: number) {
} }
export async function checkIfConfigIsBroken() { export async function checkIfConfigIsBroken() {
if (await getConfig("0") == "d") { if ((await getConfig("0")) == "d") {
console.log("Detected a corrupted config"); console.log("Detected a corrupted config");
setup(); setup();
dialog.showErrorBox( dialog.showErrorBox(
@ -39,6 +40,7 @@ export function setup() {
armcordCSP: true, armcordCSP: true,
minimizeToTray: true, minimizeToTray: true,
automaticPatches: false, automaticPatches: false,
autoLaunch: true,
mods: "cumcord", mods: "cumcord",
blurType: "acrylic", blurType: "acrylic",
inviteWebsocket: true, inviteWebsocket: true,
@ -71,6 +73,7 @@ export interface Settings {
armcordCSP: boolean; armcordCSP: boolean;
minimizeToTray: boolean; minimizeToTray: boolean;
automaticPatches: boolean; automaticPatches: boolean;
autoLaunch: boolean;
mods: string; mods: string;
blurType: string; blurType: string;
inviteWebsocket: boolean; inviteWebsocket: boolean;
@ -132,15 +135,26 @@ export async function checkIfConfigExists() {
} }
console.log("First run of the ArmCord. Starting setup."); console.log("First run of the ArmCord. Starting setup.");
setup(); setup();
isSetup = true;
contentPath = path.join(__dirname, "/content/setup.html"); contentPath = path.join(__dirname, "/content/setup.html");
if (!contentPath.includes("ts-out")) { if (!contentPath.includes("ts-out")) {
contentPath = path.join(__dirname, "/ts-out/content/setup.html"); contentPath = path.join(__dirname, "/ts-out/content/setup.html");
} }
} else { } else {
console.log("ArmCord has been run before. Skipping setup."); if (await getConfig("doneSetup") == false) {
contentPath = path.join(__dirname, "/content/splash.html"); console.log("First run of the ArmCord. Starting setup.");
if (!contentPath.includes("ts-out")) { setup();
contentPath = path.join(__dirname, "/ts-out/content/splash.html"); isSetup = true;
contentPath = path.join(__dirname, "/content/setup.html");
if (!contentPath.includes("ts-out")) {
contentPath = path.join(__dirname, "/ts-out/content/setup.html");
}
} else {
console.log("ArmCord has been run before. Skipping setup.");
contentPath = path.join(__dirname, "/content/splash.html");
if (!contentPath.includes("ts-out")) {
contentPath = path.join(__dirname, "/ts-out/content/splash.html");
}
} }
} }
} }

View file

@ -4,7 +4,7 @@
// I'm sorry for this mess but I'm not sure how to fix it. // I'm sorry for this mess but I'm not sure how to fix it.
import {BrowserWindow, shell, app, ipcMain, dialog, clipboard} from "electron"; import {BrowserWindow, shell, app, ipcMain, dialog, clipboard} from "electron";
import path from "path"; import path from "path";
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath} from "./utils"; import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup} from "./utils";
import {registerIpc} from "./ipc"; import {registerIpc} from "./ipc";
import startServer from "./socket" import startServer from "./socket"
import contextMenu from "electron-context-menu"; import contextMenu from "electron-context-menu";
@ -46,8 +46,12 @@ async function doAfterDefiningTheWindow() {
if (await getConfig("inviteWebsocket") == true) { if (await getConfig("inviteWebsocket") == true) {
startServer() startServer()
} }
try { try {
mainWindow.loadFile(contentPath); mainWindow.loadFile(contentPath);
if (isSetup) {
mainWindow.setSize(390, 470);
}
} catch (e) { } catch (e) {
console.log( console.log(
"Major error detected while starting up. User is most likely on Windows platform. Fallback to alternative startup." "Major error detected while starting up. User is most likely on Windows platform. Fallback to alternative startup."
@ -55,12 +59,14 @@ async function doAfterDefiningTheWindow() {
console.log(process.platform); console.log(process.platform);
if (process.platform === "win32") { if (process.platform === "win32") {
if (firstRun) { if (firstRun) {
mainWindow.setSize(390, 470);
mainWindow.loadURL(`file://${__dirname}/content/setup.html`); mainWindow.loadURL(`file://${__dirname}/content/setup.html`);
} else { } else {
mainWindow.loadURL(`file://${__dirname}/content/splash.html`); mainWindow.loadURL(`file://${__dirname}/content/splash.html`);
} }
} else { } else {
if (firstRun) { if (firstRun) {
mainWindow.setSize(390, 470);
mainWindow.loadURL(`file://${__dirname}/ts-out/content/setup.html`); mainWindow.loadURL(`file://${__dirname}/ts-out/content/setup.html`);
} else { } else {
mainWindow.loadURL(`file://${__dirname}/ts-out/content/splash.html`); mainWindow.loadURL(`file://${__dirname}/ts-out/content/splash.html`);
@ -70,8 +76,8 @@ async function doAfterDefiningTheWindow() {
} }
export function createCustomWindow() { export function createCustomWindow() {
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
width: 390, width: 300,
height: 470, height: 350,
title: "ArmCord", title: "ArmCord",
darkTheme: true, darkTheme: true,
icon: path.join(__dirname, "/assets/icon_transparent.png"), icon: path.join(__dirname, "/assets/icon_transparent.png"),