From f2198c975e826b76d0139d528779957da75f8b6f Mon Sep 17 00:00:00 2001 From: ThePromidius Date: Sun, 20 Nov 2022 20:33:05 +0100 Subject: [PATCH] Kavita: Bugfix/expected url scheme (#14322) * pageListRequest now returns a correct url This method was apparently not called in previous versions but it does now in the preview version (r5254) when downloading thus failing because was returning a wrong url. * Changelog and bumped version --- src/all/kavita/CHANGELOG.md | 7 +++++++ src/all/kavita/build.gradle | 2 +- .../eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt | 8 +++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/all/kavita/CHANGELOG.md b/src/all/kavita/CHANGELOG.md index 4a89901b9..126399510 100644 --- a/src/all/kavita/CHANGELOG.md +++ b/src/all/kavita/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.3.8 + +### Fix + +* Fixed `Expected URL scheme 'http' or 'https` when downloading + ## 1.3.7 ### Features @@ -6,6 +12,7 @@ * New Filter: Year release filter ### Fix + * Filters can now be used together with search * Epub and pdfs no longer show in format filter (currently not supported) diff --git a/src/all/kavita/build.gradle b/src/all/kavita/build.gradle index 86079c5da..6109f31f0 100644 --- a/src/all/kavita/build.gradle +++ b/src/all/kavita/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'Kavita' pkgNameSuffix = 'all.kavita' extClass = '.KavitaFactory' - extVersionCode = 7 + extVersionCode = 8 } dependencies { diff --git a/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt b/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt index 474ef0773..711144197 100644 --- a/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt +++ b/src/all/kavita/src/eu/kanade/tachiyomi/extension/all/kavita/Kavita.kt @@ -491,9 +491,8 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou * Fetches the "url" of each page from the chapter * **/ override fun pageListRequest(chapter: SChapter): Request { - return GET("${chapter.url}/Reader/chapter-info") + return GET("$apiUrl/${chapter.url}", headersBuilder().build()) } - override fun fetchPageList(chapter: SChapter): Observable> { val chapterId = chapter.url val numPages = chapter.scanlator?.replace(" pages", "")?.toInt() @@ -850,7 +849,10 @@ class Kavita(private val suffix: String = "") : ConfigurableSource, UnmeteredSou } override fun headersBuilder(): Headers.Builder { - if (jwtToken.isEmpty()) throw LoginErrorException("401 Error\nOPDS address got modified or is incorrect") + if (jwtToken.isEmpty()) { + doLogin() + if (jwtToken.isEmpty()) throw LoginErrorException("Error: jwt token is empty.\nTry opening the extension first") + } return Headers.Builder() .add("User-Agent", "Tachiyomi Kavita v${AppInfo.getVersionName()}") .add("Content-Type", "application/json")