;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020, 2021 Marius Bakke ;;; Copyright © 2021 Justin Veilleux ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages browser-extensions) #:use-module (guix packages) #:use-module (guix git-download) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu build chromium-extension) #:use-module (gnu packages compression) #:use-module (gnu packages python) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages node)) (define play-to-kodi (package (name "play-to-kodi") (version "1.9.1") (home-page "https://github.com/khloke/play-to-xbmc-chrome") (source (origin (method git-fetch) (uri (git-reference (url home-page) (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "01rmcpbkn9vhcd8mrah2jmd2801k2r5fz7aqvp22hbwmh2z5f1ch")))) (build-system copy-build-system) (synopsis "Send website contents to Kodi") (description "Play to Kodi is a browser add-on that can send video, audio, and other supported content to the Kodi media center.") (license license:expat))) (define-public play-to-kodi/chromium (make-chromium-extension play-to-kodi)) (define uassets (let ((commit "20d21ad7e92539660c7cde4c5884b3e234854264")) (origin (method git-fetch) (uri (git-reference (url "https://github.com/uBlockOrigin/uAssets") (commit commit))) (file-name (git-file-name "uAssets" (string-take commit 9))) (sha256 (base32 "1xcl4qnvjb4pv3fajpmycg1i0xqsah2qakhq2figvyrq991pldy1"))))) (define ublock-origin (package (name "ublock-origin") (version "1.36.0") (home-page "https://github.com/gorhill/uBlock") (source (origin (method git-fetch) (uri (git-reference (url home-page) (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "1r3aic18zkz8s3v1a2kffidp4swzbxnq0h8444bif9myjffnpxpj")))) (build-system gnu-build-system) (outputs '("xpi" "firefox" "chromium")) (arguments '(#:tests? #f ;no tests #:allowed-references () #:phases (modify-phases (map (lambda (phase) (assq phase %standard-phases)) '(set-paths unpack patch-source-shebangs)) (add-after 'unpack 'link-uassets (lambda* (#:key native-inputs inputs #:allow-other-keys) (symlink (string-append (assoc-ref (or native-inputs inputs) "uassets")) "../uAssets") #t)) (add-after 'unpack 'make-files-writable (lambda _ ;; The build system copies some files and later tries ;; modifying them. (for-each make-file-writable (find-files ".")) #t)) (add-after 'patch-source-shebangs 'build-xpi (lambda _ (invoke "./tools/make-firefox.sh" "all"))) (add-after 'build-xpi 'build-chromium (lambda _ (invoke "./tools/make-chromium.sh"))) (add-after 'build-chromium 'install (lambda* (#:key outputs #:allow-other-keys) (let ((firefox (assoc-ref outputs "firefox")) (xpi (assoc-ref outputs "xpi")) (chromium (assoc-ref outputs "chromium"))) (install-file "dist/build/uBlock0.firefox.xpi" (string-append xpi "/lib/mozilla/extensions")) (copy-recursively "dist/build/uBlock0.firefox" firefox) (copy-recursively "dist/build/uBlock0.chromium" chromium) #t)))))) (native-inputs `(("python" ,python-wrapper) ("uassets" ,uassets) ("zip" ,zip))) (synopsis "Block unwanted content from web sites") (description "uBlock Origin is a @dfn{wide spectrum blocker} for IceCat and ungoogled-chromium.") (license license:gpl3+))) (define-public ublock-origin/chromium (make-chromium-extension ublock-origin "chromium")) (define tosdr (package (name "tosdr") (version "4.1.1") (source (origin (uri (git-reference (url "https://github.com/tosdr/browser-extensions.git") (commit version))) (sha256 (base32 "0wz31f9rz087yw1a7cdhdgqvgnhbk569jywv846n122m4bpk3yw0")) (method git-fetch))) (native-inputs `(("bash" ,bash-minimal) ("coreutils" ,coreutils-minimal) ("node" ,node) ("zip" ,zip) ("unzip" ,unzip))) (arguments `(#:builder (begin (use-modules (guix build utils)) (set-path-environment-variable "PATH" '("bin") (map cdr %build-inputs)) (copy-recursively (assoc-ref %build-inputs "source") ".") (invoke "sh" "./build.sh") (invoke "unzip" "dist/chrome.zip" "-d" %output) #t) #:modules ((guix build utils)))) (build-system trivial-build-system) (synopsis "extension to inform of the important aspects of the terms and conditions of a web service") (description "This extension informs you instantly of your rights online by showing an unintrusive icon in the toolbar. You can click on this icon to get summaries from the Terms of Service; Didn't Read initiative.") (license license:agpl3) (home-page "https://tosdr.org/"))) (define-public tosdr-chromium (make-chromium-extension tosdr))