mirror of
https://github.com/lawrencehook/remove-youtube-suggestions.git
synced 2026-07-25 06:54:31 +00:00
Port dev.sh + release CI from curb; make redirects free (#215)
* Port dev.sh + release CI from curb; make redirects free dev.sh runs Firefox via web-ext from src/ and Chrome from a dist/chrome/ symlink tree. The two manifests live at different paths, so both browsers can run side-by-side without clobbering each other's manifest.json. Edits in src/ propagate live to both. release.yml builds Chrome + Firefox zips on tag push (v*) and attaches them to a GitHub Release, retiring the manual extension.zip workflow. The four redirect-home options (redirect_to_subs / _to_wl / _to_library / _off) drop the premium flag — they're advertised on the store listings, so it feels right to have them free. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Trim dev section in README to just the commands Cut the rationale paragraphs (symlink trick, manifest clobbering); anyone needing that detail can read dev.sh. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Sync dist/chrome with rsync instead of symlinks Chrome's content-script loader silently rejects scripts whose realpath is outside the extension directory. The popup loaded fine through symlinks but content scripts on YouTube never injected (no Chrome error, just nothing). Real file copies sidestep the realpath check. Trade-off: re-run dev.sh chrome and click reload after edits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Fix redirect-to-Library URL after YouTube renamed Library to You YouTube renamed the Library section to "You" and moved its URL from /feed/library to /feed/you. The redirect option silently broke. Fixes #123 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||||
@@ -4,3 +4,4 @@ extension.zip
|
|||||||
manifest.json
|
manifest.json
|
||||||
_scratch/
|
_scratch/
|
||||||
node_modules/
|
node_modules/
|
||||||
|
dist/
|
||||||
|
|||||||
@@ -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.
|
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
|
```bash
|
||||||
git clone https://github.com/lawrencehook/remove-youtube-suggestions.git
|
git clone https://github.com/lawrencehook/remove-youtube-suggestions.git
|
||||||
cd remove-youtube-suggestions/src
|
cd remove-youtube-suggestions
|
||||||
npm install --global web-ext
|
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
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -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 <firefox|chrome>" >&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
|
||||||
@@ -7,7 +7,7 @@ const REDIRECT_URLS = {
|
|||||||
"redirect_off": false,
|
"redirect_off": false,
|
||||||
"redirect_to_subs": 'https://www.youtube.com/feed/subscriptions',
|
"redirect_to_subs": 'https://www.youtube.com/feed/subscriptions',
|
||||||
"redirect_to_wl": 'https://www.youtube.com/playlist/?list=WL',
|
"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',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -571,7 +571,6 @@ const SECTIONS = [
|
|||||||
redirect_off: true
|
redirect_off: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
premium: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Redirect home to Watch Later",
|
name: "Redirect home to Watch Later",
|
||||||
@@ -587,7 +586,6 @@ const SECTIONS = [
|
|||||||
redirect_off: true
|
redirect_off: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
premium: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Redirect home to Library",
|
name: "Redirect home to Library",
|
||||||
@@ -603,14 +601,12 @@ const SECTIONS = [
|
|||||||
redirect_off: true
|
redirect_off: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
premium: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Do not redirect home",
|
name: "Do not redirect home",
|
||||||
id: "redirect_off",
|
id: "redirect_off",
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
display: false,
|
display: false,
|
||||||
premium: true,
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user