Skip to content

Commit

Permalink
📦 Added a TwitchNoSub package with patch
Browse files Browse the repository at this point in the history
  • Loading branch information
theobori committed Jan 18, 2025
1 parent 0da6ee6 commit dcb982c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
42 changes: 42 additions & 0 deletions packages/twitchnosub/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ pkgs, ... }:
let
inherit (pkgs) stdenvNoCC fetchFromGitHub;
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "twitchnosub";
version = "0.8.1";

src = fetchFromGitHub {
owner = "besuper";
repo = "TwitchNoSub";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-xlWNUiv06ocRwMsnAAI7V7kDlG25psKmZXeODq07MoM=";
};

nativeBuildInputs = with pkgs; [ web-ext ];

buildPhase = ''
runHook preBuild
mv firefox-manifest.json manifest.json
web-ext build
runHook postBuild
'';

patches = [
# See https://github.com/besuper/TwitchNoSub/issues/156#issuecomment-2592337368
./worker.patch
];

installPhase = ''
runHook preInstall
dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
mkdir -p "$dst"
install -v -m644 "web-ext-artifacts/twitchnosub-${finalAttrs.version}.zip" "$dst/twitchnosub@besuper.com.xpi"
runHook postInstall
'';
})
22 changes: 22 additions & 0 deletions packages/twitchnosub/worker.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/src/app.js b/src/app_fixed.js
index 5cdb5b1..dad4210 100644
--- a/src/app.js
+++ b/src/app_fixed.js
@@ -19,9 +19,14 @@ window.Worker = class Worker extends oldWorker {
super(twitchBlobUrl);

this.addEventListener("message", (event) => {
- const { data } = event;
- if ((data.id === 1 || isVariantA) && data.type === 1) {
- this.postMessage({ ...data, arg: [data.arg] });
+ const data = event.data;
+
+ if ((data.id == 1 || isVariantA) && data.type == 1) {
+ const newData = event.data;
+
+ newData.arg = [data.arg];
+
+ this.postMessage(newData);
}
});
}

0 comments on commit dcb982c

Please sign in to comment.