armcord/src/preload/patch.ts

23 lines
958 B
TypeScript
Raw Normal View History

2022-02-26 21:26:16 +00:00
// What does this do?
// In case of faulty update of ArmCord we can quickly push an update to the user and possibly try to fix it
// This is completely optional and is disabled by default in settings
2022-03-04 17:53:18 +00:00
import {ipcRenderer} from "electron";
import {injectJS} from "../utils";
2022-02-26 21:26:16 +00:00
var patchEndpoint = "https://patch.armcord.xyz/";
var version = ipcRenderer.sendSync("get-app-version", "app-version");
if (ipcRenderer.sendSync("shouldPatch")) {
2022-03-04 17:53:18 +00:00
document.addEventListener("DOMContentLoaded", function () {
fetch(patchEndpoint + version + "/info.json", {cache: "no-store"}) //lmao
.then((res) => res.json())
.then((res) => {
if (res.patch == true) {
console.log("Found a patch. Injecting...");
injectJS(patchEndpoint + version + "/patch.js");
} else {
console.log("No patches have been found.");
}
});
});
2022-02-26 21:26:16 +00:00
}