feat(anime): anime yönetimi ve arayüzü ekle

Kullanıcı arayüzünde Anime sekmesi ve oynatıcı entegrasyonu eklendi.
Sunucu tarafında Anime için özel bir veri yapısı ve API uç noktaları oluşturuldu.

- Anime içerikleri için `_anime` klasöründe ayrı metadata saklama alanı eklendi.
- Kök dizindeki (root) dosyaların çöpe taşınması ve geri yüklenmesi için
  'root-trash' sistemi tanımlandı.
- TVDB sorgularında Anime için İngilizce dil tercihi uygulandı.
- Mail.ru indirmelerinde anime kapsamı (scope) desteği eklendi.
This commit is contained in:
2026-01-28 21:48:18 +03:00
parent 52bd325dc6
commit 41c602104e
6 changed files with 2784 additions and 104 deletions

View File

@@ -0,0 +1,43 @@
import { writable } from "svelte/store";
import { apiFetch } from "../utils/api.js";
export const animeCount = writable(0);
let requestSeq = 0;
let lastValue = 0;
let zeroTimer = null;
export async function refreshAnimeCount() {
const ticket = ++requestSeq;
try {
const resp = await apiFetch("/api/anime");
if (!resp.ok) throw new Error(`HTTP ${resp.status}`);
const list = await resp.json();
if (ticket !== requestSeq) return;
const nextVal = Array.isArray(list) ? list.length : 0;
if (nextVal > 0) {
if (zeroTimer) {
clearTimeout(zeroTimer);
zeroTimer = null;
}
lastValue = nextVal;
animeCount.set(nextVal);
} else if (lastValue > 0) {
if (zeroTimer) clearTimeout(zeroTimer);
const zeroTicket = requestSeq;
zeroTimer = setTimeout(() => {
if (zeroTicket === requestSeq) {
lastValue = 0;
animeCount.set(0);
}
zeroTimer = null;
}, 500);
} else {
lastValue = 0;
animeCount.set(0);
}
} catch (err) {
console.warn("⚠️ Anime sayacı güncellenemedi:", err?.message || err);
// Hata durumunda mevcut değeri koru, titreşimi önle
}
}