Remove Migration

This commit is contained in:
thororen1234 2025-03-30 12:33:52 -04:00
parent 54f5b58325
commit a4a50e1bb2
No known key found for this signature in database
3 changed files with 8 additions and 42 deletions

View file

@ -19,9 +19,8 @@
import { get } from "@main/utils/simpleGet";
import { IpcEvents } from "@shared/IpcEvents";
import { VENCORD_USER_AGENT } from "@shared/vencordUserAgent";
import { app, dialog, ipcMain } from "electron";
import { ipcMain } from "electron";
import { writeFileSync as originalWriteFileSync } from "original-fs";
import { join } from "path";
import gitHash from "~git-hash";
import gitRemote from "~git-remote";
@ -87,28 +86,3 @@ ipcMain.handle(IpcEvents.GET_REPO, serializeErrors(() => `https://github.com/${g
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));
ipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));
export async function migrateLegacyToAsar() {
try {
const isFlatpak = process.platform === "linux" && !!process.env.FLATPAK_ID;
if (isFlatpak) throw "Flatpak Discord can't automatically be migrated.";
const data = await get(`https://github.com/${gitRemote}/releases/latest/download/desktop.asar`);
originalWriteFileSync(join(__dirname, "../equicord.asar"), data);
originalWriteFileSync(__filename, '// Legacy shim for new asar\n\nrequire("../equicord.asar");');
app.relaunch();
app.exit();
} catch (e) {
console.error("Failed to migrate to asar", e);
app.whenReady().then(() => {
dialog.showErrorBox(
"Legacy Install",
"The way Equicord loaded was changed and the updater failed to migrate. Please reinstall using the Equicord Installer!"
);
app.exit(1);
});
}
}