mirror of
https://github.com/Radiquum/AniX.git
synced 2025-09-05 22:15:36 +05:00
fix: add missing cors and content-type headers
This commit is contained in:
parent
51c5bf01da
commit
cc9a9c3a2c
14 changed files with 116 additions and 89 deletions
|
@ -1,9 +1,9 @@
|
|||
import { asJSON } from "./shared";
|
||||
const API_URL = "https://api.anilibria.tv/v3/title"
|
||||
|
||||
export async function getAnilibriaURL(res, url: string) {
|
||||
export async function getAnilibriaURL(req, res, url: string) {
|
||||
if (!url.includes("libria")) {
|
||||
asJSON(res, { message: "Wrong url provided for player libria" }, 400);
|
||||
asJSON(req, res, { message: "Wrong url provided for player libria" }, 400);
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ export async function getAnilibriaURL(res, url: string) {
|
|||
|
||||
let apiRes = await fetch(`${API_URL}?id=${releaseId}`);
|
||||
if (!apiRes.ok) {
|
||||
asJSON(res, { message: "LIBRIA: failed to get api response" }, 500);
|
||||
asJSON(req, res, { message: "LIBRIA: failed to get api response" }, 500);
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ export async function getAnilibriaURL(res, url: string) {
|
|||
}
|
||||
|
||||
|
||||
asJSON(res, data, 200);
|
||||
asJSON(req, res, data, 200);
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue