mirror of
https://git.1024x2.xyz/1024x2/vexcord.git
synced 2025-04-12 01:46:30 +02:00
Add initial Vextop patchset and script
This commit is contained in:
parent
157fb107d8
commit
fdc58caecc
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
Vencord
|
||||
Vesktop
|
||||
|
@ -0,0 +1,103 @@
|
||||
From 075f1ff4d817086f72c197f7f7a7b48e04d24c28 Mon Sep 17 00:00:00 2001
|
||||
From: 1024x2 <2pow11@gmail.com>
|
||||
Date: Tue, 13 Aug 2024 20:11:12 +0100
|
||||
Subject: [PATCH 1/3] Venmic: Build from Git sources instead of using prebuilts
|
||||
|
||||
have we learned nothing from jia tan?????
|
||||
---
|
||||
package.json | 2 +-
|
||||
pnpm-lock.yaml | 11 ++++++-----
|
||||
scripts/build/build.mts | 14 ++++----------
|
||||
src/main/venmic.ts | 2 +-
|
||||
4 files changed, 12 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/package.json b/package.json
|
||||
index ca5cf49..3c2b1e7 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -28,7 +28,7 @@
|
||||
"electron-updater": "^6.2.1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
- "@vencord/venmic": "^6.1.0"
|
||||
+ "@vencord/venmic": "github:vencord/Venmic#5481a9277da95656c79ae69c4ea1146ce10cc2d7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fal-works/esbuild-plugin-global-externals": "^2.1.2",
|
||||
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
|
||||
index e67ad18..ce125a4 100644
|
||||
--- a/pnpm-lock.yaml
|
||||
+++ b/pnpm-lock.yaml
|
||||
@@ -21,8 +21,8 @@ importers:
|
||||
version: 6.2.1
|
||||
optionalDependencies:
|
||||
'@vencord/venmic':
|
||||
- specifier: ^6.1.0
|
||||
- version: 6.1.0
|
||||
+ specifier: github:vencord/Venmic#5481a9277da95656c79ae69c4ea1146ce10cc2d7
|
||||
+ version: https://codeload.github.com/vencord/Venmic/tar.gz/5481a9277da95656c79ae69c4ea1146ce10cc2d7
|
||||
devDependencies:
|
||||
'@fal-works/esbuild-plugin-global-externals':
|
||||
specifier: ^2.1.2
|
||||
@@ -634,8 +634,9 @@ packages:
|
||||
'@vencord/types@1.8.4':
|
||||
resolution: {integrity: sha512-ogLqIOHVO+5zxKUVxAfGIAUZoEfIomrlg6f0cZ/2yd5vBAn1fA9Gi/NASoKfHZuJt8ZcYw329bgn0ah/VufqMg==}
|
||||
|
||||
- '@vencord/venmic@6.1.0':
|
||||
- resolution: {integrity: sha512-YiCtzml/W8tYbGhu3jm5jfbbEnl2slKKARNK0jO+8qV979k9eFnfIRTxvhMN/SWq1h8ZNJdXVwvXpffQwq0RuA==}
|
||||
+ '@vencord/venmic@https://codeload.github.com/vencord/Venmic/tar.gz/5481a9277da95656c79ae69c4ea1146ce10cc2d7':
|
||||
+ resolution: {tarball: https://codeload.github.com/vencord/Venmic/tar.gz/5481a9277da95656c79ae69c4ea1146ce10cc2d7}
|
||||
+ version: 6.1.0
|
||||
engines: {node: '>=14.15'}
|
||||
os: [linux]
|
||||
|
||||
@@ -3382,7 +3383,7 @@ snapshots:
|
||||
standalone-electron-types: 1.0.0
|
||||
type-fest: 3.13.1
|
||||
|
||||
- '@vencord/venmic@6.1.0':
|
||||
+ '@vencord/venmic@https://codeload.github.com/vencord/Venmic/tar.gz/5481a9277da95656c79ae69c4ea1146ce10cc2d7':
|
||||
dependencies:
|
||||
cmake-js: 7.3.0
|
||||
node-addon-api: 8.1.0
|
||||
diff --git a/scripts/build/build.mts b/scripts/build/build.mts
|
||||
index 243381b..effa353 100644
|
||||
--- a/scripts/build/build.mts
|
||||
+++ b/scripts/build/build.mts
|
||||
@@ -37,16 +37,10 @@ async function createContext(options: BuildOptions) {
|
||||
async function copyVenmic() {
|
||||
if (process.platform !== "linux") return;
|
||||
|
||||
- return Promise.all([
|
||||
- copyFile(
|
||||
- "./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-x64/node-napi-v7.node",
|
||||
- "./static/dist/venmic-x64.node"
|
||||
- ),
|
||||
- copyFile(
|
||||
- "./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-arm64/node-napi-v7.node",
|
||||
- "./static/dist/venmic-arm64.node"
|
||||
- )
|
||||
- ]).catch(() => console.warn("Failed to copy venmic. Building without venmic support"));
|
||||
+ return copyFile(
|
||||
+ "./node_modules/@vencord/venmic/build/Release/venmic-addon.node",
|
||||
+ "./static/dist/venmic.node"
|
||||
+ ).catch(() => console.warn("Failed to copy venmic. Building without venmic support"));
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
diff --git a/src/main/venmic.ts b/src/main/venmic.ts
|
||||
index c127e90..948c281 100644
|
||||
--- a/src/main/venmic.ts
|
||||
+++ b/src/main/venmic.ts
|
||||
@@ -29,7 +29,7 @@ function importVenmic() {
|
||||
imported = true;
|
||||
|
||||
try {
|
||||
- PatchBay = (require(join(STATIC_DIR, `dist/venmic-${process.arch}.node`)) as typeof import("@vencord/venmic"))
|
||||
+ PatchBay = (require(join(STATIC_DIR, `dist/venmic.node`)) as typeof import("@vencord/venmic"))
|
||||
.PatchBay;
|
||||
|
||||
hasPipewirePulse = PatchBay.hasPipeWire();
|
||||
--
|
||||
2.45.2
|
||||
|
@ -0,0 +1,156 @@
|
||||
From 65b6370ecce6416ea68e41e8c5ba9a63d97b9017 Mon Sep 17 00:00:00 2001
|
||||
From: 1024x2 <2pow11@gmail.com>
|
||||
Date: Wed, 14 Aug 2024 00:11:40 +0100
|
||||
Subject: [PATCH 2/3] Vencord: Remove Vencord build downloader
|
||||
|
||||
This commit only makes sense in the context of Vexcord, sorry :(
|
||||
---
|
||||
src/main/constants.ts | 1 +
|
||||
src/main/utils/http.ts | 58 ---------------------------------
|
||||
src/main/utils/vencordLoader.ts | 34 ++++---------------
|
||||
3 files changed, 7 insertions(+), 86 deletions(-)
|
||||
delete mode 100644 src/main/utils/http.ts
|
||||
|
||||
diff --git a/src/main/constants.ts b/src/main/constants.ts
|
||||
index 40d91a5..36ab41f 100644
|
||||
--- a/src/main/constants.ts
|
||||
+++ b/src/main/constants.ts
|
||||
@@ -48,6 +48,7 @@ export const VENCORD_THEMES_DIR = join(DATA_DIR, "themes");
|
||||
// needs to be inline require because of circular dependency
|
||||
// as otherwise "DATA_DIR" (which is used by ./settings) will be uninitialised
|
||||
export const VENCORD_FILES_DIR =
|
||||
+ process.env.VENCORD_FILES_DIR ||
|
||||
(require("./settings") as typeof import("./settings")).State.store.vencordDir ||
|
||||
join(SESSION_DATA_DIR, "vencordFiles");
|
||||
|
||||
diff --git a/src/main/utils/http.ts b/src/main/utils/http.ts
|
||||
deleted file mode 100644
|
||||
index baee81e..0000000
|
||||
--- a/src/main/utils/http.ts
|
||||
+++ /dev/null
|
||||
@@ -1,58 +0,0 @@
|
||||
-/*
|
||||
- * SPDX-License-Identifier: GPL-3.0
|
||||
- * Vesktop, a desktop app aiming to give you a snappier Discord Experience
|
||||
- * Copyright (c) 2023 Vendicated and Vencord contributors
|
||||
- */
|
||||
-
|
||||
-import { createWriteStream } from "fs";
|
||||
-import { Readable } from "stream";
|
||||
-import { pipeline } from "stream/promises";
|
||||
-import { setTimeout } from "timers/promises";
|
||||
-
|
||||
-interface FetchieOptions {
|
||||
- retryOnNetworkError?: boolean;
|
||||
-}
|
||||
-
|
||||
-export async function downloadFile(url: string, file: string, options: RequestInit = {}, fetchieOpts?: FetchieOptions) {
|
||||
- const res = await fetchie(url, options, fetchieOpts);
|
||||
- await pipeline(
|
||||
- // @ts-expect-error odd type error
|
||||
- Readable.fromWeb(res.body!),
|
||||
- createWriteStream(file, {
|
||||
- autoClose: true
|
||||
- })
|
||||
- );
|
||||
-}
|
||||
-
|
||||
-const ONE_MINUTE_MS = 1000 * 60;
|
||||
-
|
||||
-export async function fetchie(url: string, options?: RequestInit, { retryOnNetworkError }: FetchieOptions = {}) {
|
||||
- let res: Response | undefined;
|
||||
-
|
||||
- try {
|
||||
- res = await fetch(url, options);
|
||||
- } catch (err) {
|
||||
- if (retryOnNetworkError) {
|
||||
- console.error("Failed to fetch", url + ".", "Gonna retry with backoff.");
|
||||
-
|
||||
- for (let tries = 0, delayMs = 500; tries < 20; tries++, delayMs = Math.min(2 * delayMs, ONE_MINUTE_MS)) {
|
||||
- await setTimeout(delayMs);
|
||||
- try {
|
||||
- res = await fetch(url, options);
|
||||
- break;
|
||||
- } catch {}
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (!res) throw new Error(`Failed to fetch ${url}\n${err}`);
|
||||
- }
|
||||
-
|
||||
- if (res.ok) return res;
|
||||
-
|
||||
- let msg = `Got non-OK response for ${url}: ${res.status} ${res.statusText}`;
|
||||
-
|
||||
- const reason = await res.text().catch(() => "");
|
||||
- if (reason) msg += `\n${reason}`;
|
||||
-
|
||||
- throw new Error(msg);
|
||||
-}
|
||||
diff --git a/src/main/utils/vencordLoader.ts b/src/main/utils/vencordLoader.ts
|
||||
index c0bac6a..3f08ad0 100644
|
||||
--- a/src/main/utils/vencordLoader.ts
|
||||
+++ b/src/main/utils/vencordLoader.ts
|
||||
@@ -4,14 +4,11 @@
|
||||
* Copyright (c) 2023 Vendicated and Vencord contributors
|
||||
*/
|
||||
|
||||
-import { mkdirSync } from "fs";
|
||||
-import { access, constants as FsConstants } from "fs/promises";
|
||||
+import { mkdir, access, constants as FsConstants } from "fs/promises";
|
||||
import { join } from "path";
|
||||
|
||||
import { USER_AGENT, VENCORD_FILES_DIR } from "../constants";
|
||||
-import { downloadFile, fetchie } from "./http";
|
||||
-
|
||||
-const API_BASE = "https://api.github.com";
|
||||
+import { app, dialog } from "electron";
|
||||
|
||||
export const FILES_TO_DOWNLOAD = [
|
||||
"vencordDesktopMain.js",
|
||||
@@ -31,30 +28,11 @@ export interface ReleaseData {
|
||||
}
|
||||
|
||||
export async function githubGet(endpoint: string) {
|
||||
- const opts: RequestInit = {
|
||||
- headers: {
|
||||
- Accept: "application/vnd.github+json",
|
||||
- "User-Agent": USER_AGENT
|
||||
- }
|
||||
- };
|
||||
-
|
||||
- if (process.env.GITHUB_TOKEN) (opts.headers! as any).Authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
||||
-
|
||||
- return fetchie(API_BASE + endpoint, opts, { retryOnNetworkError: true });
|
||||
+ throw new Error("No");
|
||||
}
|
||||
|
||||
export async function downloadVencordFiles() {
|
||||
- const release = await githubGet("/repos/Vendicated/Vencord/releases/latest");
|
||||
-
|
||||
- const { assets }: ReleaseData = await release.json();
|
||||
-
|
||||
- await Promise.all(
|
||||
- assets
|
||||
- .filter(({ name }) => FILES_TO_DOWNLOAD.some(f => name.startsWith(f)))
|
||||
- .map(({ name, browser_download_url }) =>
|
||||
- downloadFile(browser_download_url, join(VENCORD_FILES_DIR, name), {}, { retryOnNetworkError: true })
|
||||
- )
|
||||
- );
|
||||
+ dialog.showErrorBox("No", "Go away");
|
||||
}
|
||||
|
||||
const existsAsync = (path: string) =>
|
||||
@@ -69,7 +47,7 @@ export async function isValidVencordInstall(dir: string) {
|
||||
export async function ensureVencordFiles() {
|
||||
if (await isValidVencordInstall(VENCORD_FILES_DIR)) return;
|
||||
|
||||
- mkdirSync(VENCORD_FILES_DIR, { recursive: true });
|
||||
+ dialog.showErrorBox("Could not find Vencord files!", "Please specify a folder containing \"vencordDesktopMain.js\" in the environment variable VENCORD_FILES_DIR.");
|
||||
|
||||
- await downloadVencordFiles();
|
||||
+ app.exit(1);
|
||||
}
|
||||
--
|
||||
2.45.2
|
||||
|
17004
vesktop-patches/0003-Even-smaller-rebrand.patch
Normal file
17004
vesktop-patches/0003-Even-smaller-rebrand.patch
Normal file
File diff suppressed because it is too large
Load Diff
53
vextop.sh
Executable file
53
vextop.sh
Executable file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Pull the patches repository
|
||||
git pull
|
||||
|
||||
# Do we have the Vencord sources cloned?
|
||||
if [ -e Vencord/.git ]; then
|
||||
# Update sources
|
||||
cd Vencord
|
||||
git fetch
|
||||
else
|
||||
# Clone sources
|
||||
git clone https://github.com/Vendicated/Vencord.git Vencord
|
||||
cd Vencord
|
||||
fi
|
||||
|
||||
# Reset vexcord branch and apply patches
|
||||
git checkout -B vexcord origin/main
|
||||
git am ../vencord-patches/*.patch
|
||||
|
||||
# Build vencord
|
||||
pnpm i --frozen-lockfile
|
||||
node scripts/build/build.mjs
|
||||
|
||||
# Save this for later (Vextop needs it)
|
||||
export VENCORD_FILES_DIR="$(realpath dist)"
|
||||
|
||||
# Back out of Vencord directory
|
||||
cd ..
|
||||
|
||||
# Do we have the Vesktop sources cloned?
|
||||
if [ -e Vesktop/.git ]; then
|
||||
# Update sources
|
||||
cd Vesktop
|
||||
git fetch
|
||||
else
|
||||
# Clone sources
|
||||
git clone https://github.com/Vencord/Vesktop.git Vesktop
|
||||
cd Vesktop
|
||||
fi
|
||||
|
||||
# Reset vextop branch and apply patches
|
||||
git checkout -B vextop origin/main
|
||||
git am ../vesktop-patches/*.patch
|
||||
|
||||
# Build vesktop
|
||||
pnpm i --frozen-lockfile
|
||||
pnpm build
|
||||
|
||||
# Run vesktop
|
||||
pnpm electron .
|
Loading…
x
Reference in New Issue
Block a user