From 5d80d44fc8c033d0c0d67f471770e41a3d42eab6 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 18:23:28 +0100
Subject: [PATCH 01/10] Re-add client mods (vencord, shelter)
---
package.json | 5 ++-
pnpm-lock.yaml | 59 +++++++++++++++++++++++++++-
src/.npmrc | 3 ++
src/content/setup.html | 4 +-
src/content/splash.html | 21 +++++++++-
src/extensions/mods.ts | 6 ++-
src/extensions/plugin.ts | 2 +-
src/ipc.ts | 8 +++-
src/main.ts | 6 +--
src/preload/bridge.ts | 2 +
src/preload/preload.ts | 22 ++---------
src/settings/settings.html | 8 ++--
src/utils.ts | 78 +++++++++++++++++++++++++++++++++++---
src/window.ts | 2 +-
14 files changed, 188 insertions(+), 38 deletions(-)
create mode 100644 src/.npmrc
diff --git a/package.json b/package.json
index 8ddec2f..a45b83e 100644
--- a/package.json
+++ b/package.json
@@ -28,11 +28,12 @@
"homepage": "https://github.com/armcord/armcord#readme",
"devDependencies": {
"@types/node": "^17.0.42",
+ "@types/node-fetch": "^2.6.2",
"@types/ws": "^8.5.3",
"chalk-cli": "^5.0.0",
"copyfiles": "^2.4.1",
"electron": "^20.1.0",
- "electron-builder": "^23.0.3",
+ "electron-builder": "^23.6.0",
"husky": "^8.0.1",
"prettier": "^2.7.0",
"typescript": "^4.7.3"
@@ -40,6 +41,8 @@
"dependencies": {
"@pyke/vibe": "^0.3.1",
"electron-context-menu": "github:ArmCord/electron-context-menu",
+ "extract-zip": "^2.0.1",
+ "node-fetch": "v2",
"os-locale": "^6.0.2",
"v8-compile-cache": "^2.3.0",
"ws": "^8.8.0"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1c83e3e..dac7aec 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -3,13 +3,16 @@ lockfileVersion: 5.4
specifiers:
'@pyke/vibe': ^0.3.1
'@types/node': ^17.0.42
+ '@types/node-fetch': ^2.6.2
'@types/ws': ^8.5.3
chalk-cli: ^5.0.0
copyfiles: ^2.4.1
electron: ^20.1.0
- electron-builder: ^23.0.3
+ electron-builder: ^23.6.0
electron-context-menu: github:ArmCord/electron-context-menu
+ extract-zip: ^2.0.1
husky: ^8.0.1
+ node-fetch: v2
os-locale: ^6.0.2
prettier: ^2.7.0
typescript: ^4.7.3
@@ -19,12 +22,15 @@ specifiers:
dependencies:
'@pyke/vibe': 0.3.1_electron@20.3.1
electron-context-menu: github.com/ArmCord/electron-context-menu/280c81398c02a063f46e3285a9708d8db1a7ce32
+ extract-zip: 2.0.1
+ node-fetch: 2.6.7
os-locale: 6.0.2
v8-compile-cache: 2.3.0
ws: 8.9.0
devDependencies:
'@types/node': 17.0.45
+ '@types/node-fetch': 2.6.2
'@types/ws': 8.5.3
chalk-cli: 5.0.0
copyfiles: 2.4.1
@@ -184,6 +190,13 @@ packages:
resolution: {integrity: sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==}
dev: true
+ /@types/node-fetch/2.6.2:
+ resolution: {integrity: sha512-DHqhlq5jeESLy19TYhLakJ07kNumXWjcDdxXsLUMJZ6ue8VZJj4kLPQVE/2mdHh3xZziNF1xppu5lwmS53HR+A==}
+ dependencies:
+ '@types/node': 17.0.45
+ form-data: 3.0.1
+ dev: true
+
/@types/node/16.11.64:
resolution: {integrity: sha512-z5hPTlVFzNwtJ2LNozTpJcD1Cu44c4LNuzaq1mwxmiHWQh2ULdR6Vjwo1UGldzRpzL0yUEdZddnfqGW2G70z6Q==}
@@ -335,6 +348,7 @@ packages:
/asar/3.2.0:
resolution: {integrity: sha512-COdw2ZQvKdFGFxXwX3oYh2/sOsJWJegrdJCGxnN4MZ7IULgRBp9P6665aqj9z1v9VwP4oP1hRBojRDQ//IGgAg==}
engines: {node: '>=10.12.0'}
+ deprecated: Please use @electron/asar moving forward. There is no API change, just a package name change
hasBin: true
dependencies:
chromium-pickle-js: 0.2.0
@@ -380,6 +394,7 @@ packages:
/base64-js/1.5.1:
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
+ requiresBuild: true
dev: true
/bluebird-lst/1.0.9:
@@ -976,10 +991,12 @@ packages:
/fast-deep-equal/3.1.3:
resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
+ requiresBuild: true
dev: true
/fast-json-stable-stringify/2.1.0:
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
+ requiresBuild: true
dev: true
/fd-slicer/1.1.0:
@@ -1001,6 +1018,15 @@ packages:
path-exists: 4.0.0
dev: true
+ /form-data/3.0.1:
+ resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==}
+ engines: {node: '>= 6'}
+ dependencies:
+ asynckit: 0.4.0
+ combined-stream: 1.0.8
+ mime-types: 2.1.35
+ dev: true
+
/form-data/4.0.0:
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
engines: {node: '>= 6'}
@@ -1351,6 +1377,7 @@ packages:
/json-schema-traverse/0.4.1:
resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==}
+ requiresBuild: true
dev: true
/json-stringify-safe/5.0.1:
@@ -1557,6 +1584,18 @@ packages:
dev: true
optional: true
+ /node-fetch/2.6.7:
+ resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
+ engines: {node: 4.x || >=6.0.0}
+ peerDependencies:
+ encoding: ^0.1.0
+ peerDependenciesMeta:
+ encoding:
+ optional: true
+ dependencies:
+ whatwg-url: 5.0.0
+ dev: false
+
/noms/0.0.0:
resolution: {integrity: sha512-lNDU9VJaOPxUmXcLb+HQFeUgQQPtMI24Gt6hgfuMHRJgMRHMF/qZ4HJD3GDru4sSw9IQl2jPjAYnQrdIeLbwow==}
dependencies:
@@ -1692,6 +1731,7 @@ packages:
/punycode/2.1.1:
resolution: {integrity: sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==}
engines: {node: '>=6'}
+ requiresBuild: true
dev: true
/pupa/2.1.1:
@@ -2026,6 +2066,10 @@ packages:
resolution: {integrity: sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==}
engines: {node: '>=6'}
+ /tr46/0.0.3:
+ resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
+ dev: false
+
/trim-newlines/4.0.2:
resolution: {integrity: sha512-GJtWyq9InR/2HRiLZgpIKv+ufIKrVrvjQWEj7PxAXNc5dwbNJkqhAUoAGgzRmULAnoOM5EIpveYd3J2VeSAIew==}
engines: {node: '>=12'}
@@ -2082,6 +2126,7 @@ packages:
/uri-js/4.4.1:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
+ requiresBuild: true
dependencies:
punycode: 2.1.1
dev: true
@@ -2122,6 +2167,17 @@ packages:
dev: true
optional: true
+ /webidl-conversions/3.0.1:
+ resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
+ dev: false
+
+ /whatwg-url/5.0.0:
+ resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}
+ dependencies:
+ tr46: 0.0.3
+ webidl-conversions: 3.0.1
+ dev: false
+
/which/2.0.2:
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
engines: {node: '>= 8'}
@@ -2158,6 +2214,7 @@ packages:
/xmlbuilder/15.1.1:
resolution: {integrity: sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==}
engines: {node: '>=8.0'}
+ requiresBuild: true
dev: true
/xtend/4.0.2:
diff --git a/src/.npmrc b/src/.npmrc
new file mode 100644
index 0000000..048b75f
--- /dev/null
+++ b/src/.npmrc
@@ -0,0 +1,3 @@
+node-linker=hoisted
+public-hoist-pattern=*
+shamefully-hoist=true
\ No newline at end of file
diff --git a/src/content/setup.html b/src/content/setup.html
index 47ecd70..75048c5 100644
--- a/src/content/setup.html
+++ b/src/content/setup.html
@@ -53,7 +53,9 @@
Select a client mod you want to install:
- None (check Discord)
+ Vencord
+ Shelter
+ None
diff --git a/src/content/splash.html b/src/content/splash.html
index f4771d6..383b934 100644
--- a/src/content/splash.html
+++ b/src/content/splash.html
@@ -47,6 +47,25 @@
console.log("ArmCord is up to date.");
}
}
+
+ function check() {
+ if (armcordinternal.installState === "installing") {
+ text.innerHTML = "Installing mods";
+ } else if (armcordinternal.installState === "done") {
+ return true;
+ } else if (armcordinternal.installState === "modDownload") {
+ text.innerHTML = "Updating " + armcord.mods;
+ } else if (armcordinternal.installState === "none") {
+ text.innerHTML = "Nothing to install. Starting ArmCord";
+ return true;
+ } else {
+ return true;
+ }
+ }
+
+ while (check() == false) {
+ console.log("Installing");
+ }
setTimeout(() => {
window.armcord.splashEnd();
switch (window.armcord.channel) {
@@ -68,7 +87,7 @@
default:
window.location.replace("https://discord.com/app");
}
- }, 5000);
+ }, 3000);
}
}
diff --git a/src/extensions/mods.ts b/src/extensions/mods.ts
index 690396e..ad3cae2 100644
--- a/src/extensions/mods.ts
+++ b/src/extensions/mods.ts
@@ -21,7 +21,11 @@ const unstrictCSP = () => {
const cspAllowAll = ["connect-src", "style-src", "img-src", "font-src"];
- const corsAllowUrls = ["https://raw.githubusercontent.com/Cordwood/builds/master/index.js"];
+ const corsAllowUrls = [
+ "https://raw.githubusercontent.com/Cordwood/builds/master/index.js",
+ "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js",
+ "https://cors.armcord.xyz/raw.githubusercontent.com/uwu/shelter-builds/main/shelter.js"
+ ];
electron.session.defaultSession.webRequest.onHeadersReceived(({responseHeaders, url}, done) => {
let csp = responseHeaders!["content-security-policy"];
diff --git a/src/extensions/plugin.ts b/src/extensions/plugin.ts
index cb1a064..b68be0b 100644
--- a/src/extensions/plugin.ts
+++ b/src/extensions/plugin.ts
@@ -12,7 +12,7 @@ app.whenReady().then(() => {
const manifest = fs.readFileSync(`${userDataPath}/plugins/${file}/manifest.json`, "utf8");
var pluginFile = JSON.parse(manifest);
session.defaultSession.loadExtension(`${userDataPath}/plugins/${file}`);
- console.log(`%cLoaded ${pluginFile.name} made by ${pluginFile.author}`, "color:red");
+ console.log(`[Mod loader] Loaded ${pluginFile.name} made by ${pluginFile.author}`);
} catch (err) {
console.error(err);
}
diff --git a/src/ipc.ts b/src/ipc.ts
index 0fbaf1f..1dd9080 100644
--- a/src/ipc.ts
+++ b/src/ipc.ts
@@ -9,11 +9,14 @@ import {
getLang,
getWindowState,
packageVersion,
- getDisplayVersion
+ getDisplayVersion,
+ modInstallState,
+ installModLoader
} from "./utils";
import {customTitlebar} from "./main";
import {createSettingsWindow} from "./settings/main";
import os from "os";
+import fs from "fs"
import path from "path";
export function registerIpc() {
ipcMain.on("get-app-path", (event, arg) => {
@@ -73,6 +76,9 @@ export function registerIpc() {
ipcMain.on("displayVersion", (event) => {
event.returnValue = getDisplayVersion();
});
+ ipcMain.on("modInstallState", (event) => {
+ event.returnValue = modInstallState;
+ });
ipcMain.on("get-package-version", (event) => {
event.returnValue = packageVersion;
});
diff --git a/src/main.ts b/src/main.ts
index d3e8b00..6bcd596 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,11 +1,10 @@
// Modules to control application life and create native browser window
import {app, BrowserWindow, session} from "electron";
import "v8-compile-cache";
-import {getConfig, checkIfConfigExists, injectElectronFlags} from "./utils";
+import {getConfig, checkIfConfigExists, injectElectronFlags, installModLoader} from "./utils";
import "./extensions/mods";
-import "./extensions/plugin";
import "./tray";
-import {createCustomWindow, createNativeWindow, createTransparentWindow} from "./window";
+import {createCustomWindow, createNativeWindow, createTransparentWindow, mainWindow} from "./window";
import path from "path";
export var iconPath: string;
export var settings: any;
@@ -53,6 +52,7 @@ app.whenReady().then(async () => {
}
}
await init();
+ await installModLoader()
session.fromPartition("some-partition").setPermissionRequestHandler((webContents, permission, callback) => {
if (permission === "notifications") {
// Approves the permissions request
diff --git a/src/preload/bridge.ts b/src/preload/bridge.ts
index 1697584..1b9f32c 100644
--- a/src/preload/bridge.ts
+++ b/src/preload/bridge.ts
@@ -22,6 +22,7 @@ contextBridge.exposeInMainWorld("armcord", {
return result;
}),
version: ipcRenderer.sendSync("get-app-version", "app-version"),
+ mods: ipcRenderer.sendSync("clientmod"),
packageVersion: ipcRenderer.sendSync("get-package-version", "app-version"),
getDisplayMediaSelector: getDisplayMediaSelector,
splashEnd: () => ipcRenderer.send("splashEnd"),
@@ -31,6 +32,7 @@ contextBridge.exposeInMainWorld("armcord", {
if (window.location.href.indexOf("splash.html") > -1 || window.location.href.indexOf("setup.html") > -1) {
contextBridge.exposeInMainWorld("armcordinternal", {
restart: () => ipcRenderer.send("restart"),
+ installState: ipcRenderer.sendSync("modInstallState"),
saveSettings: (...args: any) => ipcRenderer.send("saveSettings", ...args)
});
}
diff --git a/src/preload/preload.ts b/src/preload/preload.ts
index d93dca0..8ab16e2 100644
--- a/src/preload/preload.ts
+++ b/src/preload/preload.ts
@@ -1,11 +1,11 @@
+import {ipcRenderer} from "electron";
import "./bridge";
import "./capturer";
import "./patch";
import * as fs from "fs";
import * as path from "path";
import {injectHummusTitlebar, injectTitlebar} from "./titlebar";
-import {sleep, addStyle, injectJS} from "../utils";
-import {ipcRenderer} from "electron";
+import {sleep, addStyle} from "../utils";
import {injectMobileStuff} from "./mobile";
var version = ipcRenderer.sendSync("displayVersion");
var channel = ipcRenderer.sendSync("channel");
@@ -23,10 +23,6 @@ declare global {
armcord: any;
}
}
-const clientMods = {
- goosemod: "https://api.goosemod.com/inject.js",
- cordwood: "https://raw.githubusercontent.com/Cordwood/builds/master/index.js"
-};
console.log("ArmCord " + version);
ipcRenderer.on("themeLoader", (event, message) => {
@@ -48,19 +44,7 @@ if (window.location.href.indexOf("splash.html") > -1) {
sleep(5000).then(async () => {
const cssPath = path.join(__dirname, "../", "/content/css/discord.css");
addStyle(fs.readFileSync(cssPath, "utf8"));
-
- switch (ipcRenderer.sendSync("clientmod")) {
- case "goosemod":
- injectJS(clientMods.goosemod);
- console.log("Loading GooseMod...");
- await updateLang();
- break;
- case "cordwood":
- injectJS(clientMods.cordwood);
- console.log("Loading Cordwood...");
- await updateLang();
- break;
- }
+ await updateLang();
});
}
/*
diff --git a/src/settings/settings.html b/src/settings/settings.html
index e3aecbf..603d2cd 100644
--- a/src/settings/settings.html
+++ b/src/settings/settings.html
@@ -123,7 +123,8 @@
- GooseMod
+ Vencord
+ Shelter
None
@@ -131,8 +132,9 @@
Client mods are programs that allow you customize your Discord experience. They can change appearance of
the client, modify behaviours or add new features!
- GooseMod - light, secure, and easy to use, with out of the box experience. Features a built-in
- store for plugins.
+ Vencord - lightweight, and easy to use client mod. Features a built-in store for plugins.
+
+ Shelter - is a new generation client mod built to be essentially bulletproof.
diff --git a/src/utils.ts b/src/utils.ts
index 4714af5..07b2bd6 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -1,6 +1,10 @@
import * as fs from "fs";
-import {app, dialog} from "electron";
+import {app, dialog, session} from "electron";
import path from "path";
+import fetch from "node-fetch"
+import extract from "extract-zip"
+import util from "util"
+const streamPipeline = util.promisify(require('stream').pipeline)
export var firstRun: boolean;
export var contentPath: string;
export var transparency: boolean;
@@ -73,6 +77,7 @@ export function getDisplayVersion() {
}
}
export async function injectJS(inject: string) {
+
const js = await (await fetch(`${inject}`)).text();
const el = document.createElement("script");
@@ -252,11 +257,8 @@ export async function setConfig(object: string, toSet: any) {
fs.writeFileSync(getConfigLocation(), toSave, "utf-8");
}
export async function setConfigBulk(object: Settings) {
- const userDataPath = app.getPath("userData");
- const storagePath = path.join(userDataPath, "/storage/");
- const settingsFile = storagePath + "settings.json";
let toSave = JSON.stringify(object);
- fs.writeFileSync(settingsFile, toSave, "utf-8");
+ fs.writeFileSync(getConfigLocation(), toSave, "utf-8");
}
export async function checkIfConfigExists() {
const userDataPath = app.getPath("userData");
@@ -281,3 +283,69 @@ export async function checkIfConfigExists() {
}
}
}
+
+// Mods
+async function updateModBundle() {
+ try {
+ console.log("Downloading mod bundle")
+ const distFolder = app.getPath("userData") + "/plugins/loader/dist/";
+ while (!fs.existsSync(distFolder)){
+ //waiting
+ }
+ var name: string = await getConfig("mods")
+ const clientMods = {
+ vencord: "https://github.com/Vendicated/Vencord/releases/download/devbuild/browser.js",
+ cordwood: "https://raw.githubusercontent.com/Cordwood/builds/master/index.js",
+ shelter: "https://raw.githubusercontent.com/uwu/shelter-builds/main/shelter.js"
+ };
+ var bundle: string = await (await fetch(clientMods[name as keyof typeof clientMods])).text()
+ fs.writeFileSync(distFolder + "bundle.js", bundle, "utf-8");
+} catch (e) {
+ console.log("[Mod loader] Failed to install mods")
+ console.error(e)
+ dialog.showErrorBox(
+ "Oops, something went wrong.",
+ "ArmCord couldn't install mods, please check if you have stable internet connection and restart the app. If this issue persists, report it on the support server/Github issues."
+ );
+}
+}
+export var modInstallState: string;
+export async function installModLoader() {
+ if (await getConfig("mods") == "none") {
+ modInstallState = "none"
+ import("./extensions/plugin");
+ console.log("[Mod loader] Skipping")
+ } else {
+ const pluginFolder = app.getPath("userData") + "/plugins/";
+ if (!fs.existsSync(pluginFolder + "loader")) {
+ try {
+ modInstallState = "installing"
+ var zipPath = app.getPath("temp") + "/" + "loader.zip";
+ if (!fs.existsSync(pluginFolder)) {
+ fs.mkdirSync(pluginFolder);
+ console.log("[Mod loader] Created missing plugin folder");
+ }
+ var loaderZip = await fetch("https://armcord.xyz/loader.zip")
+ if (!loaderZip.ok) throw new Error(`unexpected response ${loaderZip.statusText}`)
+ await streamPipeline(loaderZip.body, fs.createWriteStream(zipPath))
+ await extract(zipPath, { dir: path.join(app.getPath("userData"), "plugins") })
+ modInstallState = "modDownload"
+ updateModBundle()
+ import("./extensions/plugin");
+ modInstallState = "done"
+ } catch(e) {
+ console.log("[Mod loader] Failed to install modloader")
+ console.error(e)
+ dialog.showErrorBox(
+ "Oops, something went wrong.",
+ "ArmCord couldn't install internal mod loader, please check if you have stable internet connection and restart the app. If this issue persists, report it on the support server/Github issues."
+ );
+ }
+ } else {
+ modInstallState = "modDownload"
+ updateModBundle()
+ import("./extensions/plugin");
+ modInstallState = "done"
+ }
+ }
+}
diff --git a/src/window.ts b/src/window.ts
index c645afa..5694bf3 100644
--- a/src/window.ts
+++ b/src/window.ts
@@ -12,7 +12,7 @@ import {
setConfig,
setLang,
setWindowState,
- transparency
+ transparency,
} from "./utils";
import {registerIpc} from "./ipc";
import {setMenu} from "./menu";
From a3eea0b6caca2eff42c97883e5551fc012979a73 Mon Sep 17 00:00:00 2001
From: Ven
Date: Sat, 19 Nov 2022 19:04:14 +0100
Subject: [PATCH 02/10] Fix about:blank popups (Vencord QuickCss) (#256)
---
src/window.ts | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/window.ts b/src/window.ts
index 5694bf3..ab7b21f 100644
--- a/src/window.ts
+++ b/src/window.ts
@@ -55,7 +55,7 @@ async function doAfterDefiningTheWindow() {
vibe.applyEffect(mainWindow, "acrylic");
vibe.setDarkMode(mainWindow);
mainWindow.show();
- });
+ });
}
var ignoreProtocolWarning = await getConfig("ignoreProtocolWarning");
await checkIfConfigIsBroken();
@@ -84,6 +84,9 @@ async function doAfterDefiningTheWindow() {
});
}
mainWindow.webContents.setWindowOpenHandler(({url}) => {
+ // Allow about:blank (used by Vencord QuickCss popup)
+ if (url === "about:blank") return { action: "allow" };
+
if (url.startsWith("https:" || url.startsWith("http:") || url.startsWith("mailto:"))) {
shell.openExternal(url);
} else {
@@ -137,7 +140,7 @@ async function doAfterDefiningTheWindow() {
favicon = nodeList[i].getAttribute("href");
}
}
- return favicon;
+ return favicon;
}
getFavicon()
`);
From cf4fe8e57ba732855d13f1b1c4f952e6bb09b088 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 19:24:33 +0100
Subject: [PATCH 03/10] Update vibe to hopefully fix builds
---
package.json | 2 +-
pnpm-lock.yaml | 27 +++++++++++++++------------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/package.json b/package.json
index a45b83e..9046bf9 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,7 @@
"typescript": "^4.7.3"
},
"dependencies": {
- "@pyke/vibe": "^0.3.1",
+ "@pyke/vibe": "github:pykeio/vibe",
"electron-context-menu": "github:ArmCord/electron-context-menu",
"extract-zip": "^2.0.1",
"node-fetch": "v2",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index dac7aec..df7a00c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1,7 +1,7 @@
lockfileVersion: 5.4
specifiers:
- '@pyke/vibe': ^0.3.1
+ '@pyke/vibe': github:pykeio/vibe
'@types/node': ^17.0.42
'@types/node-fetch': ^2.6.2
'@types/ws': ^8.5.3
@@ -20,7 +20,7 @@ specifiers:
ws: ^8.8.0
dependencies:
- '@pyke/vibe': 0.3.1_electron@20.3.1
+ '@pyke/vibe': github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae_electron@20.3.1
electron-context-menu: github.com/ArmCord/electron-context-menu/280c81398c02a063f46e3285a9708d8db1a7ce32
extract-zip: 2.0.1
node-fetch: 2.6.7
@@ -126,16 +126,6 @@ packages:
- supports-color
dev: true
- /@pyke/vibe/0.3.1_electron@20.3.1:
- resolution: {integrity: sha512-qgYtiN3cjJUdzBPHYXHILLiug//g1QXw7jLtDCi6HqCPxeIcn8zMslGlAAwS5i9e14UrHaSTUWkLEFEhWidfeQ==}
- requiresBuild: true
- peerDependencies:
- electron: '>=11.0'
- dependencies:
- cargo-cp-artifact: 0.1.6
- electron: 20.3.1
- dev: false
-
/@sindresorhus/is/0.14.0:
resolution: {integrity: sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==}
engines: {node: '>=6'}
@@ -2286,3 +2276,16 @@ packages:
electron-dl: 3.3.1
electron-is-dev: 2.0.0
dev: false
+
+ github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae_electron@20.3.1:
+ resolution: {tarball: https://codeload.github.com/pykeio/vibe/tar.gz/11984868ce9e007859ed91ff159c7f7f0a34e7ae}
+ id: github.com/pykeio/vibe/11984868ce9e007859ed91ff159c7f7f0a34e7ae
+ name: '@pyke/vibe'
+ version: 0.3.1
+ requiresBuild: true
+ peerDependencies:
+ electron: '>=11.0'
+ dependencies:
+ cargo-cp-artifact: 0.1.6
+ electron: 20.3.1
+ dev: false
From e5ab7a72320a773fa500091a9958d3eb6f4b9b85 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 19:32:46 +0100
Subject: [PATCH 04/10] Update transparency stuff
---
package.json | 2 +-
pnpm-lock.yaml | 2 +-
src/window.ts | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 9046bf9..98ed1b3 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,7 @@
"typescript": "^4.7.3"
},
"dependencies": {
- "@pyke/vibe": "github:pykeio/vibe",
+ "@pyke/vibe": "github:pykeio/vibe#11984868ce9e007859ed91ff159c7f7f0a34e7ae",
"electron-context-menu": "github:ArmCord/electron-context-menu",
"extract-zip": "^2.0.1",
"node-fetch": "v2",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index df7a00c..d4dd7f3 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1,7 +1,7 @@
lockfileVersion: 5.4
specifiers:
- '@pyke/vibe': github:pykeio/vibe
+ '@pyke/vibe': github:pykeio/vibe#11984868ce9e007859ed91ff159c7f7f0a34e7ae
'@types/node': ^17.0.42
'@types/node-fetch': ^2.6.2
'@types/ws': ^8.5.3
diff --git a/src/window.ts b/src/window.ts
index ab7b21f..e2fc8fe 100644
--- a/src/window.ts
+++ b/src/window.ts
@@ -53,7 +53,7 @@ async function doAfterDefiningTheWindow() {
if (transparency && process.platform === "win32") {
import("@pyke/vibe").then(vibe => {
vibe.applyEffect(mainWindow, "acrylic");
- vibe.setDarkMode(mainWindow);
+ vibe.forceTheme(mainWindow, 'dark');
mainWindow.show();
});
}
From dac886ecbde3557516fdb83342ffc59b6436a326 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 20:00:56 +0100
Subject: [PATCH 05/10] Windows on ARM CI
---
.github/workflows/winArm.yml | 38 ++++++++++++++++++++++++++++++++++++
src/settings/main.ts | 6 +++---
2 files changed, 41 insertions(+), 3 deletions(-)
create mode 100644 .github/workflows/winArm.yml
diff --git a/.github/workflows/winArm.yml b/.github/workflows/winArm.yml
new file mode 100644
index 0000000..dc1626a
--- /dev/null
+++ b/.github/workflows/winArm.yml
@@ -0,0 +1,38 @@
+name: Publish to WinGet
+on:
+ release:
+ types: [released]
+
+jobs:
+ build-windowsOnARM:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/setup-node@v3
+ with:
+ node-version: '18'
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Install pnpm
+ run: npm i -g pnpm && pnpm setup
+ - name: Set architecture
+ run: set npm_config_arch=arm64
+ - name: Install Node dependencies
+ run: pnpm install -g cargo-cp-artifact && pnpm install
+
+ - name: Install Electron-Builder
+ run: pnpm install -g electron-builder
+
+ - name: Build
+ run: npm run build && electron-builder --windows --arm64
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Delete unpacked builds
+ run: Remove-Item -LiteralPath ".\dist\win-unpacked" -Force -Recurse
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: ArmCordWindows
+ path: dist/
\ No newline at end of file
diff --git a/src/settings/main.ts b/src/settings/main.ts
index d2d8f42..a2b4983 100644
--- a/src/settings/main.ts
+++ b/src/settings/main.ts
@@ -74,15 +74,15 @@ export function createSettingsWindow() {
setConfigBulk(args);
});
ipcMain.on("openStorageFolder", async (event) => {
- shell.openPath(storagePath);
+ shell.showItemInFolder(storagePath);
await sleep(1000);
});
ipcMain.on("openThemesFolder", async (event) => {
- shell.openPath(themesPath);
+ shell.showItemInFolder(themesPath);
await sleep(1000);
});
ipcMain.on("openPluginsFolder", async (event) => {
- shell.openPath(pluginsPath);
+ shell.showItemInFolder(pluginsPath);
await sleep(1000);
});
ipcMain.on("getLangName", async (event) => {
From cdc331392eeca91e08bc1bd5daec6c8330b80d74 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 20:02:32 +0100
Subject: [PATCH 06/10] Update WinCI
---
.github/workflows/winArm.yml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/winArm.yml b/.github/workflows/winArm.yml
index dc1626a..3dd0dff 100644
--- a/.github/workflows/winArm.yml
+++ b/.github/workflows/winArm.yml
@@ -1,8 +1,8 @@
-name: Publish to WinGet
-on:
- release:
- types: [released]
-
+name: Windows on ARM
+on:
+ push:
+ branches:
+ - dev
jobs:
build-windowsOnARM:
runs-on: windows-latest
From a072e389a5b68ca4741dac484136a176712b69b6 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 20:05:28 +0100
Subject: [PATCH 07/10] Update winArm.yml
---
.github/workflows/winArm.yml | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/winArm.yml b/.github/workflows/winArm.yml
index 3dd0dff..4fafe99 100644
--- a/.github/workflows/winArm.yml
+++ b/.github/workflows/winArm.yml
@@ -14,11 +14,13 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
+
+ - name: Set architecture
+ run: set npm_config_arch=arm64
- name: Install pnpm
run: npm i -g pnpm && pnpm setup
- - name: Set architecture
- run: set npm_config_arch=arm64
+
- name: Install Node dependencies
run: pnpm install -g cargo-cp-artifact && pnpm install
@@ -35,4 +37,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: ArmCordWindows
- path: dist/
\ No newline at end of file
+ path: dist/
From e893675d6a978281ed54f5fd2bd5576f7de1a862 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 20:08:59 +0100
Subject: [PATCH 08/10] Update winArm.yml
---
.github/workflows/winArm.yml | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/winArm.yml b/.github/workflows/winArm.yml
index 4fafe99..f21f1c8 100644
--- a/.github/workflows/winArm.yml
+++ b/.github/workflows/winArm.yml
@@ -14,12 +14,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2
-
+
- name: Set architecture
run: set npm_config_arch=arm64
- - name: Install pnpm
- run: npm i -g pnpm && pnpm setup
+ - uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
- name: Install Node dependencies
run: pnpm install -g cargo-cp-artifact && pnpm install
From 0a77987cec66267b9d709bd857d888d3bdf2aff2 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 20:18:48 +0100
Subject: [PATCH 09/10] Delete winArm.yml
---
.github/workflows/winArm.yml | 39 ------------------------------------
1 file changed, 39 deletions(-)
delete mode 100644 .github/workflows/winArm.yml
diff --git a/.github/workflows/winArm.yml b/.github/workflows/winArm.yml
deleted file mode 100644
index f21f1c8..0000000
--- a/.github/workflows/winArm.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-name: Windows on ARM
-on:
- push:
- branches:
- - dev
-jobs:
- build-windowsOnARM:
- runs-on: windows-latest
-
- steps:
- - uses: actions/setup-node@v3
- with:
- node-version: '18'
-
- - name: Checkout code
- uses: actions/checkout@v2
-
- - name: Set architecture
- run: set npm_config_arch=arm64
-
- - uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
-
- - name: Install Node dependencies
- run: pnpm install -g cargo-cp-artifact && pnpm install
-
- - name: Install Electron-Builder
- run: pnpm install -g electron-builder
-
- - name: Build
- run: npm run build && electron-builder --windows --arm64
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Delete unpacked builds
- run: Remove-Item -LiteralPath ".\dist\win-unpacked" -Force -Recurse
- - name: Upload artifact
- uses: actions/upload-artifact@v2
- with:
- name: ArmCordWindows
- path: dist/
From d40b76719a348da2ff11a1d601a120f2f9198212 Mon Sep 17 00:00:00 2001
From: smartfridge <37928912+smartfrigde@users.noreply.github.com>
Date: Sat, 19 Nov 2022 20:18:59 +0100
Subject: [PATCH 10/10] Update dev.yml
---
.github/workflows/dev.yml | 35 ++++++++++++++++++++++++++++++++++-
1 file changed, 34 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml
index 0c540d3..b1429d2 100644
--- a/.github/workflows/dev.yml
+++ b/.github/workflows/dev.yml
@@ -113,7 +113,40 @@ jobs:
with:
name: ArmCordWindows.zip
path: dist/ArmCord-3.1.0-win.zip
-
+ build-windowsOnARM:
+ runs-on: windows-latest
+
+ steps:
+ - uses: actions/setup-node@v3
+ with:
+ node-version: '18'
+
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Set architecture
+ run: set npm_config_arch=arm64
+
+ - uses: pnpm/action-setup@v2 # Install pnpm using packageManager key in package.json
+
+ - name: Install Node dependencies
+ run: pnpm install -g cargo-cp-artifact && pnpm install
+
+ - name: Install Electron-Builder
+ run: pnpm install -g electron-builder
+
+ - name: Replace the version number
+ run: (Get-Content src/utils.ts) -replace "\d\.\d\.\d", "DEV" | Out-File src/utils.ts
+
+ - name: Build
+ run: npm run build && electron-builder --windows zip --arm64
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: ArmCordWindowsArm64.zip
+ path: dist/ArmCord-3.1.0-win.zip
release:
runs-on: ubuntu-latest