support for novels and lot of formats for books

This commit is contained in:
2025-12-28 18:31:54 +01:00
parent 6222e7736f
commit 48e1939d2a
16 changed files with 1798 additions and 236 deletions

View File

@@ -18,7 +18,10 @@ document.addEventListener('DOMContentLoaded', () => {
async function checkLocalLibraryEntry() {
try {
const res = await fetch(`/api/library/manga/${bookId}`);
const libraryType =
bookData?.entry_type === 'NOVEL' ? 'novels' : 'manga';
const res = await fetch(`/api/library/${libraryType}/${bookId}`);
if (!res.ok) return;
const data = await res.json();
@@ -38,18 +41,6 @@ async function checkLocalLibraryEntry() {
}
}
function markAsLocal() {
isLocal = true;
const pill = document.getElementById('local-pill');
if (pill) {
pill.textContent = 'Local';
pill.style.display = 'inline-flex';
pill.style.background = 'rgba(34, 197, 94, 0.2)';
pill.style.color = '#22c55e';
pill.style.borderColor = 'rgba(34, 197, 94, 0.3)';
}
}
async function init() {
try {
const urlData = URLUtils.parseEntityPath('book');
@@ -61,8 +52,8 @@ async function init() {
extensionName = urlData.extensionName;
bookId = urlData.entityId;
bookSlug = urlData.slug;
await checkLocalLibraryEntry();
await loadBookMetadata();
await checkLocalLibraryEntry();
await loadAvailableExtensions();
await loadChapters();
@@ -220,7 +211,7 @@ async function loadChapters(targetProvider = null) {
if (isLocalRequest) {
// Nuevo endpoint para archivos locales
fetchUrl = `/api/library/manga/${bookId}/units`;
fetchUrl = `/api/library/${bookId}/units`;
} else {
const source = extensionName || 'anilist';
fetchUrl = `/api/book/${bookId}/chapters?source=${source}`;