Skip to content

Commit

Permalink
FIx Ridibooks : getting pages (#7178)
Browse files Browse the repository at this point in the history
Fixes #7177
  • Loading branch information
MikeZeDev authored and ronny1982 committed Jul 27, 2024
1 parent 20b092c commit e2a02ea
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/web/mjs/connectors/Ridibooks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default class Ridibooks extends Connector {
login: `${this.url}/account/login`
};
this.apiUrl = "https://api.ridibooks.com";
this.pagesApi = "https://view.ridibooks.com";
}

async _getMangas() {
Expand Down Expand Up @@ -43,16 +42,22 @@ export default class Ridibooks extends Connector {
}

async _getPages(chapter) {
const uri = new URL(`/generate/${chapter.id}`, this.pagesApi);
const request = new Request(uri, this.requestOptions);
const data = await this.fetchJSON(request);
if (!data.success) return [];
return data.pages.map(page => page.src);
const uri = new URL('/api/web-viewer/generate', this.url);
const data = await this.fetchJSON(new Request(uri.href, {
method: 'POST',
body: JSON.stringify({
book_id: chapter.id
}),
headers: {
'Content-Type': 'application/json',
},
}));
return data.success ? data.data.pages.map(page =>page.src) : [];
}

async _getMangaFromURI(uri) {
const request = new Request(uri, this.requestOptions);
const data = await Engine.Request.fetchUI(request, "bookDetail");
return new Manga(this, data.series_id, data.series_title);
}
}
}

0 comments on commit e2a02ea

Please sign in to comment.