support for headless browser & changes on book api
This commit is contained in:
@@ -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();
|
||||
@@ -10,6 +10,8 @@ const nextBtn = document.getElementById('next-chapter');
|
||||
const lnSettings = document.getElementById('ln-settings');
|
||||
const mangaSettings = document.getElementById('manga-settings');
|
||||
|
||||
const hasQuery = window.location.search.length > 0;
|
||||
|
||||
const config = {
|
||||
ln: {
|
||||
fontSize: 18,
|
||||
@@ -125,7 +127,9 @@ async function loadChapter() {
|
||||
`;
|
||||
|
||||
try {
|
||||
const res = await fetch(`/api/book/${bookId}/${chapter}/${provider}`);
|
||||
let ext = ""
|
||||
if(hasQuery) ext = "?ext=yes"
|
||||
const res = await fetch(`/api/book/${bookId}/${chapter}/${provider}${ext}`);
|
||||
const data = await res.json();
|
||||
|
||||
if (data.title) {
|
||||
|
||||
Reference in New Issue
Block a user