[RU]Newbie replacing empty pages on error logo (#11045)

This commit is contained in:
e-shl 2022-03-08 18:13:58 +05:00 committed by GitHub
parent b1dfa39377
commit 407f6029b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'NewManga(Newbie)'
pkgNameSuffix = 'ru.newbie'
extClass = '.Newbie'
extVersionCode = 7
extVersionCode = 8
}
dependencies {

View File

@ -291,10 +291,7 @@ class Newbie : HttpSource() {
val result = mutableListOf<Page>()
pages.forEach { page ->
(1..page.slices!!).map { i ->
val imageUrlCall = API_URL + chapter.url + "/${page.id}?slice=$i"
val bodyLength = client.newCall(GET(imageUrlCall, headers)).execute().body!!.contentLength()
if (bodyLength > 320)
result.add(Page(result.size, "", imageUrlCall))
result.add(Page(result.size, API_URL + chapter.url + "/${page.id}?slice=$i"))
}
}
return result
@ -309,7 +306,13 @@ class Newbie : HttpSource() {
}
}
override fun fetchImageUrl(page: Page): Observable<String> = Observable.just(page.imageUrl!!)
override fun fetchImageUrl(page: Page): Observable<String> {
val bodyLength = client.newCall(GET(page.url, headers)).execute().body!!.contentLength()
return if (bodyLength > 320)
Observable.just(page.url)
else
Observable.just("$baseUrl/error-page/img/logo-fullsize.png")
}
override fun imageUrlRequest(page: Page): Request = throw NotImplementedError("Unused")