Skip to content

Commit dcb982c

Browse files
committed
📦 Added a TwitchNoSub package with patch
1 parent 0da6ee6 commit dcb982c

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

packages/twitchnosub/default.nix

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{ pkgs, ... }:
2+
let
3+
inherit (pkgs) stdenvNoCC fetchFromGitHub;
4+
in
5+
stdenvNoCC.mkDerivation (finalAttrs: {
6+
pname = "twitchnosub";
7+
version = "0.8.1";
8+
9+
src = fetchFromGitHub {
10+
owner = "besuper";
11+
repo = "TwitchNoSub";
12+
rev = "refs/tags/${finalAttrs.version}";
13+
hash = "sha256-xlWNUiv06ocRwMsnAAI7V7kDlG25psKmZXeODq07MoM=";
14+
};
15+
16+
nativeBuildInputs = with pkgs; [ web-ext ];
17+
18+
buildPhase = ''
19+
runHook preBuild
20+
21+
mv firefox-manifest.json manifest.json
22+
web-ext build
23+
24+
runHook postBuild
25+
'';
26+
27+
patches = [
28+
# See https://github.com/besuper/TwitchNoSub/issues/156#issuecomment-2592337368
29+
./worker.patch
30+
];
31+
32+
installPhase = ''
33+
runHook preInstall
34+
35+
dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
36+
mkdir -p "$dst"
37+
38+
install -v -m644 "web-ext-artifacts/twitchnosub-${finalAttrs.version}.zip" "$dst/twitchnosub@besuper.com.xpi"
39+
40+
runHook postInstall
41+
'';
42+
})

packages/twitchnosub/worker.patch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/src/app.js b/src/app_fixed.js
2+
index 5cdb5b1..dad4210 100644
3+
--- a/src/app.js
4+
+++ b/src/app_fixed.js
5+
@@ -19,9 +19,14 @@ window.Worker = class Worker extends oldWorker {
6+
super(twitchBlobUrl);
7+
8+
this.addEventListener("message", (event) => {
9+
- const { data } = event;
10+
- if ((data.id === 1 || isVariantA) && data.type === 1) {
11+
- this.postMessage({ ...data, arg: [data.arg] });
12+
+ const data = event.data;
13+
+
14+
+ if ((data.id == 1 || isVariantA) && data.type == 1) {
15+
+ const newData = event.data;
16+
+
17+
+ newData.arg = [data.arg];
18+
+
19+
+ this.postMessage(newData);
20+
}
21+
});
22+
}

0 commit comments

Comments
 (0)