diff options
author | Vendicated <vendicated@riseup.net> | 2022-11-17 00:44:52 +0100 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-11-17 00:45:00 +0100 |
commit | 8b0911b86a4f070122a1c5ba773bbf65a88a2ecd (patch) | |
tree | 057a6858d1a651a48f7d6dee9ac221825cbbf89e /src | |
parent | 47d127a89566dafa201ede0b5240a5a0bd6b3fe1 (diff) | |
download | Vencord-8b0911b86a4f070122a1c5ba773bbf65a88a2ecd.tar.gz Vencord-8b0911b86a4f070122a1c5ba773bbf65a88a2ecd.tar.bz2 Vencord-8b0911b86a4f070122a1c5ba773bbf65a88a2ecd.zip |
Updater: Ignore non release commits
Diffstat (limited to 'src')
-rw-r--r-- | src/ipcMain/updater/http.ts | 17 | ||||
-rw-r--r-- | src/patcher.ts | 1 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/ipcMain/updater/http.ts b/src/ipcMain/updater/http.ts index 5b3f0ff..523340f 100644 --- a/src/ipcMain/updater/http.ts +++ b/src/ipcMain/updater/http.ts @@ -29,7 +29,7 @@ import { get } from "../simpleGet"; import { calculateHashes, serializeErrors } from "./common"; const API_BASE = `https://api.github.com/repos/${gitRemote}`; -let PendingUpdates = [] as [string, Buffer][]; +let PendingUpdates = [] as [string, string][]; async function githubGet(endpoint: string) { return get(API_BASE + endpoint, { @@ -46,6 +46,9 @@ async function githubGet(endpoint: string) { } async function calculateGitChanges() { + const isOutdated = await fetchUpdates(); + if (!isOutdated) return []; + const res = await githubGet(`/compare/${gitHash}...HEAD`); const data = JSON.parse(res.toString("utf-8")); @@ -63,18 +66,20 @@ async function fetchUpdates() { const data = JSON.parse(release.toString()); const hash = data.name.slice(data.name.lastIndexOf(" ") + 1); if (hash === gitHash) - return true; + return false; - await Promise.all(data.assets.map(async ({ name, browser_download_url }) => { + data.assets.forEach(({ name, browser_download_url }) => { if (["patcher.js", "preload.js", "renderer.js"].some(s => name.startsWith(s))) { - PendingUpdates.push([name, await get(browser_download_url)]); + PendingUpdates.push([name, browser_download_url]); } - })); + }); return true; } async function applyUpdates() { - await Promise.all(PendingUpdates.map(([name, data]) => writeFile(join(__dirname, name), data))); + await Promise.all(PendingUpdates.map( + async ([name, data]) => writeFile(join(__dirname, name), await get(data))) + ); PendingUpdates = []; return true; } diff --git a/src/patcher.ts b/src/patcher.ts index eb607b9..28910b7 100644 --- a/src/patcher.ts +++ b/src/patcher.ts @@ -152,6 +152,5 @@ if (readFileSync(injectorPath, "utf-8").includes('require("../app.asar")')) { return loadModule.apply(this, arguments); }; } else { - console.log(require.main!.filename); require(require.main!.filename); } |