support for headless browser & changes on book api

This commit is contained in:
2025-12-03 20:40:53 +01:00
parent 8e20743e8b
commit 920ce19cc2
9 changed files with 201 additions and 22 deletions

View File

@@ -130,7 +130,7 @@ async function loadChapters(idForFetch) {
try {
const fetchUrl = extensionName
? `/api/book/${idForFetch}/chapters`
? `/api/book/${idForFetch}/chapters?ext=${extensionName}`
: `/api/book/${idForFetch}/chapters`;
const res = await fetch(fetchUrl);
@@ -174,7 +174,7 @@ function populateProviderFilter() {
if (providers.length > 0) {
select.style.display = 'inline-block';
select.innerHTML = '<option value="all">All Providers</option>';
select.innerHTML = '';
providers.forEach(prov => {
const opt = document.createElement('option');
@@ -276,7 +276,9 @@ function updatePagination() {
function openReader(bookId, chapterId, provider) {
const c = encodeURIComponent(chapterId);
const p = encodeURIComponent(provider);
window.location.href = `/read/${p}/${c}/${bookId}`;
let extension = "";
if (extensionName) extension = "?" + extensionName;
window.location.href = `/read/${p}/${c}/${bookId}${extension}`;
}
init();