fixes
This commit is contained in:
parent
fbfbe33c0a
commit
d9c469755b
|
@ -22,7 +22,6 @@ import { dirname, join } from "path";
|
||||||
|
|
||||||
import { initIpc } from "./ipcMain";
|
import { initIpc } from "./ipcMain";
|
||||||
import { RendererSettings } from "./settings";
|
import { RendererSettings } from "./settings";
|
||||||
import { migrateLegacyToAsar } from "./updater/http";
|
|
||||||
import { IS_VANILLA } from "./utils/constants";
|
import { IS_VANILLA } from "./utils/constants";
|
||||||
|
|
||||||
console.log("[Vencord] Starting up...");
|
console.log("[Vencord] Starting up...");
|
||||||
|
@ -31,7 +30,7 @@ console.log("[Vencord] Starting up...");
|
||||||
const isLegacyNonAsarVencord = IS_STANDALONE && !__dirname.endsWith(".asar");
|
const isLegacyNonAsarVencord = IS_STANDALONE && !__dirname.endsWith(".asar");
|
||||||
if (isLegacyNonAsarVencord) {
|
if (isLegacyNonAsarVencord) {
|
||||||
console.warn("This is a legacy non asar install! Migrating to asar and restarting...");
|
console.warn("This is a legacy non asar install! Migrating to asar and restarting...");
|
||||||
migrateLegacyToAsar();
|
require("./updater/http").migrateLegacyToAsar();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our injector file at app/index.js
|
// Our injector file at app/index.js
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
import { IpcEvents } from "@shared/IpcEvents";
|
import { IpcEvents } from "@shared/IpcEvents";
|
||||||
import { VENCORD_USER_AGENT } from "@shared/vencordUserAgent";
|
import { VENCORD_USER_AGENT } from "@shared/vencordUserAgent";
|
||||||
import { app, dialog, ipcMain } from "electron";
|
import { app, dialog, ipcMain } from "electron";
|
||||||
import { writeFile } from "fs/promises";
|
import { writeFileSync as originalWriteFileSync } from "original-fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
import gitHash from "~git-hash";
|
import gitHash from "~git-hash";
|
||||||
|
@ -76,7 +76,7 @@ async function applyUpdates() {
|
||||||
if (!PendingUpdate) return true;
|
if (!PendingUpdate) return true;
|
||||||
|
|
||||||
const data = await get(PendingUpdate);
|
const data = await get(PendingUpdate);
|
||||||
await writeFile(__dirname, data);
|
originalWriteFileSync(__dirname, data);
|
||||||
|
|
||||||
PendingUpdate = null;
|
PendingUpdate = null;
|
||||||
|
|
||||||
|
@ -90,10 +90,13 @@ ipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));
|
||||||
|
|
||||||
export async function migrateLegacyToAsar() {
|
export async function migrateLegacyToAsar() {
|
||||||
try {
|
try {
|
||||||
const data = await get(`https://github.com/${gitRemote}/releases/latest/desktop.asar`);
|
const data = await get(`https://github.com/${gitRemote}/releases/latest/download/desktop.asar`);
|
||||||
await writeFile(join(__dirname, "../vencord.asar"), data);
|
|
||||||
await writeFile(__filename, '// Legacy shim for new asar\n\nrequire("../vencord.asar");');
|
originalWriteFileSync(join(__dirname, "../vencord.asar"), data);
|
||||||
|
originalWriteFileSync(__filename, '// Legacy shim for new asar\n\nrequire("../vencord.asar");');
|
||||||
|
|
||||||
app.relaunch();
|
app.relaunch();
|
||||||
|
app.quit();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to migrate to asar", e);
|
console.error("Failed to migrate to asar", e);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue