Updater: Exclude more recent local commits

This commit is contained in:
Vendicated 2022-10-05 16:47:28 +02:00
parent 45644dec43
commit 443978929b
No known key found for this signature in database
GPG Key ID: EC781ADFB93EFFA3

@ -1,6 +1,7 @@
import IpcEvents from "./IpcEvents"; import IpcEvents from "./IpcEvents";
import Logger from "./logger"; import Logger from "./logger";
import { IpcRes } from './types'; import { IpcRes } from './types';
import gitHash from 'git-hash';
export const UpdateLogger = new Logger("Updater", "white"); export const UpdateLogger = new Logger("Updater", "white");
export let isOutdated = false; export let isOutdated = false;
@ -18,6 +19,10 @@ async function Unwrap<T>(p: Promise<IpcRes<T>>) {
export async function checkForUpdates() { export async function checkForUpdates() {
changes = await Unwrap(VencordNative.ipc.invoke<IpcRes<typeof changes>>(IpcEvents.GET_UPDATES)); changes = await Unwrap(VencordNative.ipc.invoke<IpcRes<typeof changes>>(IpcEvents.GET_UPDATES));
if (changes.some(c => c.hash === gitHash)) {
// git log NEWER...OLDER works as well. This means it will return the more recent local commits if the
changes = [];
}
return (isOutdated = changes.length > 0); return (isOutdated = changes.length > 0);
} }