mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Add a way to set config in cli
This commit is contained in:
parent
66821e2dce
commit
08c4cb0a63
4 changed files with 408 additions and 375 deletions
|
@ -7,7 +7,7 @@
|
|||
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css src/**/**/*.js ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/**/** ts-out/",
|
||||
"watch": "tsc -w",
|
||||
"start": "npm run build && electron ./ts-out/main.js",
|
||||
"startNoSandbox": "npm run build && electron ./ts-out/main.js --no-sandbox",
|
||||
"startWayland": "npm run build && electron ./ts-out/main.js --ozone-platform-hint=auto --enable-features=WebRTCPipeWireCapturer",
|
||||
"package": "npm run build && electron-builder",
|
||||
"packageQuick": "npm run build && electron-builder --dir",
|
||||
"format": "prettier --write src *.json",
|
||||
|
@ -29,7 +29,7 @@
|
|||
"@types/ws": "^8.5.3",
|
||||
"chalk-cli": "^5.0.0",
|
||||
"copyfiles": "^2.4.1",
|
||||
"electron": "^22.0.0",
|
||||
"electron": "^24.1.2",
|
||||
"electron-builder": "^23.6.0",
|
||||
"prettier": "^2.7.1",
|
||||
"typescript": "^4.9.3"
|
||||
|
|
753
pnpm-lock.yaml
753
pnpm-lock.yaml
File diff suppressed because it is too large
Load diff
17
src/main.ts
17
src/main.ts
|
@ -6,6 +6,7 @@ import {
|
|||
getConfig,
|
||||
checkIfConfigExists,
|
||||
injectElectronFlags,
|
||||
setConfig,
|
||||
installModLoader,
|
||||
getConfigLocation
|
||||
} from "./utils";
|
||||
|
@ -18,7 +19,21 @@ export var iconPath: string;
|
|||
export var settings: any;
|
||||
export var customTitlebar: boolean;
|
||||
export var clientName: "ArmCord";
|
||||
|
||||
async function args() {
|
||||
var argNum = 2;
|
||||
if (process.argv[0] == "electron") argNum++;
|
||||
var args = process.argv[argNum];
|
||||
if (args == undefined) return;
|
||||
if (args.startsWith("--")) return; //electron flag
|
||||
if (args.includes("=")) {
|
||||
var e = args.split("=");
|
||||
await setConfig(e[0], e[1]);
|
||||
console.log("Setting " + e[0] + " to " + e[1]);
|
||||
app.relaunch();
|
||||
app.exit();
|
||||
}
|
||||
}
|
||||
args(); // i want my top level awaits
|
||||
if (!app.requestSingleInstanceLock()) {
|
||||
// kill if 2nd instance
|
||||
app.quit();
|
||||
|
|
|
@ -77,7 +77,7 @@ async function doAfterDefiningTheWindow() {
|
|||
if (osType == "Windows_NT") {
|
||||
osType = "Windows " + os.release().split(".")[0] + " (" + os.release() + ")";
|
||||
}
|
||||
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36`; //fake useragent for screenshare to work
|
||||
mainWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36`; //fake useragent for screenshare to work
|
||||
}
|
||||
app.on("second-instance", (event, commandLine, workingDirectory, additionalData) => {
|
||||
// Print out data received from the second instance.
|
||||
|
@ -94,7 +94,12 @@ async function doAfterDefiningTheWindow() {
|
|||
// Allow about:blank (used by Vencord QuickCss popup)
|
||||
if (url === "about:blank") return {action: "allow"};
|
||||
// Allow Discord stream popout
|
||||
if ((url === "https://discord.com/popout") || (url === "https://canary.discord.com/popout") || (url === "https://ptb.discord.com/popout")) return {action: "allow"};
|
||||
if (
|
||||
url === "https://discord.com/popout" ||
|
||||
url === "https://canary.discord.com/popout" ||
|
||||
url === "https://ptb.discord.com/popout"
|
||||
)
|
||||
return {action: "allow"};
|
||||
if (url.startsWith("https:") || url.startsWith("http:") || url.startsWith("mailto:")) {
|
||||
shell.openExternal(url);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue