reacto: images not called directly in routes

This commit is contained in:
Julien Froidefond
2025-02-17 08:17:31 +01:00
parent 50e583f58d
commit 4ae606ea09
6 changed files with 63 additions and 59 deletions

View File

@@ -98,6 +98,20 @@ export class BookService extends BaseApiService {
}
}
static async getThumbnail(bookId: string): Promise<Response> {
try {
const response = await ImageService.getImage(`books/${bookId}/thumbnail`);
return new Response(response.buffer, {
headers: {
"Content-Type": response.contentType || "image/jpeg",
"Cache-Control": "public, max-age=31536000, immutable",
},
});
} catch (error) {
throw this.handleError(error, "Impossible de récupérer la miniature du livre");
}
}
static getPageUrl(bookId: string, pageNumber: number): string {
return `/api/komga/images/books/${bookId}/pages/${pageNumber}`;
}