From 9b075003d27b1c44309a6042de2e7aae1872a247 Mon Sep 17 00:00:00 2001 From: wc7086 <74053663+wc7086@users.noreply.github.com> Date: Sat, 22 Apr 2023 13:40:06 +0800 Subject: [PATCH] fix install_ff_addons --- static/larbs.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/static/larbs.sh b/static/larbs.sh index 015c8e1d9..987e80938 100755 --- a/static/larbs.sh +++ b/static/larbs.sh @@ -238,14 +238,19 @@ installffaddons(){ IFS=' ' sudo -u "$name" mkdir -p "$pdir/extensions/" for addon in $addonlist; do - addonurl="$(curl --silent "https://addons.mozilla.org/en-US/firefox/addon/${addon}/" | grep -o 'https://addons.mozilla.org/firefox/downloads/file/[^"]*')" + if [ "$addon" = "ublock-origin" ]; then + addonurl="$(curl -sL https://api.github.com/repos/gorhill/uBlock/releases/latest | grep -E 'browser_download_url.*\.firefox\.xpi' | cut -d '"' -f 4)" + else + addonurl="$(curl --silent "https://addons.mozilla.org/en-US/firefox/addon/${addon}/" | grep -o 'https://addons.mozilla.org/firefox/downloads/file/[^"]*')" + fi file="${addonurl##*/}" sudo -u "$name" curl -LOs "$addonurl" > "$addontmp/$file" id="$(unzip -p "$file" manifest.json | grep "\"id\"")" id="${id%\"*}" id="${id##*\"}" - sudo -u "$name" mv "$file" "$pdir/extensions/$id.xpi" + mv "$file" "$pdir/extensions/$id.xpi" done + chown -R "$name:$name" "$pdir/extensions" # Fix a Vim Vixen bug with dark mode not fixed on upstream: sudo -u "$name" mkdir -p "$pdir/chrome" [ ! -f "$pdir/chrome/userContent.css" ] && sudo -u "$name" echo ".vimvixen-console-frame { color-scheme: light !important; }