Subject: [PATCH v2] gnu: Add canvasblocker/icecat.

From: [email-masked]
Date: Wed, 19 Feb 2025 20:26:06 +0100

* gnu/packages/browser-extensions.scm (canvasblocker/icecat): New variable.
---
 gnu/packages/browser-extensions.scm | 49 +++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/gnu/packages/browser-extensions.scm b/gnu/packages/browser-extensions.scm
index 01ef0b49be..9596194e36 100644
--- a/gnu/packages/browser-extensions.scm
+++ b/gnu/packages/browser-extensions.scm
@@ -61,6 +61,55 @@ (define adaptive-tab-bar-colour
 (define-public adaptive-tab-bar-colour/icecat
   (make-icecat-extension adaptive-tab-bar-colour))
 
+(define canvasblocker
+  (package
+    (name "canvasblocker")
+    (version "1.11")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/kkapsner/CanvasBlocker")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "16mhvk7swbkmb24smkv1c147brb0mm2nfaxqw2dq43sl7ncasf32"))
+       (modules '((guix build utils) (ice-9 match) (ice-9 ftw)))
+       (snippet
+        #~(begin
+            (for-each delete-file
+                      '("canvasblocker.xpi" "package-lock.json"))
+            ;; Delete all hidden files/directories except .tools.
+            (for-each
+             (match-lambda
+               ((or "." ".tools" ".."
+                    (? (lambda (name)
+                         (not (string-prefix? "." name)))))
+                #t)
+               ((? file-is-directory? dir)
+                (delete-file-recursively dir))
+               (file
+                (delete-file file)))
+             (scandir "."))))))
+    (build-system copy-build-system)
+    (properties '((addon-id . "[email-masked]")))
+    (arguments
+     (list
+      #:install-plan  ;deduced from .tools/build.js
+      #~'(("." #$(assq-ref properties 'addon-id)
+           #:exclude ("crowdin.yml" "package.json" "releaseNotes.txt")
+           #:exclude-regexp ("test/.*" "versions/.*" ".tools/*")))))
+    (home-page "https://github.com/kkapsner/CanvasBlocker")
+    (synopsis "Firefox extension to protect from being figerprinted")
+    (description "This extension allows users to prevent websites from using
+some Javascript APIs to fingerprint them.  Users can choose to block the APIs
+entirely on some or all websites (which may break some websites) or just block
+or fake its fingerprinting-friendly readout API.")
+    (license license:mpl2.0)))
+
+(define-public canvasblocker/icecat
+  (make-icecat-extension canvasblocker))
+
 (define play-to-kodi
   (package
     (name "play-to-kodi")
-- 
2.48.1

-- 
Best regards,
Nicolas Graves