Merge pull request #226343 from FlafyDev/webcord-vencord

This commit is contained in:
Sandro 2023-04-24 00:16:13 +02:00 committed by GitHub
commit 90241ecb8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 5113 additions and 0 deletions

View File

@ -5135,6 +5135,12 @@
github = "fkautz";
githubId = 135706;
};
FlafyDev = {
name = "Flafy Arazi";
email = "flafyarazi@gmail.com";
github = "FlafyDev";
githubId = 44374434;
};
Flakebi = {
email = "flakebi@t-online.de";
github = "Flakebi";
@ -11299,6 +11305,12 @@
githubId = 3521180;
name = "Tom Sydney Kerckhove";
};
NotAShelf = {
name = "NotAShelf";
email = "itsashelf@gmail.com";
github = "NotAShelf";
githubId = 62766066;
};
notbandali = {
name = "Amin Bandali";
email = "bandali@gnu.org";

View File

@ -0,0 +1,12 @@
diff --git a/sources/code/common/main.ts b/sources/code/common/main.ts
index 3936ee0..bd745ef 100644
--- a/sources/code/common/main.ts
+++ b/sources/code/common/main.ts
@@ -358,6 +358,7 @@ app.userAgentFallback = getUserAgent(process.versions.chrome, userAgent.mobile,
const singleInstance = app.requestSingleInstanceLock();
function main(): void {
+ session.defaultSession.loadExtension("@vencord@");
if (overwriteMain) {
// Execute flag-specific functions for ready application.
overwriteMain();

View File

@ -0,0 +1,18 @@
{ webcord
, substituteAll
, callPackage
, lib
}:
webcord.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [
(substituteAll {
src = ./add-extension.patch;
vencord = callPackage ./vencord-web-extension { };
})
];
meta = with lib; old.meta // {
description = "Webcord with Vencord web extension";
maintainers = with maintainers; [ FlafyDev NotAShelf ];
};
})

View File

@ -0,0 +1,60 @@
{ buildNpmPackage
, fetchFromGitHub
, lib
, substituteAll
, esbuild
, buildGoModule
}:
buildNpmPackage rec {
pname = "vencord-web-extension";
version = "1.1.6";
src = fetchFromGitHub {
owner = "Vendicated";
repo = "Vencord";
rev = "v${version}";
sha256 = "sha256-V9fzSoRqVlk9QqpzzR2x+aOwGHhQhQiSjXZWMC0uLnQ=";
};
ESBUILD_BINARY_PATH = lib.getExe (esbuild.override {
buildGoModule = args: buildGoModule (args // rec {
version = "0.15.18";
src = fetchFromGitHub {
owner = "evanw";
repo = "esbuild";
rev = "v${version}";
hash = "sha256-b9R1ML+pgRg9j2yrkQmBulPuLHYLUQvW+WTyR/Cq6zE=";
};
vendorHash = "sha256-+BfxCyg0KkDQpHt/wycy/8CTG6YBA/VJvJFhhzUnSiQ=";
});
});
# Supresses an error about esbuild's version.
npmRebuildFlags = [ "|| true" ];
npmDepsHash = "sha256-jKSdeyQ8oHw7ZGby0XzDg4O8mtH276ykVuBcw7dU/Ls=";
npmFlags = [ "--legacy-peer-deps" ];
npmBuildScript = "buildWeb";
prePatch = ''
cp ${./package-lock.json} ./package-lock.json
'';
patches = [
(substituteAll {
src = ./replace-git.patch;
inherit version;
})
];
installPhase = ''
cp -r dist/extension-unpacked $out
'';
meta = with lib; {
description = "Vencord web extension";
homepage = "https://github.com/Vendicated/Vencord";
license = licenses.gpl3Only;
maintainers = with maintainers; [ FlafyDev NotAShelf ];
};
}

View File

@ -0,0 +1,26 @@
diff --git a/scripts/build/common.mjs b/scripts/build/common.mjs
index 7ff599a..85b3bfa 100644
--- a/scripts/build/common.mjs
+++ b/scripts/build/common.mjs
@@ -24,7 +24,7 @@ import { promisify } from "util";
export const watch = process.argv.includes("--watch");
export const isStandalone = JSON.stringify(process.argv.includes("--standalone"));
-export const gitHash = execSync("git rev-parse --short HEAD", { encoding: "utf-8" }).trim();
+export const gitHash = "@version@";
export const banner = {
js: `
// Vencord ${gitHash}
@@ -124,11 +124,7 @@ export const gitRemotePlugin = {
namespace: "git-remote", path: args.path
}));
build.onLoad({ filter, namespace: "git-remote" }, async () => {
- const res = await promisify(exec)("git remote get-url origin", { encoding: "utf-8" });
- const remote = res.stdout.trim()
- .replace("https://github.com/", "")
- .replace("git@github.com:", "")
- .replace(/.git$/, "");
+ const remote = "Vendicated/Vencord";
return { contents: `export default "${remote}"` };
});

View File

@ -34733,6 +34733,8 @@ with pkgs;
webcord = callPackage ../applications/networking/instant-messengers/webcord { };
webcord-vencord = callPackage ../applications/networking/instant-messengers/webcord/webcord-vencord { };
webex = callPackage ../applications/networking/instant-messengers/webex { };
webmacs = libsForQt5.callPackage ../applications/networking/browsers/webmacs { };