parent
18bebfb421
commit
87920505db
|
@ -0,0 +1 @@
|
||||||
|
_
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
. "$(dirname $0)/_/husky.sh"
|
||||||
|
|
||||||
|
npm run format
|
||||||
|
git add -A
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Some prettier-specific files so it doesn't die.
|
||||||
|
**/*.png
|
||||||
|
**/*.ico
|
||||||
|
LICENSE
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
node_modules
|
||||||
|
out/
|
||||||
|
dist
|
||||||
|
ts-out/
|
||||||
|
ts-out
|
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "ArmCord",
|
"name": "ArmCord",
|
||||||
"version": "3.0.4",
|
"version": "3.1.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ArmCord",
|
"name": "ArmCord",
|
||||||
"version": "3.0.4",
|
"version": "3.1.0",
|
||||||
|
"hasInstallScript": true,
|
||||||
"license": "OSL-3.0",
|
"license": "OSL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"electron-context-menu": "^3.1.2",
|
"electron-context-menu": "^3.1.2",
|
||||||
|
@ -21,6 +22,8 @@
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"electron": "^17.1.0",
|
"electron": "^17.1.0",
|
||||||
"electron-builder": "^22.14.13",
|
"electron-builder": "^22.14.13",
|
||||||
|
"husky": "^7.0.4",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
"typescript": "^4.5.4"
|
"typescript": "^4.5.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -2020,6 +2023,21 @@
|
||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/husky": {
|
||||||
|
"version": "7.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz",
|
||||||
|
"integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"husky": "lib/bin.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/typicode"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/iconv-corefoundation": {
|
"node_modules/iconv-corefoundation": {
|
||||||
"version": "1.1.7",
|
"version": "1.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz",
|
||||||
|
@ -2724,6 +2742,18 @@
|
||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/prettier": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"prettier": "bin-prettier.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/process-nextick-args": {
|
"node_modules/process-nextick-args": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
|
@ -5191,6 +5221,12 @@
|
||||||
"debug": "4"
|
"debug": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"husky": {
|
||||||
|
"version": "7.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/husky/-/husky-7.0.4.tgz",
|
||||||
|
"integrity": "sha512-vbaCKN2QLtP/vD4yvs6iz6hBEo6wkSzs8HpRah1Z6aGmF2KW5PdYuAd7uX5a+OyBZHBhd+TFLqgjUgytQr4RvQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"iconv-corefoundation": {
|
"iconv-corefoundation": {
|
||||||
"version": "1.1.7",
|
"version": "1.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz",
|
||||||
|
@ -5728,6 +5764,12 @@
|
||||||
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
|
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"prettier": {
|
||||||
|
"version": "2.5.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz",
|
||||||
|
"integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"process-nextick-args": {
|
"process-nextick-args": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/** ts-out/",
|
"build": "tsc && copyfiles -u 1 src/**/*.html src/**/**/*.css ts-out/ && copyfiles package.json ts-out/ && copyfiles assets/** ts-out/",
|
||||||
"watch": "tsc -w",
|
"watch": "tsc -w",
|
||||||
"start": "npm run build && electron ./ts-out/main.js",
|
"start": "npm run build && electron ./ts-out/main.js",
|
||||||
"package": "npm run build && electron-builder"
|
"package": "npm run build && electron-builder",
|
||||||
|
"format": "prettier --write **/*",
|
||||||
|
"postinstall": "husky install"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -25,6 +27,8 @@
|
||||||
"copyfiles": "^2.4.1",
|
"copyfiles": "^2.4.1",
|
||||||
"electron": "^17.1.0",
|
"electron": "^17.1.0",
|
||||||
"electron-builder": "^22.14.13",
|
"electron-builder": "^22.14.13",
|
||||||
|
"husky": "^7.0.4",
|
||||||
|
"prettier": "^2.5.1",
|
||||||
"typescript": "^4.5.4"
|
"typescript": "^4.5.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
module.exports = {
|
||||||
|
printWidth: 120,
|
||||||
|
tabWidth: 4,
|
||||||
|
useTabs: false,
|
||||||
|
semi: true,
|
||||||
|
singleQuote: false,
|
||||||
|
quoteProps: "as-needed",
|
||||||
|
jsxSingleQuote: false,
|
||||||
|
trailingComma: "none",
|
||||||
|
bracketSpacing: false,
|
||||||
|
jsxBracketSameLine: false,
|
||||||
|
arrowParens: "always",
|
||||||
|
endOfLine: "auto"
|
||||||
|
};
|
|
@ -2,10 +2,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<link
|
<link rel="stylesheet" href="https://cdn.metroui.org.ua/v4/css/metro-all.min.css" />
|
||||||
rel="stylesheet"
|
|
||||||
href="https://cdn.metroui.org.ua/v4/css/metro-all.min.css"
|
|
||||||
/>
|
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>ArmCord Setup</title>
|
<title>ArmCord Setup</title>
|
||||||
<style>
|
<style>
|
||||||
|
@ -23,7 +20,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function fade(element) {
|
function fade(element) {
|
||||||
var op = 1; // initial opacity
|
var op = 1; // initial opacity
|
||||||
var timer = setInterval(function () {
|
var timer = setInterval(function () {
|
||||||
|
@ -51,12 +47,12 @@
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
mods: "cumcord",
|
mods: "cumcord",
|
||||||
blurType: "acrylic"
|
blurType: "acrylic"
|
||||||
})
|
});
|
||||||
fade(document.getElementById("setup"));
|
fade(document.getElementById("setup"));
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
window.armcordinternal.restart()
|
window.armcordinternal.restart();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
})
|
});
|
||||||
document.getElementById("full").addEventListener("click", function () {
|
document.getElementById("full").addEventListener("click", function () {
|
||||||
document.getElementById("setup").innerHTML = `
|
document.getElementById("setup").innerHTML = `
|
||||||
<p class="text-center setup-ask">Choose your Discord channel/instance:</p>
|
<p class="text-center setup-ask">Choose your Discord channel/instance:</p>
|
||||||
|
@ -77,9 +73,7 @@
|
||||||
</div>
|
</div>
|
||||||
<button id="next" class="center">Next</button>
|
<button id="next" class="center">Next</button>
|
||||||
`;
|
`;
|
||||||
document
|
document.getElementById("next").addEventListener("click", function () {
|
||||||
.getElementById("next")
|
|
||||||
.addEventListener("click", function () {
|
|
||||||
var branch = document.getElementById("channel").value;
|
var branch = document.getElementById("channel").value;
|
||||||
var csp = document.getElementById("csp").value;
|
var csp = document.getElementById("csp").value;
|
||||||
if (csp === "true") {
|
if (csp === "true") {
|
||||||
|
@ -95,9 +89,7 @@
|
||||||
<p>Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our documentation ;)</p>
|
<p>Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our documentation ;)</p>
|
||||||
<button id="next" class="center">Next</button>
|
<button id="next" class="center">Next</button>
|
||||||
`;
|
`;
|
||||||
document
|
document.getElementById("next").addEventListener("click", function () {
|
||||||
.getElementById("next")
|
|
||||||
.addEventListener("click", function () {
|
|
||||||
var mod = document.getElementById("mod").value;
|
var mod = document.getElementById("mod").value;
|
||||||
window.armcordinternal.saveSettings({
|
window.armcordinternal.saveSettings({
|
||||||
windowStyle: "default",
|
windowStyle: "default",
|
||||||
|
@ -107,7 +99,7 @@
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
mods: mod,
|
mods: mod,
|
||||||
blurType: "acrylic"
|
blurType: "acrylic"
|
||||||
})
|
});
|
||||||
fade(document.getElementById("setup"));
|
fade(document.getElementById("setup"));
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
window.armcordinternal.restart();
|
window.armcordinternal.restart();
|
||||||
|
@ -122,10 +114,10 @@
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
mods: "none",
|
mods: "none",
|
||||||
blurType: "acrylic"
|
blurType: "acrylic"
|
||||||
})
|
});
|
||||||
fade(document.getElementById("setup"));
|
fade(document.getElementById("setup"));
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
window.armcordinternal.restart()
|
window.armcordinternal.restart();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,10 +11,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<video autoplay loop class="logo" id="splashscreen-armcord">
|
<video autoplay loop class="logo" id="splashscreen-armcord">
|
||||||
<source
|
<source src="https://armcord.smartfridge.space/discord_loading.webm" type="video/webm" />
|
||||||
src="https://armcord.smartfridge.space/discord_loading.webm"
|
|
||||||
type="video/webm"
|
|
||||||
/>
|
|
||||||
</video>
|
</video>
|
||||||
<p id="text-splashscreen"></p>
|
<p id="text-splashscreen"></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,8 +19,7 @@
|
||||||
<script>
|
<script>
|
||||||
const text = document.getElementById("text-splashscreen");
|
const text = document.getElementById("text-splashscreen");
|
||||||
if (window.navigator.onLine === false) {
|
if (window.navigator.onLine === false) {
|
||||||
text.innerHTML =
|
text.innerHTML = "You appear to be offline. Please connect to the internet and try again.";
|
||||||
"You appear to be offline. Please connect to the internet and try again.";
|
|
||||||
} else {
|
} else {
|
||||||
text.innerHTML = "Starting ArmCord...";
|
text.innerHTML = "Starting ArmCord...";
|
||||||
fetch("https://armcord.smartfridge.space/latest.json")
|
fetch("https://armcord.smartfridge.space/latest.json")
|
||||||
|
@ -35,10 +31,9 @@
|
||||||
elem.src = "https://armcord.smartfridge.space/update.webp";
|
elem.src = "https://armcord.smartfridge.space/update.webp";
|
||||||
document.body.prepend(elem);
|
document.body.prepend(elem);
|
||||||
document.getElementById("splashscreen-armcord").remove();
|
document.getElementById("splashscreen-armcord").remove();
|
||||||
text.innerHTML =
|
text.innerHTML = "A new version of ArmCord is available. Please update to the latest version.";
|
||||||
"A new version of ArmCord is available. Please update to the latest version.";
|
|
||||||
} else {
|
} else {
|
||||||
console.log("ArmCord is up to date.")
|
console.log("ArmCord is up to date.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
|
@ -12,8 +12,8 @@ import electron from "electron";
|
||||||
import * as storage from "electron-json-storage";
|
import * as storage from "electron-json-storage";
|
||||||
const otherMods = {
|
const otherMods = {
|
||||||
generic: {
|
generic: {
|
||||||
electronProxy: require("util").types.isProxy(electron), // Many modern mods overwrite electron with a proxy with a custom BrowserWindow (copied from PowerCord)
|
electronProxy: require("util").types.isProxy(electron) // Many modern mods overwrite electron with a proxy with a custom BrowserWindow (copied from PowerCord)
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const unstrictCSP = () => {
|
const unstrictCSP = () => {
|
||||||
|
@ -27,11 +27,10 @@ const unstrictCSP = () => {
|
||||||
"https://api.goosemod.com/inject.js",
|
"https://api.goosemod.com/inject.js",
|
||||||
"https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js",
|
"https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js",
|
||||||
"https://raw.githubusercontent.com/Cumcord/Cumcord/master/dist/build.js",
|
"https://raw.githubusercontent.com/Cumcord/Cumcord/master/dist/build.js",
|
||||||
"https://raw.githubusercontent.com/FlickerMod/dist/main/build.js",
|
"https://raw.githubusercontent.com/FlickerMod/dist/main/build.js"
|
||||||
];
|
];
|
||||||
|
|
||||||
electron.session.defaultSession.webRequest.onHeadersReceived(
|
electron.session.defaultSession.webRequest.onHeadersReceived(({responseHeaders, url}, done) => {
|
||||||
({ responseHeaders, url }, done) => {
|
|
||||||
let csp = responseHeaders!["content-security-policy"];
|
let csp = responseHeaders!["content-security-policy"];
|
||||||
|
|
||||||
if (otherMods.generic.electronProxy) {
|
if (otherMods.generic.electronProxy) {
|
||||||
|
@ -54,16 +53,13 @@ const unstrictCSP = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
done({responseHeaders});
|
done({responseHeaders});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
};
|
};
|
||||||
storage.get("settings", function (error, data: any) {
|
storage.get("settings", function (error, data: any) {
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
if (data.armcordCSP) {
|
if (data.armcordCSP) {
|
||||||
unstrictCSP();
|
unstrictCSP();
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log("ArmCord CSP is disabled. The CSP should be managed by third-party plugin.");
|
||||||
"ArmCord CSP is disabled. The CSP should be managed by third-party plugin."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from "fs";
|
||||||
import { app, session } from 'electron';
|
import {app, session} from "electron";
|
||||||
const userDataPath = app.getPath("userData");
|
const userDataPath = app.getPath("userData");
|
||||||
const pluginFolder = userDataPath + "/plugins/";
|
const pluginFolder = userDataPath + "/plugins/";
|
||||||
if (!fs.existsSync(pluginFolder)) {
|
if (!fs.existsSync(pluginFolder)) {
|
||||||
|
@ -9,16 +9,10 @@ if (!fs.existsSync(pluginFolder)) {
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
fs.readdirSync(pluginFolder).forEach((file) => {
|
fs.readdirSync(pluginFolder).forEach((file) => {
|
||||||
try {
|
try {
|
||||||
const manifest = fs.readFileSync(
|
const manifest = fs.readFileSync(`${userDataPath}/plugins/${file}/manifest.json`, "utf8");
|
||||||
`${userDataPath}/plugins/${file}/manifest.json`,
|
|
||||||
"utf8"
|
|
||||||
);
|
|
||||||
var pluginFile = JSON.parse(manifest);
|
var pluginFile = JSON.parse(manifest);
|
||||||
session.defaultSession.loadExtension(`${userDataPath}/plugins/${file}`);
|
session.defaultSession.loadExtension(`${userDataPath}/plugins/${file}`);
|
||||||
console.log(
|
console.log(`%cLoaded ${pluginFile.name} made by ${pluginFile.author}`, "color:red");
|
||||||
`%cLoaded ${pluginFile.name} made by ${pluginFile.author}`,
|
|
||||||
"color:red"
|
|
||||||
);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,5 @@ export function registerIpc() {
|
||||||
event.returnValue = false;
|
event.returnValue = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ipcMain.handle("DESKTOP_CAPTURER_GET_SOURCES", (event, opts) =>
|
ipcMain.handle("DESKTOP_CAPTURER_GET_SOURCES", (event, opts) => desktopCapturer.getSources(opts));
|
||||||
desktopCapturer.getSources(opts)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
12
src/main.ts
12
src/main.ts
|
@ -1,9 +1,5 @@
|
||||||
// Modules to control application life and create native browser window
|
// Modules to control application life and create native browser window
|
||||||
import {
|
import {app, BrowserWindow, session} from "electron";
|
||||||
app,
|
|
||||||
BrowserWindow,
|
|
||||||
session,
|
|
||||||
} from "electron";
|
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import "v8-compile-cache";
|
import "v8-compile-cache";
|
||||||
import * as storage from "electron-json-storage";
|
import * as storage from "electron-json-storage";
|
||||||
|
@ -19,7 +15,7 @@ export var settings: any;
|
||||||
export var customTitlebar: boolean;
|
export var customTitlebar: boolean;
|
||||||
export var tabs: boolean;
|
export var tabs: boolean;
|
||||||
async function appendSwitch() {
|
async function appendSwitch() {
|
||||||
if (await getConfigUnsafe("windowStyle") == "glasstron") {
|
if ((await getConfigUnsafe("windowStyle")) == "glasstron") {
|
||||||
console.log("Enabling transparency visuals.");
|
console.log("Enabling transparency visuals.");
|
||||||
app.commandLine.appendSwitch("enable-transparent-visuals");
|
app.commandLine.appendSwitch("enable-transparent-visuals");
|
||||||
}
|
}
|
||||||
|
@ -78,9 +74,7 @@ app.whenReady().then(async () => {
|
||||||
customTitlebar = true;
|
customTitlebar = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
session
|
session.fromPartition("some-partition").setPermissionRequestHandler((webContents, permission, callback) => {
|
||||||
.fromPartition("some-partition")
|
|
||||||
.setPermissionRequestHandler((webContents, permission, callback) => {
|
|
||||||
if (permission === "notifications") {
|
if (permission === "notifications") {
|
||||||
// Approves the permissions request
|
// Approves the permissions request
|
||||||
callback(true);
|
callback(true);
|
||||||
|
|
|
@ -7,27 +7,24 @@ contextBridge.exposeInMainWorld("armcord", {
|
||||||
show: () => ipcRenderer.send("win-show"),
|
show: () => ipcRenderer.send("win-show"),
|
||||||
hide: () => ipcRenderer.send("win-hide"),
|
hide: () => ipcRenderer.send("win-hide"),
|
||||||
minimize: () => ipcRenderer.send("win-minimize"),
|
minimize: () => ipcRenderer.send("win-minimize"),
|
||||||
maximize: () => ipcRenderer.send("win-maximize"),
|
maximize: () => ipcRenderer.send("win-maximize")
|
||||||
},
|
},
|
||||||
titlebar: {
|
titlebar: {
|
||||||
injectTitlebar: () => injectTitlebar(),
|
injectTitlebar: () => injectTitlebar(),
|
||||||
isTitlebar: ipcRenderer.sendSync("titlebar"),
|
isTitlebar: ipcRenderer.sendSync("titlebar")
|
||||||
},
|
},
|
||||||
electron: process.versions.electron,
|
electron: process.versions.electron,
|
||||||
channel: ipcRenderer.sendSync("channel"),
|
channel: ipcRenderer.sendSync("channel"),
|
||||||
openTab: (number: number) => ipcRenderer.sendSync("openTab", number),
|
openTab: (number: number) => ipcRenderer.sendSync("openTab", number),
|
||||||
version: ipcRenderer.sendSync("get-app-version", "app-version"),
|
version: ipcRenderer.sendSync("get-app-version", "app-version"),
|
||||||
getDisplayMediaSelector: getDisplayMediaSelector,
|
getDisplayMediaSelector: getDisplayMediaSelector,
|
||||||
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow"),
|
openSettingsWindow: () => ipcRenderer.send("openSettingsWindow")
|
||||||
});
|
});
|
||||||
//to be only used inside armcord internal setup/splash etc
|
//to be only used inside armcord internal setup/splash etc
|
||||||
if (
|
if (window.location.href.indexOf("splash.html") > -1 || window.location.href.indexOf("setup.html") > -1) {
|
||||||
window.location.href.indexOf("splash.html") > -1 ||
|
|
||||||
window.location.href.indexOf("setup.html") > -1
|
|
||||||
) {
|
|
||||||
contextBridge.exposeInMainWorld("armcordinternal", {
|
contextBridge.exposeInMainWorld("armcordinternal", {
|
||||||
restart: () => ipcRenderer.send("restart"),
|
restart: () => ipcRenderer.send("restart"),
|
||||||
saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args),
|
saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args),
|
||||||
splashEnd: () => ipcRenderer.send("splashEnd"),
|
splashEnd: () => ipcRenderer.send("splashEnd")
|
||||||
});
|
});
|
||||||
}
|
}
|
|
@ -1,12 +1,11 @@
|
||||||
//Fixed context isolation version https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.ts
|
//Fixed context isolation version https://github.com/getferdi/ferdi/blob/develop/src/webview/screenshare.ts
|
||||||
//original https://github.com/electron/electron/issues/16513#issuecomment-602070250
|
//original https://github.com/electron/electron/issues/16513#issuecomment-602070250
|
||||||
import { ipcRenderer } from 'electron';
|
import {ipcRenderer} from "electron";
|
||||||
import {addStyle, addScript} from '../utils';
|
import {addStyle, addScript} from "../utils";
|
||||||
const desktopCapturer = {
|
const desktopCapturer = {
|
||||||
getSources: (opts: any) =>
|
getSources: (opts: any) => ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES", opts)
|
||||||
ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES", opts),
|
|
||||||
};
|
};
|
||||||
const CANCEL_ID = 'desktop-capturer-selection__cancel';
|
const CANCEL_ID = "desktop-capturer-selection__cancel";
|
||||||
|
|
||||||
interface IPCSources {
|
interface IPCSources {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -16,7 +15,7 @@ interface IPCSources {
|
||||||
|
|
||||||
export async function getDisplayMediaSelector() {
|
export async function getDisplayMediaSelector() {
|
||||||
const sources: IPCSources[] = await desktopCapturer.getSources({
|
const sources: IPCSources[] = await desktopCapturer.getSources({
|
||||||
types: ['screen', 'window'],
|
types: ["screen", "window"]
|
||||||
});
|
});
|
||||||
return `<div class="desktop-capturer-selection__scroller">
|
return `<div class="desktop-capturer-selection__scroller">
|
||||||
<ul class="desktop-capturer-selection__list">
|
<ul class="desktop-capturer-selection__list">
|
||||||
|
@ -29,9 +28,9 @@ export async function getDisplayMediaSelector() {
|
||||||
<span class="desktop-capturer-selection__name">${name}</span>
|
<span class="desktop-capturer-selection__name">${name}</span>
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
`,
|
`
|
||||||
)
|
)
|
||||||
.join('')}
|
.join("")}
|
||||||
<li class="desktop-capturer-selection__item">
|
<li class="desktop-capturer-selection__item">
|
||||||
<button class="desktop-capturer-selection__btn" data-id="${CANCEL_ID}" title="Cancel">
|
<button class="desktop-capturer-selection__btn" data-id="${CANCEL_ID}" title="Cancel">
|
||||||
<span class="desktop-capturer-selection__name desktop-capturer-selection__name--cancel">Cancel</span>
|
<span class="desktop-capturer-selection__name desktop-capturer-selection__name--cancel">Cancel</span>
|
||||||
|
@ -157,6 +156,5 @@ window.navigator.mediaDevices.getDisplayMedia = () => new Promise(async (resolve
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
addScript(screenShareJS);
|
addScript(screenShareJS);
|
||||||
addStyle(screenShareCSS);
|
addStyle(screenShareCSS);
|
||||||
console.log("Capturer injected.")
|
console.log("Capturer injected.");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ if (ipcRenderer.sendSync("shouldPatch")) {
|
||||||
console.log("Found a patch. Injecting...");
|
console.log("Found a patch. Injecting...");
|
||||||
injectJS(patchEndpoint + version + "/patch.js");
|
injectJS(patchEndpoint + version + "/patch.js");
|
||||||
} else {
|
} else {
|
||||||
console.log("No patches have been found.")
|
console.log("No patches have been found.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import "./bridge";
|
import "./bridge";
|
||||||
import "./capturer";
|
import "./capturer";
|
||||||
import "./patch"
|
import "./patch";
|
||||||
import * as fs from "fs";
|
import * as fs from "fs";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import {injectTitlebar} from "./titlebar";
|
import {injectTitlebar} from "./titlebar";
|
||||||
|
@ -14,9 +14,8 @@ declare global {
|
||||||
}
|
}
|
||||||
const clientMods = {
|
const clientMods = {
|
||||||
goosemod: "https://api.goosemod.com/inject.js",
|
goosemod: "https://api.goosemod.com/inject.js",
|
||||||
cumcord:
|
cumcord: "https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js",
|
||||||
"https://raw.githubusercontent.com/Cumcord/Cumcord/stable/dist/build.js",
|
flicker: "https://raw.githubusercontent.com/FlickerMod/dist/main/build.js"
|
||||||
flicker: "https://raw.githubusercontent.com/FlickerMod/dist/main/build.js",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("ArmCord");
|
console.log("ArmCord");
|
||||||
|
|
|
@ -22,4 +22,5 @@ export function injectTabs() {
|
||||||
}
|
}
|
||||||
const cssPath = path.join(__dirname, "../", "/content/css/tabs.css");
|
const cssPath = path.join(__dirname, "../", "/content/css/tabs.css");
|
||||||
addStyle(fs.readFileSync(cssPath, "utf8"));
|
addStyle(fs.readFileSync(cssPath, "utf8"));
|
||||||
})}
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ export function createSettingsWindow() {
|
||||||
frame: true,
|
frame: true,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, "preload.js"),
|
preload: path.join(__dirname, "preload.js")
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
ipcMain.on("saveSettings", (event, args: Settings) => {
|
ipcMain.on("saveSettings", (event, args: Settings) => {
|
||||||
console.log(args);
|
console.log(args);
|
||||||
|
@ -38,8 +38,8 @@ export function createSettingsWindow() {
|
||||||
});
|
});
|
||||||
settingsWindow.loadURL(`file://${__dirname}/settings.html`);
|
settingsWindow.loadURL(`file://${__dirname}/settings.html`);
|
||||||
settingsWindow.on("close", async (e) => {
|
settingsWindow.on("close", async (e) => {
|
||||||
e.preventDefault()
|
e.preventDefault();
|
||||||
settingsWindow.hide()
|
settingsWindow.hide();
|
||||||
});
|
});
|
||||||
isAlreadyCreated = true;
|
isAlreadyCreated = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import {contextBridge, ipcRenderer} from "electron";
|
import {contextBridge, ipcRenderer} from "electron";
|
||||||
console.log("ArmCord Settings")
|
console.log("ArmCord Settings");
|
||||||
contextBridge.exposeInMainWorld("settings", {
|
contextBridge.exposeInMainWorld("settings", {
|
||||||
save: (...args: any) => ipcRenderer.send("saveSettings", ...args),
|
save: (...args: any) => ipcRenderer.send("saveSettings", ...args),
|
||||||
get: (toGet: string) => ipcRenderer.invoke('getSetting', toGet).then((result) => {return result}) //jank but works
|
get: (toGet: string) =>
|
||||||
|
ipcRenderer.invoke("getSetting", toGet).then((result) => {
|
||||||
|
return result;
|
||||||
|
}) //jank but works
|
||||||
});
|
});
|
|
@ -87,13 +87,31 @@ button:hover {
|
||||||
.tgl {
|
.tgl {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.tgl, .tgl:after, .tgl:before, .tgl *, .tgl *:after, .tgl *:before, .tgl + .tgl-btn {
|
.tgl,
|
||||||
|
.tgl:after,
|
||||||
|
.tgl:before,
|
||||||
|
.tgl *,
|
||||||
|
.tgl *:after,
|
||||||
|
.tgl *:before,
|
||||||
|
.tgl + .tgl-btn {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
.tgl::-moz-selection, .tgl:after::-moz-selection, .tgl:before::-moz-selection, .tgl *::-moz-selection, .tgl *:after::-moz-selection, .tgl *:before::-moz-selection, .tgl + .tgl-btn::-moz-selection {
|
.tgl::-moz-selection,
|
||||||
|
.tgl:after::-moz-selection,
|
||||||
|
.tgl:before::-moz-selection,
|
||||||
|
.tgl *::-moz-selection,
|
||||||
|
.tgl *:after::-moz-selection,
|
||||||
|
.tgl *:before::-moz-selection,
|
||||||
|
.tgl + .tgl-btn::-moz-selection {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
.tgl::selection, .tgl:after::selection, .tgl:before::selection, .tgl *::selection, .tgl *:after::selection, .tgl *:before::selection, .tgl + .tgl-btn::selection {
|
.tgl::selection,
|
||||||
|
.tgl:after::selection,
|
||||||
|
.tgl:before::selection,
|
||||||
|
.tgl *::selection,
|
||||||
|
.tgl *:after::selection,
|
||||||
|
.tgl *:before::selection,
|
||||||
|
.tgl + .tgl-btn::selection {
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
.tgl + .tgl-btn {
|
.tgl + .tgl-btn {
|
||||||
|
@ -108,7 +126,8 @@ button:hover {
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
.tgl + .tgl-btn:after, .tgl + .tgl-btn:before {
|
.tgl + .tgl-btn:after,
|
||||||
|
.tgl + .tgl-btn:before {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
content: "";
|
content: "";
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<title>ArmCord Settings</title>
|
<title>ArmCord Settings</title>
|
||||||
|
@ -10,7 +9,6 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div class="switch">
|
<div class="switch">
|
||||||
<select name="theme" id="theme" class="left">
|
<select name="theme" id="theme" class="left">
|
||||||
<option value="default">Default</option>
|
<option value="default">Default</option>
|
||||||
|
@ -20,19 +18,19 @@
|
||||||
</select>
|
</select>
|
||||||
<p class="header">ArmCord theme:</p>
|
<p class="header">ArmCord theme:</p>
|
||||||
</div>
|
</div>
|
||||||
</br>
|
<br />
|
||||||
<div class="switch">
|
<div class="switch">
|
||||||
<label class="header">ArmCord CSP</label>
|
<label class="header">ArmCord CSP</label>
|
||||||
<input class="tgl tgl-light left" id="csp" type="checkbox" />
|
<input class="tgl tgl-light left" id="csp" type="checkbox" />
|
||||||
<label class="tgl-btn left" for="csp"></label>
|
<label class="tgl-btn left" for="csp"></label>
|
||||||
</div>
|
</div>
|
||||||
</br>
|
<br />
|
||||||
<div class="switch">
|
<div class="switch">
|
||||||
<label class="header">Minimize to tray</label>
|
<label class="header">Minimize to tray</label>
|
||||||
<input class="tgl tgl-light left" id="tray" type="checkbox" />
|
<input class="tgl tgl-light left" id="tray" type="checkbox" />
|
||||||
<label class="tgl-btn left" for="tray"></label>
|
<label class="tgl-btn left" for="tray"></label>
|
||||||
</div>
|
</div>
|
||||||
</br>
|
<br />
|
||||||
<div class="switch">
|
<div class="switch">
|
||||||
<label class="header">Automatic Patches</label>
|
<label class="header">Automatic Patches</label>
|
||||||
<input class="tgl tgl-light left" id="patches" type="checkbox" />
|
<input class="tgl tgl-light left" id="patches" type="checkbox" />
|
||||||
|
@ -65,7 +63,6 @@
|
||||||
<p class="header">Glasstron blur type:</p>
|
<p class="header">Glasstron blur type:</p>
|
||||||
</div>
|
</div>
|
||||||
<button id="save" class="center">Save settings</button>
|
<button id="save" class="center">Save settings</button>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -78,11 +75,18 @@
|
||||||
document.getElementById("theme").value = await settings.get("windowStyle");
|
document.getElementById("theme").value = await settings.get("windowStyle");
|
||||||
document.getElementById("blurType").value = await settings.get("blurType");
|
document.getElementById("blurType").value = await settings.get("blurType");
|
||||||
}
|
}
|
||||||
loadSettings()
|
loadSettings();
|
||||||
document.getElementById("save").addEventListener("click", function () {
|
document.getElementById("save").addEventListener("click", function () {
|
||||||
//function saveSettings(windowStyle: string, channelSetting: string, armcordCSPSetting: boolean, minimizeToTray: boolean, automaticPatches: boolean,modsSetting: string, blurType: string)
|
//function saveSettings(windowStyle: string, channelSetting: string, armcordCSPSetting: boolean, minimizeToTray: boolean, automaticPatches: boolean,modsSetting: string, blurType: string)
|
||||||
settings.save(document.getElementById("theme").value, document.getElementById("channel").value, document.getElementById("csp").checked, document.getElementById("tray").checked, document.getElementById("patches").checked, document.getElementById("mod").value, document.getElementById("blurType").value);
|
settings.save(
|
||||||
|
document.getElementById("theme").value,
|
||||||
|
document.getElementById("channel").value,
|
||||||
|
document.getElementById("csp").checked,
|
||||||
|
document.getElementById("tray").checked,
|
||||||
|
document.getElementById("patches").checked,
|
||||||
|
document.getElementById("mod").value,
|
||||||
|
document.getElementById("blurType").value
|
||||||
|
);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
|
@ -1,5 +1,5 @@
|
||||||
import {app} from "electron";
|
import {app} from "electron";
|
||||||
import {mainWindow} from './window';
|
import {mainWindow} from "./window";
|
||||||
//https://github.com/electron/electron/issues/1334#issuecomment-716080005
|
//https://github.com/electron/electron/issues/1334#issuecomment-716080005
|
||||||
// TO-DO add more
|
// TO-DO add more
|
||||||
app.on("web-contents-created", (webContentsCreatedEvent, webContents) => {
|
app.on("web-contents-created", (webContentsCreatedEvent, webContents) => {
|
||||||
|
|
28
src/tray.ts
28
src/tray.ts
|
@ -1,38 +1,38 @@
|
||||||
import { app, Menu, Tray } from 'electron';
|
import {app, Menu, Tray} from "electron";
|
||||||
import {mainWindow} from './window';
|
import {mainWindow} from "./window";
|
||||||
import * as path from 'path'
|
import * as path from "path";
|
||||||
import { createSettingsWindow } from './settings/main';
|
import {createSettingsWindow} from "./settings/main";
|
||||||
let tray = null
|
let tray = null;
|
||||||
app.whenReady().then(() => {
|
app.whenReady().then(() => {
|
||||||
tray = new Tray(path.join(__dirname, "../", "/assets/ac_plug.png"))
|
tray = new Tray(path.join(__dirname, "../", "/assets/ac_plug.png"));
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
label: "Open ArmCord",
|
label: "Open ArmCord",
|
||||||
click: function () {
|
click: function () {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Open Settings",
|
label: "Open Settings",
|
||||||
click: function () {
|
click: function () {
|
||||||
createSettingsWindow();
|
createSettingsWindow();
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Support Discord Server",
|
label: "Support Discord Server",
|
||||||
click: function () {
|
click: function () {
|
||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
mainWindow.loadURL("https://discord.gg/pZtWQBFjk6");
|
mainWindow.loadURL("https://discord.gg/pZtWQBFjk6");
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Quit ArmCord",
|
label: "Quit ArmCord",
|
||||||
click: function () {
|
click: function () {
|
||||||
app.quit();
|
app.quit();
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
tray.setToolTip('ArmCord ' + app.getVersion())
|
tray.setToolTip("ArmCord " + app.getVersion());
|
||||||
tray.setContextMenu(contextMenu)
|
tray.setContextMenu(contextMenu);
|
||||||
})
|
});
|
||||||
|
|
|
@ -30,11 +30,7 @@ declare module "glasstron" {
|
||||||
static injectOnElectron(): void;
|
static injectOnElectron(): void;
|
||||||
static delayReadyEvent(): void;
|
static delayReadyEvent(): void;
|
||||||
}
|
}
|
||||||
export type WindowsBlurType =
|
export type WindowsBlurType = "acrylic" | "blurbehind" | "transparent" | "none";
|
||||||
| "acrylic"
|
|
||||||
| "blurbehind"
|
|
||||||
| "transparent"
|
|
||||||
| "none";
|
|
||||||
export type MacOSVibrancy =
|
export type MacOSVibrancy =
|
||||||
| (
|
| (
|
||||||
| "appearance-based"
|
| "appearance-based"
|
||||||
|
@ -63,24 +59,12 @@ declare module "glasstron" {
|
||||||
declare module "glasstron/src/utils" {
|
declare module "glasstron/src/utils" {
|
||||||
class Utils {
|
class Utils {
|
||||||
static getSavePath(): string;
|
static getSavePath(): string;
|
||||||
static copyToPath(
|
static copyToPath(innerFile: string, outerFilename?: string, flags?: number): void;
|
||||||
innerFile: string,
|
|
||||||
outerFilename?: string,
|
|
||||||
flags?: number
|
|
||||||
): void;
|
|
||||||
static removeFromPath(filename: string): void;
|
static removeFromPath(filename: string): void;
|
||||||
static isInPath(filename: string): boolean;
|
static isInPath(filename: string): boolean;
|
||||||
static getPlatform(): any;
|
static getPlatform(): any;
|
||||||
static parseKeyValString(
|
static parseKeyValString(string: string, keyvalSeparator?: string, pairSeparator?: string): any;
|
||||||
string: string,
|
static makeKeyValString(object: any, keyvalSeparator?: string, pairSeparator?: string): string;
|
||||||
keyvalSeparator?: string,
|
|
||||||
pairSeparator?: string
|
|
||||||
): any;
|
|
||||||
static makeKeyValString(
|
|
||||||
object: any,
|
|
||||||
keyvalSeparator?: string,
|
|
||||||
pairSeparator?: string
|
|
||||||
): string;
|
|
||||||
}
|
}
|
||||||
export = Utils;
|
export = Utils;
|
||||||
}
|
}
|
||||||
|
|
26
src/utils.ts
26
src/utils.ts
|
@ -22,19 +22,19 @@ export async function sleep(ms: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkIfConfigIsNew() {
|
export async function checkIfConfigIsNew() {
|
||||||
if (await getConfigUnsafe("automaticPatches") == undefined) {
|
if ((await getConfigUnsafe("automaticPatches")) == undefined) {
|
||||||
firstRun = true;
|
firstRun = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Settings {
|
export interface Settings {
|
||||||
windowStyle: string,
|
windowStyle: string;
|
||||||
channel: string,
|
channel: string;
|
||||||
armcordCSP: boolean,
|
armcordCSP: boolean;
|
||||||
minimizeToTray: boolean,
|
minimizeToTray: boolean;
|
||||||
automaticPatches: boolean,
|
automaticPatches: boolean;
|
||||||
mods: string,
|
mods: string;
|
||||||
blurType: string
|
blurType: string;
|
||||||
}
|
}
|
||||||
export function setup() {
|
export function setup() {
|
||||||
console.log("Setting up temporary ArmCord settings.");
|
console.log("Setting up temporary ArmCord settings.");
|
||||||
|
@ -45,13 +45,13 @@ export function setup() {
|
||||||
minimizeToTray: true,
|
minimizeToTray: true,
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
mods: "cumcord",
|
mods: "cumcord",
|
||||||
blurType: "acrylic",
|
blurType: "acrylic"
|
||||||
}
|
};
|
||||||
storage.set(
|
storage.set(
|
||||||
"settings",
|
"settings",
|
||||||
{
|
{
|
||||||
...defaults,
|
...defaults,
|
||||||
doneSetup: true,
|
doneSetup: true
|
||||||
},
|
},
|
||||||
function (error) {
|
function (error) {
|
||||||
if (error) throw error;
|
if (error) throw error;
|
||||||
|
@ -59,9 +59,7 @@ export function setup() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function saveSettings(
|
export function saveSettings(settings: Settings) {
|
||||||
settings: Settings
|
|
||||||
) {
|
|
||||||
console.log("Setting up ArmCord settings.");
|
console.log("Setting up ArmCord settings.");
|
||||||
storage.set(
|
storage.set(
|
||||||
"settings",
|
"settings",
|
||||||
|
|
|
@ -15,8 +15,7 @@ let guestWindows: BrowserWindow [] = [];
|
||||||
contextMenu({
|
contextMenu({
|
||||||
showSaveImageAs: true,
|
showSaveImageAs: true,
|
||||||
showCopyImageAddress: true,
|
showCopyImageAddress: true,
|
||||||
showSearchWithGoogle: true,
|
showSearchWithGoogle: true
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function doAfterDefiningTheWindow() {
|
function doAfterDefiningTheWindow() {
|
||||||
|
@ -28,21 +27,18 @@ function doAfterDefiningTheWindow() {
|
||||||
shell.openExternal(url);
|
shell.openExternal(url);
|
||||||
return {action: "deny"};
|
return {action: "deny"};
|
||||||
});
|
});
|
||||||
mainWindow.webContents.session.webRequest.onBeforeRequest(
|
mainWindow.webContents.session.webRequest.onBeforeRequest((details, callback) => {
|
||||||
(details, callback) => {
|
if (/api\/v\d\/science$/g.test(details.url)) return callback({cancel: true});
|
||||||
if (/api\/v\d\/science$/g.test(details.url))
|
|
||||||
return callback({ cancel: true });
|
|
||||||
return callback({});
|
return callback({});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
mainWindow.on("close", async (e) => {
|
mainWindow.on("close", async (e) => {
|
||||||
if (await getConfigUnsafe("minimizeToTray")) {
|
if (await getConfigUnsafe("minimizeToTray")) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
mainWindow.hide();
|
mainWindow.hide();
|
||||||
} else if (!await getConfigUnsafe("minimizeToTray")) {
|
} else if (!(await getConfigUnsafe("minimizeToTray"))) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
app.exit();
|
app.exit();
|
||||||
app.quit()
|
app.quit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log(contentPath);
|
console.log(contentPath);
|
||||||
|
@ -79,8 +75,8 @@ export function createCustomWindow() {
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, "preload/preload.js"),
|
preload: path.join(__dirname, "preload/preload.js"),
|
||||||
spellcheck: true,
|
spellcheck: true
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
doAfterDefiningTheWindow();
|
doAfterDefiningTheWindow();
|
||||||
}
|
}
|
||||||
|
@ -95,8 +91,8 @@ export function createNativeWindow() {
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, "preload/preload.js"),
|
preload: path.join(__dirname, "preload/preload.js"),
|
||||||
spellcheck: true,
|
spellcheck: true
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
doAfterDefiningTheWindow();
|
doAfterDefiningTheWindow();
|
||||||
}
|
}
|
||||||
|
@ -111,8 +107,8 @@ export function createGlasstronWindow() {
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, "preload/preload.js"),
|
preload: path.join(__dirname, "preload/preload.js"),
|
||||||
spellcheck: true,
|
spellcheck: true
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//@ts-expect-error
|
//@ts-expect-error
|
||||||
|
@ -132,17 +128,17 @@ export function createTabsHost() {
|
||||||
frame: true,
|
frame: true,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, "preload/preload.js"),
|
preload: path.join(__dirname, "preload/preload.js")
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
doAfterDefiningTheWindow();
|
doAfterDefiningTheWindow();
|
||||||
}
|
}
|
||||||
export function createTabsGuest(number: number) {
|
export function createTabsGuest(number: number) {
|
||||||
console.log(guestWindows)
|
console.log(guestWindows);
|
||||||
if (guestWindows[number] !== undefined || null) {
|
if (guestWindows[number] !== undefined || null) {
|
||||||
try {
|
try {
|
||||||
console.log("Showing Guest Window " + number);
|
console.log("Showing Guest Window " + number);
|
||||||
mainWindow.hide()
|
mainWindow.hide();
|
||||||
guestWindows[number].show();
|
guestWindows[number].show();
|
||||||
mainWindow = guestWindows[number];
|
mainWindow = guestWindows[number];
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -161,8 +157,8 @@ export function createTabsGuest(number: number) {
|
||||||
frame: true,
|
frame: true,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, "preload/preload.js"),
|
preload: path.join(__dirname, "preload/preload.js")
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow = guestWindows[number];
|
mainWindow = guestWindows[number];
|
||||||
|
@ -179,12 +175,8 @@ export function createTabsGuest(number: number) {
|
||||||
});
|
});
|
||||||
|
|
||||||
guestWindows[number].webContents.session.webRequest.onBeforeRequest(
|
guestWindows[number].webContents.session.webRequest.onBeforeRequest(
|
||||||
(
|
(details: {url: string}, callback: (arg0: {cancel?: boolean}) => any) => {
|
||||||
details: { url: string },
|
if (/api\/v\d\/science$/g.test(details.url)) return callback({cancel: true});
|
||||||
callback: (arg0: { cancel?: boolean }) => any
|
|
||||||
) => {
|
|
||||||
if (/api\/v\d\/science$/g.test(details.url))
|
|
||||||
return callback({ cancel: true });
|
|
||||||
return callback({});
|
return callback({});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue