fix: use anify as last source if other sources aren't recognized
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user