enhanced anime backend
This commit is contained in:
@@ -26,8 +26,8 @@ async function loadAnime() {
|
||||
}
|
||||
|
||||
const fetchUrl = extensionName
|
||||
? `/api/anime/${animeId}?ext=${extensionName}`
|
||||
: `/api/anime/${animeId}`;
|
||||
? `/api/anime/${animeId}?source=${extensionName}`
|
||||
: `/api/anime/${animeId}?source=anilist`;
|
||||
const res = await fetch(fetchUrl);
|
||||
const data = await res.json();
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ document.addEventListener('click', (e) => {
|
||||
|
||||
async function fetchSearh(query) {
|
||||
try {
|
||||
let apiUrl = `/api/search?q=${encodeURIComponent(query.slice(0, 30))}`;
|
||||
let apiUrl = `/api/search?q=${encodeURIComponent(query)}`;
|
||||
let extensionName = null;
|
||||
let finalQuery = query;
|
||||
|
||||
@@ -47,7 +47,7 @@ async function fetchSearh(query) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiUrl = `/api/search/${extensionName}?q=${encodeURIComponent(finalQuery.slice(0, 30))}`;
|
||||
apiUrl = `/api/search/${extensionName}?q=${encodeURIComponent(finalQuery)}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ document.getElementById('episode-label').innerText = `Episode ${currentEpisode}`
|
||||
|
||||
async function loadMetadata() {
|
||||
try {
|
||||
const extQuery = extName ? `?ext=${extName}` : "";
|
||||
const extQuery = extName ? `?source=${extName}` : "?source=anilist";
|
||||
const res = await fetch(`/api/anime/${animeId}${extQuery}`);
|
||||
const data = await res.json();
|
||||
|
||||
@@ -108,7 +108,7 @@ async function loadMetadata() {
|
||||
|
||||
async function loadExtensionEpisodes() {
|
||||
try {
|
||||
const extQuery = extName ? `?ext=${extName}` : "";
|
||||
const extQuery = extName ? `?source=${extName}` : "?source=anilist";
|
||||
const res = await fetch(`/api/anime/${animeId}/episodes${extQuery}`);
|
||||
const data = await res.json();
|
||||
|
||||
@@ -271,7 +271,11 @@ async function loadStream() {
|
||||
setLoading(`Loading stream (${audioMode})...`);
|
||||
|
||||
try {
|
||||
const url = `/api/watch/stream?animeId=${animeId}&episode=${currentEpisode}&server=${server}&category=${audioMode}&ext=${currentExtension}`;
|
||||
let sourc = "&source=anilist";
|
||||
if (extName){
|
||||
sourc = `&source=${extName}`;
|
||||
}
|
||||
const url = `/api/watch/stream?animeId=${animeId}&episode=${currentEpisode}&server=${server}&category=${audioMode}&ext=${currentExtension}${sourc}`;
|
||||
const res = await fetch(url);
|
||||
const data = await res.json();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user