fix on anime stream data
This commit is contained in:
@@ -466,7 +466,10 @@ export async function searchEpisodesInExtension(ext: Extension | null, name: str
|
||||
export async function getStreamData(extension: Extension, episode: string, id: string, source: string, server?: string, category?: string, extensionAnimeId?: string): Promise<StreamData> {
|
||||
const providerName = extension.constructor.name;
|
||||
|
||||
const cacheKey = `anime:stream:${providerName}:${id}:${episode}:${server || 'default'}:${category || 'sub'}`;
|
||||
const finalCategory = category ?? "sub";
|
||||
|
||||
const cacheKey =
|
||||
`anime:stream:${providerName}:${id}:${episode}:${server}:${finalCategory}`;
|
||||
if (!extensionAnimeId) {
|
||||
const cached = await getCache(cacheKey);
|
||||
|
||||
@@ -498,7 +501,6 @@ export async function getStreamData(extension: Extension, episode: string, id: s
|
||||
episodes = await extension.findEpisodes(targetId);
|
||||
|
||||
if (extensionAnimeId) {
|
||||
|
||||
const anime: any = await getAnimeById(id);
|
||||
animeTitle = anime.title.romaji;
|
||||
|
||||
@@ -523,8 +525,7 @@ export async function getStreamData(extension: Extension, episode: string, id: s
|
||||
throw new Error("Episode not found");
|
||||
}
|
||||
|
||||
const serverName = server || "default";
|
||||
const streamData = await extension.findEpisodeServer(targetEp, serverName);
|
||||
const streamData = await extension.findEpisodeServer(targetEp, server, category);
|
||||
|
||||
await setCache(cacheKey, streamData, CACHE_TTL_MS);
|
||||
return streamData;
|
||||
|
||||
@@ -99,7 +99,7 @@ export interface Extension {
|
||||
mediaType?: 'manga' | 'ln';
|
||||
search?: (options: ExtensionSearchOptions) => Promise<ExtensionSearchResult[]>;
|
||||
findEpisodes?: (id: string) => Promise<Episode[]>;
|
||||
findEpisodeServer?: (episode: Episode, server: string) => Promise<any>;
|
||||
findEpisodeServer?: (s: any, server1: string | undefined, category: string | undefined) => Promise<any>;
|
||||
findChapters?: (id: string) => Promise<Chapter[]>;
|
||||
findChapterPages?: (chapterId: string) => Promise<any>;
|
||||
getSettings?: () => ExtensionSettings;
|
||||
|
||||
Reference in New Issue
Block a user