CI / lint (push) Successful in 3s
CI / extension-version (push) Successful in 4s
CI / frontend-build (push) Successful in 23s
extension / lint (push) Successful in 26s
CI / backend-lint-and-test (push) Successful in 28s
CI / integration (push) Successful in 3m43s
Executes the 2026-07-05 product decision (FC downloaders = art-dedicated
services only), which removed Twitter/X and Bluesky but left deviantart
fully wired for seven weeks — the half-retired state rule 22 exists to
prevent.
Removed: the PlatformInfo module and its registry entry, the gallery-dl
extractor block, extension_service's artist-page pattern, the extension's
PLATFORMS + PLATFORM_ARTIST_PATTERNS entries, its manifest host permission
and content-script match, the frontend icon/colour/label, and the operator-
facing "supported platforms" list that still advertised it.
Two judgment calls, both recorded in migration 0088:
* existing `source` rows are DISABLED, not deleted. The row is the only
record of the artist's DeviantArt URL. Disabling is also required for
correctness rather than tidiness: with the platform unregistered the
download path falls through to gallery-dl, which carries its OWN
deviantart extractor, so an enabled row would have kept downloading
from a dropped platform.
* the `credential` row IS deleted — a live session cookie for a site FC
will never call again.
Adds the invariant whose absence is why manifest.json drifted in the first
place: nothing tied its domain lists back to the platform table. The
extension suite now asserts both directions, plus that no host permission
belongs to an unclaimed domain (`*://*/*` exempted — FC is self-hosted at
an operator-chosen URL the extension cannot enumerate).
Extension version 1.0.10 -> 1.0.11: ci.yml's guard hard-fails a packaged
extension change without a bump. No release is cut — build.yml's
sign-extension job only runs on main.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
105 lines
4.0 KiB
JavaScript
105 lines
4.0 KiB
JavaScript
/**
|
|
* Platform definitions — mirrored from backend/app/services/platforms.py.
|
|
* Two copies of these regexes (here and in backend extension_service.py)
|
|
* is cheaper than building a shared definition file for two short
|
|
* tables in different runtimes. Keep in sync by hand; reviewers catch
|
|
* drift.
|
|
*/
|
|
|
|
const PLATFORMS = {
|
|
patreon: {
|
|
name: 'Patreon',
|
|
domains: ['.patreon.com', 'www.patreon.com', 'patreon.com'],
|
|
authType: 'cookies',
|
|
color: '#FF424D',
|
|
urlPattern: /^https?:\/\/(www\.)?patreon\.com/,
|
|
// Patreon's `/api/current_user` returns 200 + the logged-in user
|
|
// when authenticated, 401 otherwise. Cheapest definitive check.
|
|
verify: {
|
|
url: 'https://www.patreon.com/api/current_user',
|
|
method: 'GET',
|
|
okStatuses: [200],
|
|
},
|
|
},
|
|
subscribestar: {
|
|
name: 'SubscribeStar',
|
|
domains: [
|
|
'.subscribestar.com',
|
|
'.subscribestar.adult',
|
|
'www.subscribestar.com',
|
|
'subscribestar.com',
|
|
'subscribestar.adult',
|
|
],
|
|
authType: 'cookies',
|
|
color: '#FFD700',
|
|
urlPattern: /^https?:\/\/(www\.)?subscribestar\.(com|adult)/,
|
|
// No known stable auth-required endpoint that returns a definitive
|
|
// status code; skipping verify so we don't false-positive-fail
|
|
// good cookies. Operator can add later if a clean endpoint surfaces.
|
|
},
|
|
hentaifoundry: {
|
|
name: 'Hentai Foundry',
|
|
domains: ['.hentai-foundry.com', 'www.hentai-foundry.com', 'hentai-foundry.com'],
|
|
authType: 'cookies',
|
|
color: '#9C27B0',
|
|
urlPattern: /^https?:\/\/(www\.)?hentai-foundry\.com/,
|
|
// Mirror gallery-dl's _init_site_filters: HEAD on `?enterAgree=1`.
|
|
// Logged in → 200, logged out → 401. Catches the exact failure mode
|
|
// the backend extractor would hit later.
|
|
verify: {
|
|
url: 'https://www.hentai-foundry.com/?enterAgree=1',
|
|
method: 'HEAD',
|
|
okStatuses: [200],
|
|
},
|
|
},
|
|
discord: {
|
|
name: 'Discord',
|
|
domains: ['.discord.com', 'discord.com'],
|
|
authType: 'token',
|
|
color: '#5865F2',
|
|
urlPattern: /^https?:\/\/(www\.)?discord\.com/,
|
|
note: 'Open Discord in browser to capture token',
|
|
},
|
|
pixiv: {
|
|
name: 'Pixiv',
|
|
domains: ['.pixiv.net', 'www.pixiv.net', 'pixiv.net'],
|
|
authType: 'token',
|
|
color: '#0096FA',
|
|
urlPattern: /^https?:\/\/(www\.)?pixiv\.net/,
|
|
note: 'Click to authenticate via OAuth',
|
|
},
|
|
};
|
|
|
|
/**
|
|
* Per-platform artist-page URL patterns — these are STRICTER than
|
|
* urlPattern (which matches any URL on the domain). Used by the content
|
|
* script to decide whether to show the floating "Add as source" button.
|
|
*/
|
|
const PLATFORM_ARTIST_PATTERNS = {
|
|
// Patreon serves the same creator under three URL shapes (see backend
|
|
// patreon_resolver._VANITY_RE): bare `patreon.com/Atole`, `c/` prefix, and
|
|
// `cw/` "creator workspace" — the last is the URL you land on once you're
|
|
// SUBSCRIBED, which is exactly when the button matters. Match all three, and
|
|
// drop the single-segment end-anchor so a creator's inner page
|
|
// (…/cw/Atole/posts, …/Atole/membership) also injects the button. Nav pages
|
|
// (home/search/…/posts permalink) stay excluded. Mirrors extension_service
|
|
// ._PLATFORM_PATTERNS — keep in sync (operator-flagged 2026-07-13: button
|
|
// vanished once subscribed because the old pattern only matched the bare root).
|
|
patreon: /^https?:\/\/(www\.)?patreon\.com\/(?:cw\/|c\/)?(?!(?:home|search|messages|notifications|library|settings|posts)(?:[\/?#]|$))[^/?#]+/i,
|
|
subscribestar: /^https?:\/\/(www\.)?subscribestar\.(com|adult)\/(?!feed$|messages$|library$)[^/?#]+\/?$/i,
|
|
hentaifoundry: /^https?:\/\/(www\.)?hentai-foundry\.com\/user\/[^/?#]+/i,
|
|
pixiv: /^https?:\/\/(www\.)?pixiv\.net\/(en\/)?users\/\d+/i,
|
|
};
|
|
|
|
function getPlatformFromUrl(url) {
|
|
for (const [key, platform] of Object.entries(PLATFORMS)) {
|
|
if (platform.urlPattern.test(url)) return key;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function isArtistPage(url, platformKey) {
|
|
const pattern = PLATFORM_ARTIST_PATTERNS[platformKey];
|
|
return pattern ? pattern.test(url) : false;
|
|
}
|