mirror of
https://github.com/Equicord/Equicord.git
synced 2025-02-21 23:58:52 -05:00
Updates
This commit is contained in:
commit
a64eae919a
20 changed files with 251 additions and 441 deletions
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
|
@ -38,7 +38,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v3
|
- uses: pnpm/action-setup@v3 # Install pnpm using packageManager key in package.json
|
||||||
|
|
||||||
- name: Use Node.js 20
|
- name: Use Node.js 20
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
|
@ -61,9 +61,26 @@ jobs:
|
||||||
- name: Generate Equicord plugin list
|
- name: Generate Equicord plugin list
|
||||||
run: pnpm generateEquicordPluginJson dist/equicordplugins.json
|
run: pnpm generateEquicordPluginJson dist/equicordplugins.json
|
||||||
|
|
||||||
- name: Clean up obsolete files
|
- name: Collect files to be released
|
||||||
run: |
|
run: |
|
||||||
rm -rf dist/*-unpacked dist/monaco Vencord.user.css vencordDesktopRenderer.css vencordDesktopRenderer.css.map
|
cd dist
|
||||||
|
mkdir release
|
||||||
|
|
||||||
|
cp browser/browser.* release
|
||||||
|
cp Vencord.user.{js,js.LEGAL.txt} release
|
||||||
|
|
||||||
|
# copy the plugin data jsons, the extension zips and the desktop/vesktop asars
|
||||||
|
cp *.{json,zip,asar} release
|
||||||
|
|
||||||
|
# legacy un-asared files
|
||||||
|
# FIXME: remove at some point
|
||||||
|
cp desktop/* release
|
||||||
|
for file in vesktop/*; do
|
||||||
|
filename=$(basename "$file")
|
||||||
|
cp "$file" "release/vencordDesktop${filename^}"
|
||||||
|
done
|
||||||
|
|
||||||
|
rm release/package.json
|
||||||
|
|
||||||
- name: Upload Equicord
|
- name: Upload Equicord
|
||||||
if: github.repository == 'Equicord/Equicord'
|
if: github.repository == 'Equicord/Equicord'
|
||||||
|
@ -75,13 +92,10 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "$USERNAME"
|
git config --global user.name "$USERNAME"
|
||||||
git config --global user.email "78185467+thororen1234@users.noreply.github.com"
|
git config --global user.email "78185467+thororen1234@users.noreply.github.com"
|
||||||
|
|
||||||
git clone https://$USERNAME:$API_TOKEN@github.com/$GH_REPO.git upload
|
git clone https://$USERNAME:$API_TOKEN@github.com/$GH_REPO.git upload
|
||||||
cd upload
|
cd upload
|
||||||
|
|
||||||
rm plugins.json
|
rm plugins.json
|
||||||
cp -r ../dist/equicordplugins.json plugins.json
|
cp -r ../dist/equicordplugins.json plugins.json
|
||||||
|
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "Plugins for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
|
git commit -m "Plugins for https://github.com/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
|
||||||
git push --force https://$USERNAME:$API_TOKEN@github.com/$GH_REPO.git
|
git push --force https://$USERNAME:$API_TOKEN@github.com/$GH_REPO.git
|
||||||
|
|
|
@ -21,7 +21,7 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
||||||
- Request for plugins from Discord.
|
- Request for plugins from Discord.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Extra included plugins (113 additional plugins)</summary>
|
<summary>Extra included plugins (110 additional plugins)</summary>
|
||||||
|
|
||||||
- AllCallTimers by MaxHerbold and D3SOX
|
- AllCallTimers by MaxHerbold and D3SOX
|
||||||
- AltKrispSwitch by newwares
|
- AltKrispSwitch by newwares
|
||||||
|
@ -85,7 +85,6 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
||||||
- MessageLoggerEnhanced by Aria
|
- MessageLoggerEnhanced by Aria
|
||||||
- MessageTranslate by Samwich
|
- MessageTranslate by Samwich
|
||||||
- ModalFade by Kyuuhachi
|
- ModalFade by Kyuuhachi
|
||||||
- ModViewBypass by Sqaaakoi
|
|
||||||
- NewPluginsManager by Sqaaakoi
|
- NewPluginsManager by Sqaaakoi
|
||||||
- noAppsAllowed by kvba
|
- noAppsAllowed by kvba
|
||||||
- NoBulletPoints by Samwich
|
- NoBulletPoints by Samwich
|
||||||
|
@ -123,10 +122,8 @@ An enhanced version of [Vencord](https://github.com/Vendicated/Vencord) by [Vend
|
||||||
- Title by Kyuuhachi
|
- Title by Kyuuhachi
|
||||||
- TosuRPC by AutumnVN
|
- TosuRPC by AutumnVN
|
||||||
- Translate+ by Prince527 (Using Translate by Ven)
|
- Translate+ by Prince527 (Using Translate by Ven)
|
||||||
- TriggerWarning by Joona
|
|
||||||
- UnlimitedAccounts by Balaclava and thororen
|
- UnlimitedAccounts by Balaclava and thororen
|
||||||
- UserPFP by nexpid and thororen
|
- UserPFP by nexpid and thororen
|
||||||
- UtilityDock by Samwich
|
|
||||||
- UwUifier by echo
|
- UwUifier by echo
|
||||||
- VCSupport by thororen
|
- VCSupport by thororen
|
||||||
- VencordRPC by AutumnVN
|
- VencordRPC by AutumnVN
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-spring/web": "^9.7.3",
|
"@react-spring/web": "^9.7.3",
|
||||||
|
"@electron/asar": "^3.2.10",
|
||||||
"@types/chrome": "^0.0.246",
|
"@types/chrome": "^0.0.246",
|
||||||
"@types/diff": "^5.0.3",
|
"@types/diff": "^5.0.3",
|
||||||
"@types/lodash": "^4.14.194",
|
"@types/lodash": "^4.14.194",
|
||||||
|
|
20
pnpm-lock.yaml
generated
20
pnpm-lock.yaml
generated
|
@ -59,6 +59,9 @@ importers:
|
||||||
specifier: ^1.0.1
|
specifier: ^1.0.1
|
||||||
version: 1.0.1
|
version: 1.0.1
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
'@electron/asar':
|
||||||
|
specifier: ^3.2.10
|
||||||
|
version: 3.2.10
|
||||||
'@react-spring/web':
|
'@react-spring/web':
|
||||||
specifier: ^9.7.3
|
specifier: ^9.7.3
|
||||||
version: 9.7.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
version: 9.7.3(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
|
||||||
|
@ -234,6 +237,11 @@ packages:
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
postcss-selector-parser: ^6.0.10
|
postcss-selector-parser: ^6.0.10
|
||||||
|
|
||||||
|
'@electron/asar@3.2.10':
|
||||||
|
resolution: {integrity: sha512-mvBSwIBUeiRscrCeJE1LwctAriBj65eUDm0Pc11iE5gRwzkmsdbS7FnZ1XUWjpSeQWL1L5g12Fc/SchPM9DUOw==}
|
||||||
|
engines: {node: '>=10.12.0'}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
'@esbuild-kit/cjs-loader@2.4.2':
|
'@esbuild-kit/cjs-loader@2.4.2':
|
||||||
resolution: {integrity: sha512-BDXFbYOJzT/NBEtp71cvsrGPwGAMGRB/349rwKuoxNSiKjPraNNnlK6MIIabViCjqZugu6j+xeMDlEkWdHHJSg==}
|
resolution: {integrity: sha512-BDXFbYOJzT/NBEtp71cvsrGPwGAMGRB/349rwKuoxNSiKjPraNNnlK6MIIabViCjqZugu6j+xeMDlEkWdHHJSg==}
|
||||||
|
|
||||||
|
@ -819,6 +827,10 @@ packages:
|
||||||
commander@2.20.3:
|
commander@2.20.3:
|
||||||
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
|
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
|
||||||
|
|
||||||
|
commander@5.1.0:
|
||||||
|
resolution: {integrity: sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==}
|
||||||
|
engines: {node: '>= 6'}
|
||||||
|
|
||||||
concat-map@0.0.1:
|
concat-map@0.0.1:
|
||||||
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
|
||||||
|
|
||||||
|
@ -2434,6 +2446,12 @@ snapshots:
|
||||||
dependencies:
|
dependencies:
|
||||||
postcss-selector-parser: 6.0.12
|
postcss-selector-parser: 6.0.12
|
||||||
|
|
||||||
|
'@electron/asar@3.2.10':
|
||||||
|
dependencies:
|
||||||
|
commander: 5.1.0
|
||||||
|
glob: 7.2.3
|
||||||
|
minimatch: 3.1.2
|
||||||
|
|
||||||
'@esbuild-kit/cjs-loader@2.4.2':
|
'@esbuild-kit/cjs-loader@2.4.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@esbuild-kit/core-utils': 3.1.0
|
'@esbuild-kit/core-utils': 3.1.0
|
||||||
|
@ -3030,6 +3048,8 @@ snapshots:
|
||||||
|
|
||||||
commander@2.20.3: {}
|
commander@2.20.3: {}
|
||||||
|
|
||||||
|
commander@5.1.0: {}
|
||||||
|
|
||||||
concat-map@0.0.1: {}
|
concat-map@0.0.1: {}
|
||||||
|
|
||||||
cosmiconfig@8.1.3:
|
cosmiconfig@8.1.3:
|
||||||
|
|
|
@ -17,8 +17,10 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { createPackage } from "@electron/asar";
|
||||||
import esbuild from "esbuild";
|
import esbuild from "esbuild";
|
||||||
import { readdir } from "fs/promises";
|
import { existsSync, readdirSync } from "fs";
|
||||||
|
import { readdir, rm, writeFile } from "fs/promises";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
|
|
||||||
import { BUILD_TIMESTAMP, commonOpts, exists, globPlugins, IS_DEV, IS_REPORTER, IS_STANDALONE, IS_UPDATER_DISABLED, resolvePluginName, VERSION, watch } from "./common.mjs";
|
import { BUILD_TIMESTAMP, commonOpts, exists, globPlugins, IS_DEV, IS_REPORTER, IS_STANDALONE, IS_UPDATER_DISABLED, resolvePluginName, VERSION, watch } from "./common.mjs";
|
||||||
|
@ -107,7 +109,7 @@ await Promise.all([
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
...nodeCommonOpts,
|
...nodeCommonOpts,
|
||||||
entryPoints: ["src/main/index.ts"],
|
entryPoints: ["src/main/index.ts"],
|
||||||
outfile: "dist/patcher.js",
|
outfile: "dist/desktop/patcher.js",
|
||||||
footer: { js: "//# sourceURL=VencordPatcher\n" + sourceMapFooter("patcher") },
|
footer: { js: "//# sourceURL=VencordPatcher\n" + sourceMapFooter("patcher") },
|
||||||
sourcemap,
|
sourcemap,
|
||||||
define: {
|
define: {
|
||||||
|
@ -124,7 +126,7 @@ await Promise.all([
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
...commonOpts,
|
...commonOpts,
|
||||||
entryPoints: ["src/Vencord.ts"],
|
entryPoints: ["src/Vencord.ts"],
|
||||||
outfile: "dist/renderer.js",
|
outfile: "dist/desktop/renderer.js",
|
||||||
format: "iife",
|
format: "iife",
|
||||||
target: ["esnext"],
|
target: ["esnext"],
|
||||||
footer: { js: "//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") },
|
footer: { js: "//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") },
|
||||||
|
@ -144,7 +146,7 @@ await Promise.all([
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
...nodeCommonOpts,
|
...nodeCommonOpts,
|
||||||
entryPoints: ["src/preload.ts"],
|
entryPoints: ["src/preload.ts"],
|
||||||
outfile: "dist/preload.js",
|
outfile: "dist/desktop/preload.js",
|
||||||
footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") },
|
footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") },
|
||||||
sourcemap,
|
sourcemap,
|
||||||
define: {
|
define: {
|
||||||
|
@ -159,8 +161,8 @@ await Promise.all([
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
...nodeCommonOpts,
|
...nodeCommonOpts,
|
||||||
entryPoints: ["src/main/index.ts"],
|
entryPoints: ["src/main/index.ts"],
|
||||||
outfile: "dist/vencordDesktopMain.js",
|
outfile: "dist/vesktop/main.js",
|
||||||
footer: { js: "//# sourceURL=VencordDesktopMain\n" + sourceMapFooter("vencordDesktopMain") },
|
footer: { js: "//# sourceURL=VencordMain\n" + sourceMapFooter("main") },
|
||||||
sourcemap,
|
sourcemap,
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
|
@ -176,10 +178,10 @@ await Promise.all([
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
...commonOpts,
|
...commonOpts,
|
||||||
entryPoints: ["src/Vencord.ts"],
|
entryPoints: ["src/Vencord.ts"],
|
||||||
outfile: "dist/vencordDesktopRenderer.js",
|
outfile: "dist/vesktop/renderer.js",
|
||||||
format: "iife",
|
format: "iife",
|
||||||
target: ["esnext"],
|
target: ["esnext"],
|
||||||
footer: { js: "//# sourceURL=VencordDesktopRenderer\n" + sourceMapFooter("vencordDesktopRenderer") },
|
footer: { js: "//# sourceURL=VencordRenderer\n" + sourceMapFooter("renderer") },
|
||||||
globalName: "Vencord",
|
globalName: "Vencord",
|
||||||
sourcemap,
|
sourcemap,
|
||||||
plugins: [
|
plugins: [
|
||||||
|
@ -196,8 +198,8 @@ await Promise.all([
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
...nodeCommonOpts,
|
...nodeCommonOpts,
|
||||||
entryPoints: ["src/preload.ts"],
|
entryPoints: ["src/preload.ts"],
|
||||||
outfile: "dist/vencordDesktopPreload.js",
|
outfile: "dist/vesktop/preload.js",
|
||||||
footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("vencordDesktopPreload") },
|
footer: { js: "//# sourceURL=VencordPreload\n" + sourceMapFooter("preload") },
|
||||||
sourcemap,
|
sourcemap,
|
||||||
define: {
|
define: {
|
||||||
...defines,
|
...defines,
|
||||||
|
@ -213,3 +215,38 @@ await Promise.all([
|
||||||
if (!commonOpts.watch)
|
if (!commonOpts.watch)
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
writeFile("dist/desktop/package.json", JSON.stringify({
|
||||||
|
name: "vencord",
|
||||||
|
main: "patcher.js"
|
||||||
|
})),
|
||||||
|
writeFile("dist/vesktop/package.json", JSON.stringify({
|
||||||
|
name: "vencord",
|
||||||
|
main: "main.js"
|
||||||
|
}))
|
||||||
|
]);
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
createPackage("dist/desktop", "dist/desktop.asar"),
|
||||||
|
createPackage("dist/vesktop", "dist/vesktop.asar")
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (existsSync("dist/renderer.js")) {
|
||||||
|
console.warn("Legacy dist folder. Cleaning up and adding shims.");
|
||||||
|
|
||||||
|
await Promise.all(
|
||||||
|
readdirSync("dist")
|
||||||
|
.filter(f =>
|
||||||
|
f.endsWith(".map") ||
|
||||||
|
f.endsWith(".LEGAL.txt") ||
|
||||||
|
["patcher", "preload", "renderer"].some(name => f.startsWith(name))
|
||||||
|
)
|
||||||
|
.map(file => rm(join("dist", file)))
|
||||||
|
);
|
||||||
|
|
||||||
|
await Promise.all([
|
||||||
|
writeFile("dist/patcher.js", 'require("./desktop.asar")'),
|
||||||
|
writeFile("dist/vencordDesktopMain.js", 'require("./vesktop.asar")')
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
|
@ -74,26 +74,26 @@ await Promise.all(
|
||||||
minify: true,
|
minify: true,
|
||||||
format: "iife",
|
format: "iife",
|
||||||
outbase: "node_modules/monaco-editor/esm/",
|
outbase: "node_modules/monaco-editor/esm/",
|
||||||
outdir: "dist/monaco"
|
outdir: "dist/browser/monaco"
|
||||||
}),
|
}),
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
entryPoints: ["browser/monaco.ts"],
|
entryPoints: ["browser/monaco.ts"],
|
||||||
bundle: true,
|
bundle: true,
|
||||||
minify: true,
|
minify: true,
|
||||||
format: "iife",
|
format: "iife",
|
||||||
outfile: "dist/monaco/index.js",
|
outfile: "dist/browser/monaco/index.js",
|
||||||
loader: {
|
loader: {
|
||||||
".ttf": "file"
|
".ttf": "file"
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
...commonOptions,
|
...commonOptions,
|
||||||
outfile: "dist/browser.js",
|
outfile: "dist/browser/browser.js",
|
||||||
footer: { js: "//# sourceURL=VencordWeb" }
|
footer: { js: "//# sourceURL=VencordWeb" }
|
||||||
}),
|
}),
|
||||||
esbuild.build({
|
esbuild.build({
|
||||||
...commonOptions,
|
...commonOptions,
|
||||||
outfile: "dist/extension.js",
|
outfile: "dist/browser/extension.js",
|
||||||
define: {
|
define: {
|
||||||
...commonOptions?.define,
|
...commonOptions?.define,
|
||||||
IS_EXTENSION: true,
|
IS_EXTENSION: true,
|
||||||
|
@ -149,9 +149,9 @@ async function loadDir(dir, basePath = "") {
|
||||||
*/
|
*/
|
||||||
async function buildExtension(target, files) {
|
async function buildExtension(target, files) {
|
||||||
const entries = {
|
const entries = {
|
||||||
"dist/Vencord.js": await readFile("dist/extension.js"),
|
"dist/Vencord.js": await readFile("dist/browser/extension.js"),
|
||||||
"dist/Vencord.css": await readFile("dist/extension.css"),
|
"dist/Vencord.css": await readFile("dist/browser/extension.css"),
|
||||||
...await loadDir("dist/monaco"),
|
...await loadDir("dist/browser/monaco"),
|
||||||
...Object.fromEntries(await Promise.all(RnNoiseFiles.map(async file =>
|
...Object.fromEntries(await Promise.all(RnNoiseFiles.map(async file =>
|
||||||
[`third-party/rnnoise/${file.replace(/^dist\//, "")}`, await readFile(`node_modules/@sapphi-red/web-noise-suppressor/${file}`)]
|
[`third-party/rnnoise/${file.replace(/^dist\//, "")}`, await readFile(`node_modules/@sapphi-red/web-noise-suppressor/${file}`)]
|
||||||
))),
|
))),
|
||||||
|
@ -172,13 +172,13 @@ async function buildExtension(target, files) {
|
||||||
|
|
||||||
await rm(target, { recursive: true, force: true });
|
await rm(target, { recursive: true, force: true });
|
||||||
await Promise.all(Object.entries(entries).map(async ([file, content]) => {
|
await Promise.all(Object.entries(entries).map(async ([file, content]) => {
|
||||||
const dest = join("dist", target, file);
|
const dest = join("dist/browser", target, file);
|
||||||
const parentDirectory = join(dest, "..");
|
const parentDirectory = join(dest, "..");
|
||||||
await mkdir(parentDirectory, { recursive: true });
|
await mkdir(parentDirectory, { recursive: true });
|
||||||
await writeFile(dest, content);
|
await writeFile(dest, content);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
console.info("Unpacked Extension written to dist/" + target);
|
console.info("Unpacked Extension written to dist/browser/" + target);
|
||||||
}
|
}
|
||||||
|
|
||||||
const appendCssRuntime = readFile("dist/Vencord.user.css", "utf-8").then(content => {
|
const appendCssRuntime = readFile("dist/Vencord.user.css", "utf-8").then(content => {
|
||||||
|
@ -201,12 +201,14 @@ if (!process.argv.includes("--skip-extension")) {
|
||||||
buildExtension("firefox-unpacked", ["background.js", "content.js", "manifestv2.json", "icon.png"]),
|
buildExtension("firefox-unpacked", ["background.js", "content.js", "manifestv2.json", "icon.png"]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Zip.sync.zip("dist/chromium-unpacked").compress().save("dist/extension-chrome.zip");
|
Zip.zip("dist/browser/chromium-unpacked", (_err, zip) => {
|
||||||
|
zip.compress().save("dist/extension-chrome.zip");
|
||||||
console.info("Packed Chromium Extension written to dist/extension-chrome.zip");
|
console.info("Packed Chromium Extension written to dist/extension-chrome.zip");
|
||||||
|
});
|
||||||
Zip.sync.zip("dist/firefox-unpacked").compress().save("dist/extension-firefox.zip");
|
Zip.zip("dist/browser/firefox-unpacked", (_err, zip) => {
|
||||||
|
zip.compress().save("dist/extension-firefox.zip");
|
||||||
console.info("Packed Firefox Extension written to dist/extension-firefox.zip");
|
console.info("Packed Firefox Extension written to dist/extension-firefox.zip");
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
await appendCssRuntime;
|
await appendCssRuntime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ import { Readable } from "stream";
|
||||||
import { finished } from "stream/promises";
|
import { finished } from "stream/promises";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
const BASE_URL = "https://github.com/Equicord/Installer/releases/latest/download/";
|
const BASE_URL = "https://github.com/Equicord/Equilotl/releases/latest/download/";
|
||||||
const INSTALLER_PATH_DARWIN = "EquicordInstaller.app/Contents/MacOS/EquicordInstaller";
|
const INSTALLER_PATH_DARWIN = "Equilotl.app/Contents/MacOS/Equilotl";
|
||||||
|
|
||||||
const BASE_DIR = join(dirname(fileURLToPath(import.meta.url)), "..");
|
const BASE_DIR = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||||
const FILE_DIR = join(BASE_DIR, "dist", "Installer");
|
const FILE_DIR = join(BASE_DIR, "dist", "Installer");
|
||||||
|
@ -35,11 +35,11 @@ const ETAG_FILE = join(FILE_DIR, "etag.txt");
|
||||||
function getFilename() {
|
function getFilename() {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case "win32":
|
case "win32":
|
||||||
return "EquicordInstallerCli.exe";
|
return "EquilotlCli.exe";
|
||||||
case "darwin":
|
case "darwin":
|
||||||
return "EquicordInstaller.MacOS.zip";
|
return "Equilotl.MacOS.zip";
|
||||||
case "linux":
|
case "linux":
|
||||||
return "EquicordInstallerCli-linux";
|
return "EquilotlCli-linux";
|
||||||
default:
|
default:
|
||||||
throw new Error("Unsupported platform: " + process.platform);
|
throw new Error("Unsupported platform: " + process.platform);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ async function ensureBinary() {
|
||||||
|
|
||||||
const downloadName = join(FILE_DIR, filename);
|
const downloadName = join(FILE_DIR, filename);
|
||||||
const outputFile = process.platform === "darwin"
|
const outputFile = process.platform === "darwin"
|
||||||
? join(FILE_DIR, "EquicordInstaller")
|
? join(FILE_DIR, "Equilotl")
|
||||||
: downloadName;
|
: downloadName;
|
||||||
|
|
||||||
const etag = existsSync(outputFile) && existsSync(ETAG_FILE)
|
const etag = existsSync(outputFile) && existsSync(ETAG_FILE)
|
||||||
|
@ -96,7 +96,7 @@ async function ensureBinary() {
|
||||||
execSync(cmd);
|
execSync(cmd);
|
||||||
} catch { }
|
} catch { }
|
||||||
};
|
};
|
||||||
logAndRun(`sudo spctl --add '${outputFile}' --label "Equicord Installer"`);
|
logAndRun(`sudo spctl --add '${outputFile}' --label "Equilotl"`);
|
||||||
logAndRun(`sudo xattr -d com.apple.quarantine '${outputFile}'`);
|
logAndRun(`sudo xattr -d com.apple.quarantine '${outputFile}'`);
|
||||||
} else {
|
} else {
|
||||||
// WHY DOES NODE FETCH RETURN A WEB STREAM OH MY GOD
|
// WHY DOES NODE FETCH RETURN A WEB STREAM OH MY GOD
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a Discord client mod
|
|
||||||
* Copyright (c) 2024 Vendicated and contributors
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
import definePlugin from "@utils/types";
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "ModViewBypass",
|
|
||||||
description: "Open the mod view sidebar in guilds you don't have moderator permissions in, or where the experiment is disabled.",
|
|
||||||
authors: [Devs.Sqaaakoi],
|
|
||||||
patches: [
|
|
||||||
{
|
|
||||||
find: "canAccessGuildMemberModViewWithExperiment:",
|
|
||||||
replacement: {
|
|
||||||
match: /canAccessGuildMemberModViewWithExperiment:function\(\){return\s\i/,
|
|
||||||
replace: "canAccessGuildMemberModViewWithExperiment:function(){return ()=>true;",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: "useCanAccessGuildMemberModView:",
|
|
||||||
replacement: {
|
|
||||||
match: /\i.default.hasAny\(/,
|
|
||||||
replace: "true; (",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: "isInGuildMemberModViewExperiment:",
|
|
||||||
replacement: {
|
|
||||||
match: /isInGuildMemberModViewExperiment:function\(\){return\s\i/,
|
|
||||||
replace: "isInGuildMemberModViewExperiment:function(){return ()=>true;",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
find: "useGuildMemberModViewExperiment:",
|
|
||||||
replacement: {
|
|
||||||
match: /useGuildMemberModViewExperiment:function\(\){return\s\i/,
|
|
||||||
replace: "useGuildMemberModViewExperiment:function(){return ()=>true;",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
|
@ -13,13 +13,6 @@ export default definePlugin({
|
||||||
authors: [EquicordDevs.kvba],
|
authors: [EquicordDevs.kvba],
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
|
||||||
find: "\"APP_TAG\"",
|
|
||||||
replacement: {
|
|
||||||
match: /"APP_TAG":".*?"/,
|
|
||||||
replace: "\"APP_TAG\":\"BOT\""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
find: ",APP_TAG:\"",
|
find: ",APP_TAG:\"",
|
||||||
replacement: {
|
replacement: {
|
||||||
|
|
|
@ -29,7 +29,7 @@ export default definePlugin({
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "Messages.ACCOUNT_A11Y_LABEL",
|
find: "isFullscreenInContext());",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=function)( \i\i\(\i\)(?={).)(.{0,1000}\i\.\i\.isFullscreenInContext\(\).+?\)]}\))\}/,
|
match: /(?<=function)( \i\i\(\i\)(?={).)(.{0,1000}\i\.\i\.isFullscreenInContext\(\).+?\)]}\))\}/,
|
||||||
replace: "$1 return $self.replacedUserPanelComponent(function(){$2}, this, arguments)}"
|
replace: "$1 return $self.replacedUserPanelComponent(function(){$2}, this, arguments)}"
|
||||||
|
|
|
@ -62,13 +62,12 @@ export default definePlugin({
|
||||||
name: "TextToSpeech",
|
name: "TextToSpeech",
|
||||||
description: "Reads out chat messages with openai tts",
|
description: "Reads out chat messages with openai tts",
|
||||||
authors: [Devs.Samwich],
|
authors: [Devs.Samwich],
|
||||||
flux:
|
flux: {
|
||||||
{
|
|
||||||
async MESSAGE_CREATE({ optimistic, type, message, channelId }) {
|
async MESSAGE_CREATE({ optimistic, type, message, channelId }) {
|
||||||
if (optimistic || type !== "MESSAGE_CREATE") return;
|
if (optimistic || type !== "MESSAGE_CREATE") return;
|
||||||
if (message.state === "SENDING") return;
|
if (message.state === "SENDING") return;
|
||||||
if (!message.content) return;
|
if (!message.content) return;
|
||||||
if (message.channel_id !== getCurrentChannel().id) return;
|
if (message.channel_id !== getCurrentChannel()?.id ?? 0) return;
|
||||||
|
|
||||||
readOutText(message.content);
|
readOutText(message.content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a Discord client mod
|
|
||||||
* Copyright (c) 2024 Vendicated and contributors
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { definePluginSettings } from "@api/Settings";
|
|
||||||
import { EquicordDevs } from "@utils/constants";
|
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
|
||||||
spoilerFilenames: {
|
|
||||||
description: "Strings in filenames that should be spoilered. Comma separated.",
|
|
||||||
type: OptionType.STRING,
|
|
||||||
default: "",
|
|
||||||
},
|
|
||||||
spoilerLinks: {
|
|
||||||
description: "Strings in link attachments that should be spoilered. Comma separated.",
|
|
||||||
type: OptionType.STRING,
|
|
||||||
default: ""
|
|
||||||
},
|
|
||||||
gifSpoilersOnly: {
|
|
||||||
description: "Should the links only be gifs?",
|
|
||||||
type: OptionType.BOOLEAN,
|
|
||||||
default: true
|
|
||||||
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "TriggerWarning",
|
|
||||||
authors: [EquicordDevs.Joona],
|
|
||||||
description: "Spoiler attachments based on filenames and links.",
|
|
||||||
patches: [
|
|
||||||
{
|
|
||||||
find: "SimpleMessageAccessories:",
|
|
||||||
replacement: [
|
|
||||||
{
|
|
||||||
match: /function \i\((\i),\i\){return/,
|
|
||||||
replace: "$& $self.shouldSpoiler($1.originalItem.filename) || "
|
|
||||||
},
|
|
||||||
{
|
|
||||||
match: /(\i)=\(0,\i\.getOb.{27,35}\);(?=if\((\i).type)/,
|
|
||||||
replace: "$&$1=$self.spoilerLink($1,$2.url,$2.type);"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
settings,
|
|
||||||
shouldSpoiler(filename: string): string | null {
|
|
||||||
const { spoilerFilenames } = settings.store;
|
|
||||||
if (!filename || !spoilerFilenames) return null;
|
|
||||||
const strings = spoilerFilenames.split(",").map(s => s.trim());
|
|
||||||
return strings.some(s => filename.includes(s)) ? "spoiler" : null;
|
|
||||||
},
|
|
||||||
spoilerLink(alreadySpoilered: string, link: string, type: string): string | null {
|
|
||||||
if (alreadySpoilered) return alreadySpoilered;
|
|
||||||
const { spoilerLinks, gifSpoilersOnly } = settings.store;
|
|
||||||
if (!link || !spoilerLinks) return null;
|
|
||||||
|
|
||||||
const strings = spoilerLinks.split(",").map(s => s.trim());
|
|
||||||
const isLinkSpoiler = strings.some(s => link.includes(s));
|
|
||||||
|
|
||||||
if (gifSpoilersOnly) {
|
|
||||||
return type === "gifv" && isLinkSpoiler ? "spoiler" : null;
|
|
||||||
} else {
|
|
||||||
return isLinkSpoiler ? "spoiler" : null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,147 +0,0 @@
|
||||||
/*
|
|
||||||
* Vencord, a modification for Discord's desktop app
|
|
||||||
* Copyright (c) 2023 Vendicated and contributors
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Settings } from "@api/Settings";
|
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
|
||||||
import { Devs } from "@utils/constants";
|
|
||||||
import definePlugin from "@utils/types";
|
|
||||||
import { findExportedComponentLazy } from "@webpack";
|
|
||||||
import { Menu, Popout, useState } from "@webpack/common";
|
|
||||||
import type { ReactNode } from "react";
|
|
||||||
|
|
||||||
function toggle(name: string, onClose: () => void) {
|
|
||||||
Settings.plugins.TextModifiers[name] = !Settings.plugins.TextModifiers[name];
|
|
||||||
onClose();
|
|
||||||
}
|
|
||||||
function isEnabled(name: string) {
|
|
||||||
return Settings.plugins.TextModifiers[name];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const HeaderBarIcon = findExportedComponentLazy("Icon", "Divider");
|
|
||||||
|
|
||||||
|
|
||||||
function utilityDockPopout(onClose: () => void) {
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Menu.Menu
|
|
||||||
navId="utilityDock"
|
|
||||||
onClose={onClose}
|
|
||||||
>
|
|
||||||
<Menu.MenuCheckboxItem
|
|
||||||
id="utilityDock-quickcss-toggle"
|
|
||||||
checked={Settings.useQuickCss}
|
|
||||||
label={"QuickCSS"}
|
|
||||||
action={() => {
|
|
||||||
Settings.useQuickCss = !Settings.useQuickCss;
|
|
||||||
onClose();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Menu.MenuItem
|
|
||||||
id="utilityDock-quickcss"
|
|
||||||
label="Edit QuickCSS"
|
|
||||||
action={() => VencordNative.quickCss.openEditor()}
|
|
||||||
/>
|
|
||||||
</Menu.Menu>
|
|
||||||
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function utilityDockIcon(isShown: boolean) {
|
|
||||||
return (
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width={24} height={24}>
|
|
||||||
<path fill="currentColor" d={isShown ?
|
|
||||||
|
|
||||||
"M20 8H17V6C17 4.9 16.1 4 15 4H9C7.9 4 7 4.9 7 6V8H4C2.9 8 2 8.9 2 10V20H22V10C22 8.9 21.1 8 20 8M9 6H15V8H9V6M20 18H4V15H6V16H8V15H16V16H18V15H20V18M18 13V12H16V13H8V12H6V13H4V10H20V13H18Z"
|
|
||||||
:
|
|
||||||
"M18 16H16V15H8V16H6V15H2V20H22V15H18V16M20 8H17V6C17 4.9 16.1 4 15 4H9C7.9 4 7 4.9 7 6V8H4C2.9 8 2 8.9 2 10V14H6V12H8V14H16V12H18V14H22V10C22 8.9 21.1 8 20 8M15 8H9V6H15V8Z"} />
|
|
||||||
</svg>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function VencordPopoutButton() {
|
|
||||||
const [show, setShow] = useState(false);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Popout
|
|
||||||
position="bottom"
|
|
||||||
align="right"
|
|
||||||
animation={Popout.Animation.NONE}
|
|
||||||
shouldShow={show}
|
|
||||||
onRequestClose={() => setShow(false)}
|
|
||||||
renderPopout={() => utilityDockPopout(() => setShow(false))}
|
|
||||||
>
|
|
||||||
{(_, { isShown }) => (
|
|
||||||
<HeaderBarIcon
|
|
||||||
className="vc-toolbox-btn"
|
|
||||||
onClick={() => setShow(v => !v)}
|
|
||||||
tooltip={isShown ? null : "Utility Dock"}
|
|
||||||
icon={() => utilityDockIcon(isShown)}
|
|
||||||
selected={isShown}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Popout>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function utilityDock({ children }: { children: ReactNode[]; }) {
|
|
||||||
children.splice(
|
|
||||||
children.length - 1, 0,
|
|
||||||
<ErrorBoundary noop={true}>
|
|
||||||
<VencordPopoutButton />
|
|
||||||
</ErrorBoundary>
|
|
||||||
);
|
|
||||||
|
|
||||||
return <>{children}</>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default definePlugin({
|
|
||||||
name: "UtilityDock",
|
|
||||||
description: "Adds a button on your titlebar with multiple useful features",
|
|
||||||
authors: [Devs.Samwich],
|
|
||||||
|
|
||||||
patches: [
|
|
||||||
{
|
|
||||||
find: "toolbar:function",
|
|
||||||
replacement: {
|
|
||||||
match: /(?<=toolbar:function.{0,100}\()\i.Fragment,/,
|
|
||||||
replace: "$self.utilityDock,"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
utilityDock: ErrorBoundary.wrap(utilityDock, {
|
|
||||||
fallback: () => <p style={{ color: "red" }}>Failed to render :(</p>
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
export function TextPlugin({ pluginName, onClose }) {
|
|
||||||
return (
|
|
||||||
<Menu.MenuCheckboxItem
|
|
||||||
id={`vc-toolbox-${pluginName}-toggle`}
|
|
||||||
checked={Settings.plugins[pluginName].enabled}
|
|
||||||
label={pluginName}
|
|
||||||
action={() => {
|
|
||||||
Settings.plugins[pluginName].isEnabled = !Settings.plugins[pluginName].isEnabled;
|
|
||||||
onClose();
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
@ -43,11 +43,9 @@ if (IS_VESKTOP || !IS_VANILLA) {
|
||||||
}
|
}
|
||||||
switch (url) {
|
switch (url) {
|
||||||
case "renderer.js.map":
|
case "renderer.js.map":
|
||||||
case "vencordDesktopRenderer.js.map":
|
|
||||||
case "preload.js.map":
|
case "preload.js.map":
|
||||||
case "vencordDesktopPreload.js.map":
|
|
||||||
case "patcher.js.map":
|
case "patcher.js.map":
|
||||||
case "vencordDesktopMain.js.map":
|
case "main.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, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js"),
|
preload: join(__dirname, "preload.js"),
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
sandbox: false
|
sandbox: false
|
||||||
|
|
|
@ -26,14 +26,18 @@ import { IS_VANILLA } from "./utils/constants";
|
||||||
|
|
||||||
console.log("[Equicord] Starting up...");
|
console.log("[Equicord] Starting up...");
|
||||||
|
|
||||||
|
// FIXME: remove at some point
|
||||||
|
const isLegacyNonAsarVencord = IS_STANDALONE && !__dirname.endsWith(".asar");
|
||||||
|
if (isLegacyNonAsarVencord) {
|
||||||
|
console.warn("This is a legacy non asar install! Migrating to asar and restarting...");
|
||||||
|
require("./updater/http").migrateLegacyToAsar();
|
||||||
|
}
|
||||||
|
|
||||||
// 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), "..", asarName);
|
const asarPath = join(dirname(injectorPath), "..", "_app.asar");
|
||||||
|
|
||||||
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);
|
||||||
|
@ -41,7 +45,7 @@ require.main!.filename = join(asarPath, discordPkg.main);
|
||||||
// @ts-ignore Untyped method? Dies from cringe
|
// @ts-ignore Untyped method? Dies from cringe
|
||||||
app.setAppPath(asarPath);
|
app.setAppPath(asarPath);
|
||||||
|
|
||||||
if (!IS_VANILLA) {
|
if (!IS_VANILLA && !isLegacyNonAsarVencord) {
|
||||||
const settings = RendererSettings.store;
|
const settings = RendererSettings.store;
|
||||||
// Repatch after host updates on Windows
|
// Repatch after host updates on Windows
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
|
@ -71,7 +75,7 @@ if (!IS_VANILLA) {
|
||||||
constructor(options: BrowserWindowConstructorOptions) {
|
constructor(options: BrowserWindowConstructorOptions) {
|
||||||
if (options?.webPreferences?.preload && options.title) {
|
if (options?.webPreferences?.preload && options.title) {
|
||||||
const original = options.webPreferences.preload;
|
const original = options.webPreferences.preload;
|
||||||
options.webPreferences.preload = join(__dirname, IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js");
|
options.webPreferences.preload = join(__dirname, "preload.js");
|
||||||
options.webPreferences.sandbox = false;
|
options.webPreferences.sandbox = false;
|
||||||
// work around discord unloading when in background
|
// work around discord unloading when in background
|
||||||
options.webPreferences.backgroundThrottling = false;
|
options.webPreferences.backgroundThrottling = false;
|
||||||
|
@ -157,5 +161,7 @@ if (!IS_VANILLA) {
|
||||||
console.log("[Equicord] Running in vanilla mode. Not loading Equicord");
|
console.log("[Equicord] Running in vanilla mode. Not loading Equicord");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isLegacyNonAsarVencord) {
|
||||||
console.log("[Equicord] Loading original Discord app.asar");
|
console.log("[Equicord] Loading original Discord app.asar");
|
||||||
require(require.main!.filename);
|
require(require.main!.filename);
|
||||||
|
}
|
||||||
|
|
|
@ -16,12 +16,9 @@
|
||||||
* 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 VENCORD_FILES = [
|
export const ASAR_FILE = IS_VESKTOP
|
||||||
IS_DISCORD_DESKTOP ? "patcher.js" : "vencordDesktopMain.js",
|
? "vesktop.asar"
|
||||||
IS_DISCORD_DESKTOP ? "preload.js" : "vencordDesktopPreload.js",
|
: "desktop.asar";
|
||||||
IS_DISCORD_DESKTOP ? "renderer.js" : "vencordDesktopRenderer.js",
|
|
||||||
IS_DISCORD_DESKTOP ? "renderer.css" : "vencordDesktopRenderer.css",
|
|
||||||
];
|
|
||||||
|
|
||||||
export function serializeErrors(func: (...args: any[]) => any) {
|
export function serializeErrors(func: (...args: any[]) => any) {
|
||||||
return async function () {
|
return async function () {
|
||||||
|
|
|
@ -18,25 +18,21 @@
|
||||||
|
|
||||||
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 axios from "axios";
|
import { app, dialog, ipcMain } from "electron";
|
||||||
import { ipcMain } from "electron";
|
import { writeFileSync as originalWriteFileSync } from "original-fs";
|
||||||
import { writeFile } from "fs/promises";
|
|
||||||
import { join } from "path";
|
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 { serializeErrors, VENCORD_FILES } from "./common";
|
import { get } from "../utils/simpleGet";
|
||||||
|
import { ASAR_FILE, serializeErrors } from "./common";
|
||||||
|
|
||||||
const API_BASE = `https://api.github.com/repos/${gitRemote}`;
|
const API_BASE = `https://api.github.com/repos/${gitRemote}`;
|
||||||
let PendingUpdates = [] as [string, string][];
|
let PendingUpdate: string | null = null;
|
||||||
|
|
||||||
async function githubGet(endpoint: string) {
|
async function githubGet(endpoint: string) {
|
||||||
return axios({
|
return get(API_BASE + endpoint, {
|
||||||
method: "get",
|
|
||||||
responseType: "json",
|
|
||||||
url: API_BASE + endpoint,
|
|
||||||
headers: {
|
headers: {
|
||||||
Accept: "application/vnd.github+json",
|
Accept: "application/vnd.github+json",
|
||||||
// "All API requests MUST include a valid User-Agent header.
|
// "All API requests MUST include a valid User-Agent header.
|
||||||
|
@ -52,7 +48,8 @@ async function calculateGitChanges() {
|
||||||
|
|
||||||
const res = await githubGet(`/compare/${gitHash}...HEAD`);
|
const res = await githubGet(`/compare/${gitHash}...HEAD`);
|
||||||
|
|
||||||
return res.data.commits.map((c: any) => ({
|
const data = JSON.parse(res.toString("utf-8"));
|
||||||
|
return data.commits.map((c: any) => ({
|
||||||
// github api only sends the long sha
|
// github api only sends the long sha
|
||||||
hash: c.sha.slice(0, 7),
|
hash: c.sha.slice(0, 7),
|
||||||
author: c.author.login,
|
author: c.author.login,
|
||||||
|
@ -63,32 +60,26 @@ async function calculateGitChanges() {
|
||||||
async function fetchUpdates() {
|
async function fetchUpdates() {
|
||||||
const release = await githubGet("/releases/latest");
|
const release = await githubGet("/releases/latest");
|
||||||
|
|
||||||
const hash = release.data.name.slice(release.data.name.lastIndexOf(" ") + 1);
|
const data = JSON.parse(release.toString());
|
||||||
|
const hash = data.name.slice(data.name.lastIndexOf(" ") + 1);
|
||||||
if (hash === gitHash)
|
if (hash === gitHash)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
release.data.assets.forEach(({ name, browser_download_url }) => {
|
|
||||||
if (VENCORD_FILES.some(s => name.startsWith(s))) {
|
const asset = data.assets.find(a => a.name === ASAR_FILE);
|
||||||
PendingUpdates.push([name, browser_download_url]);
|
PendingUpdate = asset.browser_download_url;
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function applyUpdates() {
|
async function applyUpdates() {
|
||||||
await Promise.all(PendingUpdates.map(
|
if (!PendingUpdate) return true;
|
||||||
async ([name, data]) => {
|
|
||||||
writeFile(
|
const data = await get(PendingUpdate);
|
||||||
join(__dirname, name),
|
originalWriteFileSync(__dirname, data);
|
||||||
(await axios({
|
|
||||||
method: "get",
|
PendingUpdate = null;
|
||||||
responseType: "arraybuffer",
|
|
||||||
url: data,
|
|
||||||
})).data
|
|
||||||
);
|
|
||||||
}
|
|
||||||
));
|
|
||||||
PendingUpdates = [];
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,3 +87,28 @@ ipcMain.handle(IpcEvents.GET_REPO, serializeErrors(() => `https://github.com/${g
|
||||||
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
|
ipcMain.handle(IpcEvents.GET_UPDATES, serializeErrors(calculateGitChanges));
|
||||||
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));
|
ipcMain.handle(IpcEvents.UPDATE, serializeErrors(fetchUpdates));
|
||||||
ipcMain.handle(IpcEvents.BUILD, serializeErrors(applyUpdates));
|
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, "../vencord.asar"), data);
|
||||||
|
originalWriteFileSync(__filename, '// Legacy shim for new asar\n\nrequire("../vencord.asar");');
|
||||||
|
|
||||||
|
app.relaunch();
|
||||||
|
app.exit();
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Failed to migrate to asar", e);
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
dialog.showErrorBox(
|
||||||
|
"Legacy Install",
|
||||||
|
"The way Vencord loaded was changed and the updater failed to migrate. Please reinstall using the Vencord Installer!"
|
||||||
|
);
|
||||||
|
app.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import axios from "axios";
|
|
||||||
import { session } from "electron";
|
import { session } from "electron";
|
||||||
import { unzip } from "fflate";
|
import { unzip } from "fflate";
|
||||||
import { constants as fsConstants } from "fs";
|
import { constants as fsConstants } from "fs";
|
||||||
|
@ -25,6 +24,7 @@ import { join } from "path";
|
||||||
|
|
||||||
import { DATA_DIR } from "./constants";
|
import { DATA_DIR } from "./constants";
|
||||||
import { crxToZip } from "./crxToZip";
|
import { crxToZip } from "./crxToZip";
|
||||||
|
import { get } from "./simpleGet";
|
||||||
|
|
||||||
const extensionCacheDir = join(DATA_DIR, "ExtensionCache");
|
const extensionCacheDir = join(DATA_DIR, "ExtensionCache");
|
||||||
|
|
||||||
|
@ -73,15 +73,12 @@ export async function installExt(id: string) {
|
||||||
// Unfortunately, Google does not serve old versions, so this is the only way
|
// Unfortunately, Google does not serve old versions, so this is the only way
|
||||||
? "https://raw.githubusercontent.com/Vendicated/random-files/f6f550e4c58ac5f2012095a130406c2ab25b984d/fmkadmapgofadopljbjfkapdkoienihi.zip"
|
? "https://raw.githubusercontent.com/Vendicated/random-files/f6f550e4c58ac5f2012095a130406c2ab25b984d/fmkadmapgofadopljbjfkapdkoienihi.zip"
|
||||||
: `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=32`;
|
: `https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&x=id%3D${id}%26uc&prodversion=32`;
|
||||||
const response = await axios({
|
const buf = await get(url, {
|
||||||
method: "get",
|
|
||||||
responseType: "blob",
|
|
||||||
url: url,
|
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": "Vencord (https://github.com/Vendicated/Vencord)"
|
"User-Agent": "Equicord (https://github.com/Equicord/Equicord)"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await extract(crxToZip(Buffer.from(response.data, "binary")), extDir).catch(console.error);
|
await extract(crxToZip(buf), extDir).catch(console.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
session.defaultSession.loadExtension(extDir);
|
session.defaultSession.loadExtension(extDir);
|
||||||
|
|
|
@ -28,13 +28,7 @@ contextBridge.exposeInMainWorld("VencordNative", VencordNative);
|
||||||
// Discord
|
// Discord
|
||||||
if (location.protocol !== "data:") {
|
if (location.protocol !== "data:") {
|
||||||
// #region cssInsert
|
// #region cssInsert
|
||||||
let rendererPath;
|
const rendererCss = join(__dirname, "renderer.css");
|
||||||
if (IS_VESKTOP || IS_EQUIBOP) {
|
|
||||||
rendererPath = "vencordDesktopRenderer.css";
|
|
||||||
} else {
|
|
||||||
rendererPath = "renderer.css";
|
|
||||||
}
|
|
||||||
const rendererCss = join(__dirname, rendererPath);
|
|
||||||
|
|
||||||
const style = document.createElement("style");
|
const style = document.createElement("style");
|
||||||
style.id = "vencord-css-core";
|
style.id = "vencord-css-core";
|
||||||
|
|
Loading…
Add table
Reference in a new issue