Refine watchlist search and provider fallback

This commit is contained in:
Codex
2026-08-09 12:03:08 +02:00
parent 34e3625f87
commit bc7270d7c1
7 changed files with 158 additions and 80 deletions
-61
View File
@@ -705,40 +705,6 @@ WATCHLIST_HTML = r"""<!doctype html>
"Watchlist",
) + render_page_links("watchlist") + r"""
<section class="settings">
<div class="toolbar">
<div>
<h2>Add manually</h2>
<p class="muted">Track a show directly when you already know its AllAnime ID.</p>
</div>
</div>
<form id="watchlist-form" class="stack" onsubmit="event.preventDefault(); addAnimeToWatchlist();">
<label>Anime title
<input type="text" id="watchlist-title" placeholder="Anime Title" required>
</label>
<label>Show ID
<input type="text" id="watchlist-show-id" placeholder="Show ID" required>
</label>
<label>Category
<select id="watchlist-category">
<option value="watching">Watching</option>
<option value="planned">Planned</option>
<option value="finished">Finished</option>
<option value="dropped">Dropped</option>
</select>
</label>
<label>Media type
<select id="watchlist-media-type">
<option value="tv">TV</option>
<option value="movie">Movie</option>
</select>
</label>
<div class="field-hint">Tip: you can also add entries directly from the Search page.</div>
<button class="primary" type="submit">Add to watchlist</button>
</form>
</section>
<section class="settings">
<h2>How it works</h2>
<div class="stack muted">
@@ -1541,33 +1507,6 @@ WATCHLIST_HTML = r"""<!doctype html>
}
}
async function addAnimeToWatchlist() {
const showId = $("watchlist-show-id").value.trim();
const title = $("watchlist-title").value.trim();
if (!showId || !title) {
setNotice("Fill in the watchlist title and show ID.");
return;
}
try {
const data = await api("/api/watchlist", {
method: "POST",
body: JSON.stringify({
show_id: showId,
title,
category: $("watchlist-category").value,
media_type: $("watchlist-media-type").value
})
});
$("watchlist-form").reset();
$("watchlist-category").value = "watching";
$("watchlist-media-type").value = "tv";
setNotice(data.message || "Added to watchlist.");
await fetchWatchlist();
} catch (error) {
setNotice(error.message);
}
}
async function refreshWatchlistItem(showId) {
try {
const data = await api("/api/watchlist/update-status", {