mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Add mod bundle update skip
This commit is contained in:
parent
a4968e7529
commit
afa83c782d
1 changed files with 25 additions and 20 deletions
45
src/utils.ts
45
src/utils.ts
|
@ -285,29 +285,34 @@ export async function checkIfConfigExists() {
|
||||||
|
|
||||||
// Mods
|
// Mods
|
||||||
async function updateModBundle() {
|
async function updateModBundle() {
|
||||||
try {
|
if ((await getConfig("noBundleUpdates")) == undefined ?? false) {
|
||||||
console.log("Downloading mod bundle");
|
try {
|
||||||
const distFolder = app.getPath("userData") + "/plugins/loader/dist/";
|
console.log("Downloading mod bundle");
|
||||||
while (!fs.existsSync(distFolder)) {
|
const distFolder = app.getPath("userData") + "/plugins/loader/dist/";
|
||||||
//waiting
|
while (!fs.existsSync(distFolder)) {
|
||||||
|
//waiting
|
||||||
|
}
|
||||||
|
var name: string = await getConfig("mods");
|
||||||
|
const clientMods = {
|
||||||
|
vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js",
|
||||||
|
cordwood: "https://raw.githubusercontent.com/Cordwood/builds/master/index.js",
|
||||||
|
shelter: "https://raw.githubusercontent.com/uwu/shelter-builds/main/shelter.js"
|
||||||
|
};
|
||||||
|
var bundle: string = await (await fetch(clientMods[name as keyof typeof clientMods])).text();
|
||||||
|
fs.writeFileSync(distFolder + "bundle.js", bundle, "utf-8");
|
||||||
|
} catch (e) {
|
||||||
|
console.log("[Mod loader] Failed to install mods");
|
||||||
|
console.error(e);
|
||||||
|
dialog.showErrorBox(
|
||||||
|
"Oops, something went wrong.",
|
||||||
|
"ArmCord couldn't install mods, please check if you have stable internet connection and restart the app. If this issue persists, report it on the support server/Github issues."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
var name: string = await getConfig("mods");
|
} else {
|
||||||
const clientMods = {
|
console.log("[Mod loader] Skipping mod bundle update");
|
||||||
vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js",
|
|
||||||
cordwood: "https://raw.githubusercontent.com/Cordwood/builds/master/index.js",
|
|
||||||
shelter: "https://raw.githubusercontent.com/uwu/shelter-builds/main/shelter.js"
|
|
||||||
};
|
|
||||||
var bundle: string = await (await fetch(clientMods[name as keyof typeof clientMods])).text();
|
|
||||||
fs.writeFileSync(distFolder + "bundle.js", bundle, "utf-8");
|
|
||||||
} catch (e) {
|
|
||||||
console.log("[Mod loader] Failed to install mods");
|
|
||||||
console.error(e);
|
|
||||||
dialog.showErrorBox(
|
|
||||||
"Oops, something went wrong.",
|
|
||||||
"ArmCord couldn't install mods, please check if you have stable internet connection and restart the app. If this issue persists, report it on the support server/Github issues."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export var modInstallState: string;
|
export var modInstallState: string;
|
||||||
export async function installModLoader() {
|
export async function installModLoader() {
|
||||||
if ((await getConfig("mods")) == "none") {
|
if ((await getConfig("mods")) == "none") {
|
||||||
|
|
Loading…
Reference in a new issue