fix: use anify as last source if other sources aren't recognized

This commit is contained in:
2024-06-08 11:43:17 -04:00
parent 1ccd004c77
commit c47c042917

View File

@@ -94,26 +94,6 @@ app.openapi(route, async (c) => {
}
}
if (provider === "anify") {
try {
const result = await import("./anify").then(({ getSourcesFromAnify }) =>
getSourcesFromAnify(provider, id, aniListId),
);
if (!result) {
return c.json({ success: false }, { status: 404 });
}
return c.json({
success: true,
result,
});
} catch (e) {
console.error("Failed to fetch download URL from Anify", e);
return c.json(ErrorResponse, { status: 500 });
}
}
if (provider === "amvstrm") {
try {
const result = await import("./amvstrm").then(
@@ -134,7 +114,23 @@ app.openapi(route, async (c) => {
}
}
return c.json(ErrorResponse, { status: 400 });
try {
const result = await import("./anify").then(({ getSourcesFromAnify }) =>
getSourcesFromAnify(provider, id, aniListId),
);
if (!result) {
return c.json({ success: false }, { status: 404 });
}
return c.json({
success: true,
result,
});
} catch (e) {
console.error("Failed to fetch download URL from Anify", e);
return c.json(ErrorResponse, { status: 500 });
}
});
export default app;