diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..29b3458 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install web-ext + run: npm install -g web-ext + + - name: Build Firefox zip + run: ./firefox.sh + + - name: Build Chrome zip + run: ./chrome.sh + + - name: Stage release assets + run: | + mkdir -p dist + cp src/web-ext-artifacts/*.zip "dist/rys-firefox-${GITHUB_REF_NAME}.zip" + cp extension.zip "dist/rys-chrome-${GITHUB_REF_NAME}.zip" + + - name: Create release + uses: softprops/action-gh-release@v2 + with: + files: dist/*.zip + fail_on_unmatched_files: true diff --git a/.gitignore b/.gitignore index 5bdcd15..d2b2246 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ extension.zip manifest.json _scratch/ node_modules/ +dist/ diff --git a/README.md b/README.md index 46fcca9..aa49b4e 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ This project is 100% open source. Created and maintained by me, [Lawrence Hook]( Have a feature request or found a bug? Feel free to create a Github issue, submit a PR, or contact me at lawrencehook@gmail.com. -The following commands will set up a Firefox dev environment. - ```bash git clone https://github.com/lawrencehook/remove-youtube-suggestions.git -cd remove-youtube-suggestions/src +cd remove-youtube-suggestions npm install --global web-ext -web-ext run + +./dev.sh firefox # opens Firefox with the extension loaded +./dev.sh chrome # builds dist/chrome/ — load as unpacked in chrome://extensions ``` diff --git a/dev.sh b/dev.sh new file mode 100755 index 0000000..13ec5cd --- /dev/null +++ b/dev.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# Local dev launcher. Two strategies, one per browser: +# +# firefox Run web-ext from src/ directly. Drops firefox_manifest.json +# in as manifest.json and launches a temp Firefox profile. +# +# chrome Sync src/ into dist/chrome/ as real files (rsync), with +# chrome_manifest.json copied in as manifest.json. Load as +# an unpacked extension via chrome://extensions. +# +# We don't symlink — Chrome's content-script loader silently +# rejects scripts whose realpath is outside the extension +# directory, so the popup loads but content scripts don't fire. +# Re-run this script and click "reload" in chrome://extensions +# after editing src/. + +set -euo pipefail + +browser="${1:-}" +case "$browser" in + firefox|chrome) ;; + *) echo "Usage: $0 " >&2; exit 1 ;; +esac + +repo="$(cd "$(dirname "$0")" && pwd)" +src="$repo/src" + +case "$browser" in + firefox) + cd "$src" + cp firefox_manifest.json manifest.json + trap 'rm -f "$src/manifest.json"' EXIT + echo "Launching: web-ext run from $src" + exec web-ext run + ;; + + chrome) + dst="$repo/dist/chrome" + mkdir -p "$dst" + + rsync -a --delete \ + --exclude='*_manifest.json' \ + --exclude='manifest.json' \ + --exclude='web-ext-artifacts' \ + "$src/" "$dst/" + + cp "$src/chrome_manifest.json" "$dst/manifest.json" + echo "Ready: $dst" + echo "In chrome://extensions, enable Developer mode and 'Load unpacked' → $dst" + ;; +esac diff --git a/src/content-script/main.js b/src/content-script/main.js index 2dce7a3..eb5e268 100644 --- a/src/content-script/main.js +++ b/src/content-script/main.js @@ -7,7 +7,7 @@ const REDIRECT_URLS = { "redirect_off": false, "redirect_to_subs": 'https://www.youtube.com/feed/subscriptions', "redirect_to_wl": 'https://www.youtube.com/playlist/?list=WL', - "redirect_to_library": 'https://www.youtube.com/feed/library', + "redirect_to_library": 'https://www.youtube.com/feed/you', }; diff --git a/src/shared/main.js b/src/shared/main.js index 1dbe018..f298d68 100644 --- a/src/shared/main.js +++ b/src/shared/main.js @@ -571,7 +571,6 @@ const SECTIONS = [ redirect_off: true } }, - premium: true, }, { name: "Redirect home to Watch Later", @@ -587,7 +586,6 @@ const SECTIONS = [ redirect_off: true } }, - premium: true, }, { name: "Redirect home to Library", @@ -603,14 +601,12 @@ const SECTIONS = [ redirect_off: true } }, - premium: true, }, { name: "Do not redirect home", id: "redirect_off", defaultValue: false, display: false, - premium: true, }, ] },