Skip to content

Auto-failover to alternate source when AllManga lacks the episode#129

Merged
truelockmc merged 2 commits into
mainfrom
allmanga-failover
Jun 3, 2026
Merged

Auto-failover to alternate source when AllManga lacks the episode#129
truelockmc merged 2 commits into
mainfrom
allmanga-failover

Conversation

@truelockmc

Copy link
Copy Markdown
Owner

No description provided.

nevatas and others added 2 commits June 3, 2026 10:03
AllManga doesn't always have every episode (especially newer or less
popular titles). The default source for anime content is AllManga, so
the user currently gets an "Episode not found on AllManga · Try a
different source" overlay and has to manually switch sources each visit.

Add per-episode failover:

  * On AllManga resolve failure (res.ok === false), automatically switch
    to the next non-async source (Videasy → VidSrc → 2Embed) and remember
    the choice in localStorage keyed by (tmdbId, season, episode, dub).
  * On subsequent visits to the same episode, skip the AllManga IPC call
    and load the cached fallback directly.
  * On AllManga resolve success, clear the cache entry so we don't keep
    overriding once the title becomes available upstream.
  * Manual source picks clear the entry for the current episode, so the
    auto-switch can't fight the user's explicit choice.

Network/timeout errors still surface the existing error overlay — only
explicit "episode missing" responses trigger the failover, so a flaky
connection won't silently change sources.

Covers both episodic content (TVPage) and movies (MoviePage). Cache
keys: tv_<tmdbId>_s<season>_e<ep>_<sub|dub> and movie_<tmdbId>_<sub|dub>.
- storage: cap failover cache at 200 entries with ts-based eviction
- api: rewrite getNextNonAsyncSource using filter instead of modulo
- movie/tv: add resolvingUrlRef + resolvedPlayerUrlRef to fix stale-closure bug in resolve effects
- movie/tv: replace hardcoded "allmangaDubMode"/"playerSource" strings with STORAGE_KEYS
- movie/tv: replace playerSource==="allmanga" guards with sourceIsAsync()/isAsync
@truelockmc truelockmc self-assigned this Jun 3, 2026
@truelockmc
truelockmc merged commit e6ac469 into main Jun 3, 2026
2 checks passed
@truelockmc
truelockmc deleted the allmanga-failover branch June 3, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants