mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 13:43:03 -04:00
Revert Asar
This commit is contained in:
parent
3a38192395
commit
a96f8e2c15
7 changed files with 31 additions and 21 deletions
|
@ -228,8 +228,3 @@ await Promise.all([
|
||||||
main: "main.js"
|
main: "main.js"
|
||||||
}))
|
}))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await Promise.all([
|
|
||||||
createPackage("dist/desktop", "dist/desktop.asar"),
|
|
||||||
createPackage("dist/equibop", "dist/equibop.asar"),
|
|
||||||
]);
|
|
||||||
|
|
|
@ -43,9 +43,11 @@ if (IS_VESKTOP || !IS_VANILLA) {
|
||||||
}
|
}
|
||||||
switch (url) {
|
switch (url) {
|
||||||
case "renderer.js.map":
|
case "renderer.js.map":
|
||||||
|
case "equibopRenderer.js.map":
|
||||||
case "preload.js.map":
|
case "preload.js.map":
|
||||||
|
case "equibopPreload.js.map":
|
||||||
case "patcher.js.map":
|
case "patcher.js.map":
|
||||||
case "main.js.map":
|
case "equibopMain.js.map":
|
||||||
cb(join(__dirname, url));
|
cb(join(__dirname, url));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -119,7 +119,7 @@ ipcMain.handle(IpcEvents.OPEN_MONACO_EDITOR, async () => {
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
darkTheme: true,
|
darkTheme: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: join(__dirname, "preload.js"),
|
preload: join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "equibopPreload.js"),
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
sandbox: false
|
sandbox: false
|
||||||
|
|
|
@ -29,8 +29,11 @@ console.log("[Equicord] Starting up...");
|
||||||
// Our injector file at app/index.js
|
// Our injector file at app/index.js
|
||||||
const injectorPath = require.main!.filename;
|
const injectorPath = require.main!.filename;
|
||||||
|
|
||||||
|
// special discord_arch_electron injection method
|
||||||
|
const asarName = require.main!.path.endsWith("app.asar") ? "_app.asar" : "app.asar";
|
||||||
|
|
||||||
// The original app.asar
|
// The original app.asar
|
||||||
const asarPath = join(dirname(injectorPath), "..", "_app.asar");
|
const asarPath = join(dirname(injectorPath), "..", asarName);
|
||||||
|
|
||||||
const discordPkg = require(join(asarPath, "package.json"));
|
const discordPkg = require(join(asarPath, "package.json"));
|
||||||
require.main!.filename = join(asarPath, discordPkg.main);
|
require.main!.filename = join(asarPath, discordPkg.main);
|
||||||
|
|
|
@ -16,7 +16,12 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const ASAR_FILE = IS_VESKTOP ? "vesktop.asar" : IS_EQUIBOP ? "equibop.asar" : "desktop.asar";
|
export const EQUICORD_FILES = [
|
||||||
|
IS_DISCORD_DESKTOP ? "patcher.js" : "equibopMain.js",
|
||||||
|
IS_DISCORD_DESKTOP ? "preload.js" : "equibopPreload.js",
|
||||||
|
IS_DISCORD_DESKTOP ? "renderer.js" : "equibopRenderer.js",
|
||||||
|
IS_DISCORD_DESKTOP ? "renderer.css" : "equibopRenderer.css",
|
||||||
|
];
|
||||||
|
|
||||||
export function serializeErrors(func: (...args: any[]) => any) {
|
export function serializeErrors(func: (...args: any[]) => any) {
|
||||||
return async function () {
|
return async function () {
|
||||||
|
|
|
@ -20,15 +20,16 @@ import { get } from "@main/utils/simpleGet";
|
||||||
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 { ipcMain } from "electron";
|
import { ipcMain } from "electron";
|
||||||
import { writeFileSync as originalWriteFileSync } from "original-fs";
|
import { writeFile } from "fs/promises";
|
||||||
|
import { join } from "path";
|
||||||
|
|
||||||
import gitHash from "~git-hash";
|
import gitHash from "~git-hash";
|
||||||
import gitRemote from "~git-remote";
|
import gitRemote from "~git-remote";
|
||||||
|
|
||||||
import { ASAR_FILE, serializeErrors } from "./common";
|
import { EQUICORD_FILES, serializeErrors } from "./common";
|
||||||
|
|
||||||
const API_BASE = `https://api.github.com/repos/${gitRemote}`;
|
const API_BASE = `https://api.github.com/repos/${gitRemote}`;
|
||||||
let PendingUpdate: string | null = null;
|
let PendingUpdates = [] as [string, string][];
|
||||||
|
|
||||||
async function githubGet(endpoint: string) {
|
async function githubGet(endpoint: string) {
|
||||||
return get(API_BASE + endpoint, {
|
return get(API_BASE + endpoint, {
|
||||||
|
@ -65,19 +66,23 @@ async function fetchUpdates() {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
const asset = data.assets.find(a => a.name === ASAR_FILE);
|
data.assets.forEach(({ name, browser_download_url }) => {
|
||||||
PendingUpdate = asset.browser_download_url;
|
if (EQUICORD_FILES.some(s => name.startsWith(s))) {
|
||||||
|
PendingUpdates.push([name, browser_download_url]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function applyUpdates() {
|
async function applyUpdates() {
|
||||||
if (!PendingUpdate) return true;
|
await Promise.all(PendingUpdates.map(
|
||||||
|
async ([name, data]) => writeFile(
|
||||||
const data = await get(PendingUpdate);
|
join(__dirname, name),
|
||||||
originalWriteFileSync(__dirname, data);
|
await get(data)
|
||||||
|
)
|
||||||
PendingUpdate = null;
|
));
|
||||||
|
PendingUpdates = [];
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ contextBridge.exposeInMainWorld("VencordNative", VencordNative);
|
||||||
// Discord
|
// Discord
|
||||||
if (location.protocol !== "data:") {
|
if (location.protocol !== "data:") {
|
||||||
// #region cssInsert
|
// #region cssInsert
|
||||||
const rendererCss = join(__dirname, "renderer.css");
|
const rendererCss = join(__dirname, IS_DISCORD_DESKTOP ? "renderer.css" : "equibopRenderer.css");
|
||||||
|
|
||||||
const style = document.createElement("style");
|
const style = document.createElement("style");
|
||||||
style.id = "vencord-css-core";
|
style.id = "vencord-css-core";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue