diff --git a/extension/.gitignore b/extension/.gitignore new file mode 100644 index 0000000..eaea30b --- /dev/null +++ b/extension/.gitignore @@ -0,0 +1,4 @@ +node_modules/ +web-ext-artifacts/ +.web-ext-id +.amo-upload-uuid diff --git a/extension/README.md b/extension/README.md new file mode 100644 index 0000000..5220623 --- /dev/null +++ b/extension/README.md @@ -0,0 +1,45 @@ +# FabledCurator Firefox Extension + +Self-hosted Firefox extension that pushes session cookies from supported +platforms (Patreon, SubscribeStar, Hentai-Foundry, Discord, Pixiv, +DeviantArt) into FabledCurator, and lets you add a creator as a Source +from their page in one click. + +## Install (operator) + +The signed XPI is bundled into the FC Docker image. Open FC → +Settings → Maintenance → Browser extension → click "Install Firefox +extension". Firefox shows its native install prompt. After installing, +open the extension's options page (about:addons → FabledCurator → +Preferences) and paste in the FC URL + extension API key shown on the +same card. + +## Develop + +```sh +cd extension/ +npm install --no-save # web-ext only +npm run lint # web-ext lint +npm run start # launches Firefox with extension loaded +npm run build # unsigned XPI in web-ext-artifacts/ +``` + +## Smoke checklist (after every release that touches `extension/**`) + +- [ ] `npm run lint` passes +- [ ] `npm run start` loads the extension in a clean Firefox profile +- [ ] Options page accepts FC URL + key, indicator turns green +- [ ] Cookie export: log into patreon.com, click Patreon card → "X cookies exported" +- [ ] Discord token: open discord.com, click Discord card → "Token captured" +- [ ] Pixiv OAuth: click Pixiv card → login redirects, token stored +- [ ] Add as source: visit patreon.com/, click floating button → toast +- [ ] Subscriptions list: popup → "Sources" tab → list renders +- [ ] Check now: click play icon on source row → no error toast + +## Release + +Bump `manifest.json` + `package.json` SemVer (both files) and commit +under `extension/**`. The `.forgejo/workflows/extension.yml` workflow +runs `web-ext sign` on main, commits the signed XPI to +`frontend/public/extension/`, and the next FC server build bundles it +into the Docker image. diff --git a/extension/icons/icon.svg b/extension/icons/icon.svg new file mode 100644 index 0000000..95f1e2d --- /dev/null +++ b/extension/icons/icon.svg @@ -0,0 +1,5 @@ + + + F + diff --git a/extension/manifest.json b/extension/manifest.json new file mode 100644 index 0000000..92b18d9 --- /dev/null +++ b/extension/manifest.json @@ -0,0 +1,71 @@ +{ + "manifest_version": 3, + "name": "FabledCurator", + "version": "1.0.0", + "description": "Export cookies from supported platforms to FabledCurator and add creators as sources in one click.", + + "browser_specific_settings": { + "gecko": { + "id": "fabledcurator@fabledsword.com", + "strict_min_version": "115.0" + } + }, + + "permissions": [ + "cookies", + "storage", + "tabs", + "activeTab", + "webRequest", + "webRequestBlocking" + ], + + "host_permissions": [ + "*://*.patreon.com/*", + "*://*.subscribestar.com/*", + "*://*.subscribestar.adult/*", + "*://*.hentai-foundry.com/*", + "*://*.discord.com/*", + "*://*.pixiv.net/*", + "*://*.deviantart.com/*", + "*://app-api.pixiv.net/*", + "*://oauth.secure.pixiv.net/*", + "*://*/*" + ], + + "action": { + "default_popup": "popup/popup.html", + "default_icon": "icons/icon.svg", + "default_title": "FabledCurator" + }, + + "background": { + "scripts": ["lib/platforms.js", "lib/cookies.js", "lib/api.js", "background/background.js"] + }, + + "options_ui": { + "page": "options/options.html", + "browser_style": true + }, + + "content_scripts": [ + { + "matches": [ + "*://*.patreon.com/*", + "*://*.subscribestar.com/*", + "*://*.subscribestar.adult/*", + "*://*.hentai-foundry.com/*", + "*://*.deviantart.com/*", + "*://*.pixiv.net/*" + ], + "js": ["lib/platforms.js", "content/content-script.js"], + "css": ["content/content-script.css"], + "run_at": "document_idle" + } + ], + + "icons": { + "48": "icons/icon.svg", + "96": "icons/icon.svg" + } +} diff --git a/extension/package.json b/extension/package.json new file mode 100644 index 0000000..1a0bb06 --- /dev/null +++ b/extension/package.json @@ -0,0 +1,15 @@ +{ + "name": "fabledcurator-extension", + "version": "1.0.0", + "private": true, + "description": "Firefox extension for FabledCurator", + "scripts": { + "lint": "web-ext lint --source-dir=.", + "start": "web-ext run --source-dir=. --firefox=firefox", + "build": "web-ext build --source-dir=. --overwrite-dest", + "sign": "web-ext sign --source-dir=. --channel=unlisted --api-key=$WEB_EXT_API_KEY --api-secret=$WEB_EXT_API_SECRET" + }, + "devDependencies": { + "web-ext": "^8.0.0" + } +} diff --git a/extension/web-ext-config.cjs b/extension/web-ext-config.cjs new file mode 100644 index 0000000..019579a --- /dev/null +++ b/extension/web-ext-config.cjs @@ -0,0 +1,13 @@ +module.exports = { + sourceDir: '.', + artifactsDir: './web-ext-artifacts', + ignoreFiles: [ + 'package.json', + 'package-lock.json', + 'web-ext-config.cjs', + 'web-ext-artifacts', + 'node_modules', + 'README.md', + '.gitignore', + ], +};