aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/IpcEvents.ts1
-rw-r--r--src/utils/native.ts4
-rw-r--r--src/utils/updater.ts22
3 files changed, 4 insertions, 23 deletions
diff --git a/src/utils/IpcEvents.ts b/src/utils/IpcEvents.ts
index dbf3540..57e4bb2 100644
--- a/src/utils/IpcEvents.ts
+++ b/src/utils/IpcEvents.ts
@@ -40,7 +40,6 @@ export default strEnum({
OPEN_QUICKCSS: "VencordOpenQuickCss",
GET_UPDATES: "VencordGetUpdates",
GET_REPO: "VencordGetRepo",
- GET_HASHES: "VencordGetHashes",
UPDATE: "VencordUpdate",
BUILD: "VencordBuild",
OPEN_MONACO_EDITOR: "VencordOpenMonacoEditor",
diff --git a/src/utils/native.ts b/src/utils/native.ts
index 05fa0aa..1d29d40 100644
--- a/src/utils/native.ts
+++ b/src/utils/native.ts
@@ -20,12 +20,12 @@ export function relaunch() {
if (IS_DISCORD_DESKTOP)
window.DiscordNative.app.relaunch();
else
- window.VencordDesktop.app.relaunch();
+ window.VencordDesktopNative.app.relaunch();
}
export function showItemInFolder(path: string) {
if (IS_DISCORD_DESKTOP)
window.DiscordNative.fileManager.showItemInFolder(path);
else
- window.VencordDesktop.fileManager.showItemInFolder(path);
+ window.VencordDesktopNative.fileManager.showItemInFolder(path);
}
diff --git a/src/utils/updater.ts b/src/utils/updater.ts
index 3606e5f..2fd1561 100644
--- a/src/utils/updater.ts
+++ b/src/utils/updater.ts
@@ -62,24 +62,9 @@ export function getRepo() {
return Unwrap(VencordNative.ipc.invoke<IpcRes<string>>(IpcEvents.GET_REPO));
}
-type Hashes = Record<"patcher.js" | "main.js" | "preload.js" | "renderer.js" | "renderer.css", string>;
-
-/**
- * @returns true if hard restart is required
- */
export async function rebuild() {
- const oldHashes = await Unwrap(VencordNative.ipc.invoke<IpcRes<Hashes>>(IpcEvents.GET_HASHES));
-
if (!await Unwrap(VencordNative.ipc.invoke<IpcRes<boolean>>(IpcEvents.BUILD)))
throw new Error("The Build failed. Please try manually building the new update");
-
- const newHashes = await Unwrap(VencordNative.ipc.invoke<IpcRes<Hashes>>(IpcEvents.GET_HASHES));
-
- if (oldHashes["preload.js"] !== newHashes["preload.js"]) return true;
- if (IS_DISCORD_DESKTOP && oldHashes["patcher.js"] !== newHashes["patcher.js"]) return true;
- if (IS_VENCORD_DESKTOP && oldHashes["main.js"] !== newHashes["main.js"]) return true;
-
- return false;
}
export async function maybePromptToUpdate(confirmMessage: string, checkForDev = false) {
@@ -93,11 +78,8 @@ export async function maybePromptToUpdate(confirmMessage: string, checkForDev =
if (wantsUpdate && isNewer) return alert("Your local copy has more recent commits. Please stash or reset them.");
if (wantsUpdate) {
await update();
- const needFullRestart = await rebuild();
- if (needFullRestart)
- relaunch();
- else
- location.reload();
+ await rebuild();
+ relaunch();
}
}
} catch (err) {