fix(subscribestar): inject the 18+ age cookie on every SubscribeStar domain
CI / lint (push) Successful in 4s
CI / frontend-build (push) Successful in 41s
CI / backend-lint-and-test (push) Successful in 3m1s
CI / integration (push) Successful in 4m51s

The cookie was pinned to .subscribestar.adult only; cookies are
domain-scoped, so sources on subscribestar.art (Elasid, event #54116)
never sent it and every poll 302d to /age_confirmation_warning. Emit
one line per domain (.com/.adult/.art) with a per-domain presence
check, and admit .art in the platform url_pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
2026-07-02 21:51:51 -04:00
parent aa12a57f97
commit b54243a1ff
2 changed files with 45 additions and 19 deletions
+20 -8
View File
@@ -116,8 +116,10 @@ async def test_get_cookies_path_subscribestar_injects_age_cookie(db, crypto, tmp
cookie; the browser-stored cookie expires annually and can't be easily
refreshed (the JS age popup is suppressed by localStorage). Mirror
gallery-dl's own login-flow workaround by injecting
`18_plus_agreement_generic=true` on `.subscribestar.adult` whenever
cookies for subscribestar are materialized."""
`18_plus_agreement_generic=true` whenever cookies for subscribestar
are materialized — on EVERY SubscribeStar domain, since cookies are
domain-scoped and creators live on .com/.adult/.art alike (a .adult-only
line left .art sources stuck on the age wall — Elasid, event #54116)."""
netscape_in = (
"# Netscape HTTP Cookie File\n"
".subscribestar.adult\tTRUE\t/\tTRUE\t1700000000\tsession_id\txyz\n"
@@ -126,16 +128,18 @@ async def test_get_cookies_path_subscribestar_injects_age_cookie(db, crypto, tmp
await svc.upsert(platform="subscribestar", credential_type="cookies", data=netscape_in)
path = await svc.get_cookies_path("subscribestar")
contents = path.read_text()
assert "18_plus_agreement_generic\ttrue" in contents
assert ".subscribestar.adult" in contents
for domain in (".subscribestar.com", ".subscribestar.adult", ".subscribestar.art"):
assert f"{domain}\tTRUE\t/\tTRUE\t4102444800\t18_plus_agreement_generic\ttrue" in contents
# Original session_id cookie preserved.
assert "session_id\txyz" in contents
@pytest.mark.asyncio
async def test_get_cookies_path_subscribestar_idempotent_when_present(db, crypto, tmp_path):
"""If the operator's captured cookies ALREADY contain the age cookie
(e.g. a manual paste, or a re-login), don't double-inject."""
async def test_get_cookies_path_subscribestar_idempotent_per_domain(db, crypto, tmp_path):
"""If the operator's captured cookies ALREADY contain the age cookie for
a domain (e.g. a manual paste, or a re-login), don't double-inject on
THAT domain — but a .adult-only capture must still get the cookie added
for .com and .art (per-domain check, not presence-anywhere)."""
netscape_in = (
"# Netscape HTTP Cookie File\n"
".subscribestar.adult\tTRUE\t/\tTRUE\t1700000000\t18_plus_agreement_generic\ttrue\n"
@@ -145,7 +149,15 @@ async def test_get_cookies_path_subscribestar_idempotent_when_present(db, crypto
await svc.upsert(platform="subscribestar", credential_type="cookies", data=netscape_in)
path = await svc.get_cookies_path("subscribestar")
contents = path.read_text()
assert contents.count("18_plus_agreement_generic") == 1
assert contents.count("18_plus_agreement_generic") == 3
adult_lines = [
line for line in contents.splitlines()
if line.startswith(".subscribestar.adult\t")
and "18_plus_agreement_generic" in line
]
assert len(adult_lines) == 1
assert ".subscribestar.com\t" in contents
assert ".subscribestar.art\t" in contents
@pytest.mark.asyncio