fix(subscribestar): route .art creators to .adult; clear source failure on disable
Two pre-merge fixes: 1. SubscribeStar .art age wall: the 18+ cookie doesn't clear the age gate on the .art domain (keeps 302'ing to /age_confirmation_warning even with the cookie — Elasid #54116), but the same creator is reachable on .adult where the cookie works. _normalize_ss_host rewrites subscribestar.art → subscribestar.adult at request time (stored Source.url untouched), logged so it's visible in walk logs. .com/.adult pass through. 2. Disabling a source now clears its failure state (last_error, error_type, consecutive_failures) so subs you pause (not paying for) stop lingering as 'failing'. Only the explicit disable clears — an unrelated edit to an already-disabled source leaves state alone. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
@@ -298,6 +298,15 @@ class SourceService:
|
||||
|
||||
for key, value in fields.items():
|
||||
setattr(source, key, value)
|
||||
# Disabling a source clears its failure state (operator: disable the subs
|
||||
# you're not paying for without them lingering as "failing"). Re-enabling
|
||||
# then starts clean; the next real run re-derives health. Only on the
|
||||
# explicit disable — an unrelated edit to an already-disabled source
|
||||
# leaves its (already-clear) state alone.
|
||||
if fields.get("enabled") is False:
|
||||
source.last_error = None
|
||||
source.error_type = None
|
||||
source.consecutive_failures = 0
|
||||
try:
|
||||
await self.session.flush()
|
||||
except IntegrityError as exc:
|
||||
|
||||
@@ -226,13 +226,35 @@ def _attachment_item(
|
||||
)
|
||||
|
||||
|
||||
def _normalize_ss_host(netloc: str) -> str:
|
||||
"""Rewrite the `subscribestar.art` host to `subscribestar.adult`.
|
||||
|
||||
The age wall on the `.art` domain does not clear with the
|
||||
`18_plus_agreement_generic` cookie (unlike `.com`/`.adult`): a `.art`
|
||||
creator page keeps 302'ing to `/age_confirmation_warning` even with the
|
||||
cookie set (Elasid, event #54116). The same creator is reachable on
|
||||
`.adult`, where the cookie works — so `.art` behaves as an alias that
|
||||
doesn't honor the age gate. Normalize it to `.adult` at request time (the
|
||||
stored Source.url is left untouched). `.com`/`.adult` pass through.
|
||||
"""
|
||||
host = netloc.lower()
|
||||
if host == "subscribestar.art" or host.endswith(".subscribestar.art"):
|
||||
rewritten = netloc[: -len("art")] + "adult"
|
||||
log.info(
|
||||
"SubscribeStar: rewrote age-gated .art host %r → %r", netloc, rewritten
|
||||
)
|
||||
return rewritten
|
||||
return netloc
|
||||
|
||||
|
||||
def _split_creator_url(campaign_id: str) -> tuple[str, str]:
|
||||
"""`campaign_id` is the creator URL → (base, slug).
|
||||
|
||||
base = scheme://host (preserving .com vs .adult); slug = first path segment.
|
||||
base = scheme://host (preserving .com vs .adult; .art → .adult, see
|
||||
_normalize_ss_host); slug = first path segment.
|
||||
"""
|
||||
parts = urlsplit(campaign_id)
|
||||
base = f"{parts.scheme or 'https'}://{parts.netloc}"
|
||||
base = f"{parts.scheme or 'https'}://{_normalize_ss_host(parts.netloc)}"
|
||||
slug = parts.path.strip("/").split("/")[0] if parts.path else ""
|
||||
return base, slug
|
||||
|
||||
|
||||
Reference in New Issue
Block a user