add abillity to load custom bundles

This commit is contained in:
smartfrigde 2023-08-03 19:52:56 +02:00
parent d450cad7a5
commit 3c840791d8

View file

@ -54,6 +54,8 @@ export function setup(): void {
startMinimized: false, startMinimized: false,
dynamicIcon: false, dynamicIcon: false,
tray: true, tray: true,
customJsBundle: "https://armcord.app/placeholder.js",
customCssBundle: "https://armcord.app/placeholder.css",
disableAutogain: false, disableAutogain: false,
useLegacyCapturer: false, useLegacyCapturer: false,
mobileMode: false, mobileMode: false,
@ -257,6 +259,8 @@ export interface Settings {
mobileMode: boolean; mobileMode: boolean;
skipSplash: boolean; skipSplash: boolean;
performanceMode: string; performanceMode: string;
customJsBundle: RequestInfo | URL;
customCssBundle: RequestInfo | URL;
startMinimized: boolean; startMinimized: boolean;
useLegacyCapturer: boolean; useLegacyCapturer: boolean;
tray: boolean; tray: boolean;
@ -334,12 +338,14 @@ async function updateModBundle(): Promise<void> {
const clientMods = { const clientMods = {
vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js", vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js",
cordwood: "https://raw.githubusercontent.com/Cordwood/builds/master/index.js", cordwood: "https://raw.githubusercontent.com/Cordwood/builds/master/index.js",
shelter: "https://raw.githubusercontent.com/uwu/shelter-builds/main/shelter.js" shelter: "https://raw.githubusercontent.com/uwu/shelter-builds/main/shelter.js",
custom: await getConfig("customJsBundle")
}; };
const clientModsCss = { const clientModsCss = {
vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.css", vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.css",
cordwood: "https://armcord.app/placeholder.css", cordwood: "https://armcord.app/placeholder.css",
shelter: "https://armcord.app/placeholder.css" shelter: "https://armcord.app/placeholder.css",
custom: await getConfig("customCssBundle")
}; };
let bundle: string = await (await fetch(clientMods[name as keyof typeof clientMods])).text(); let bundle: string = await (await fetch(clientMods[name as keyof typeof clientMods])).text();
fs.writeFileSync(`${distFolder}bundle.js`, bundle, "utf-8"); fs.writeFileSync(`${distFolder}bundle.js`, bundle, "utf-8");
@ -401,7 +407,7 @@ export async function installModLoader(): Promise<void> {
} }
} }
export async function registerGlobalKeybinds() { export async function registerGlobalKeybinds(): Promise<void> {
const keybinds = await getConfig("keybinds"); const keybinds = await getConfig("keybinds");
keybinds.forEach((keybind) => { keybinds.forEach((keybind) => {
globalShortcut.register(keybind, () => { globalShortcut.register(keybind, () => {