[RU]Remanga update errors logic (#15870)

This commit is contained in:
Eshlender 2023-03-29 03:11:34 +05:00 committed by GitHub
parent 7d2974465e
commit 84e849aaca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Remanga'
pkgNameSuffix = 'ru.remanga'
extClass = '.Remanga'
extVersionCode = 67
extVersionCode = 68
}
dependencies {

View File

@ -365,7 +365,7 @@ class Remanga : ConfigurableSource, HttpSource() {
.asObservable().doOnNext { response ->
if (!response.isSuccessful) {
response.close()
if (response.code == 401) warnLogin = true else throw Exception("HTTP error ${response.code}")
if (response.code == 404 && USER_ID == "") warnLogin = true else throw Exception("HTTP error ${response.code}")
}
}
.map { response ->
@ -404,11 +404,15 @@ class Remanga : ConfigurableSource, HttpSource() {
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
val branch = branches.getOrElse(manga.url.substringAfter("/api/titles/").substringBefore("/").substringBefore("?")) { mangaBranches(manga) }
return when {
manga.status == SManga.LICENSED && branch.isEmpty() -> {
manga.status == SManga.LICENSED && branch.maxByOrNull { selector(it) }!!.count_chapters == 0 -> {
Observable.error(Exception("Лицензировано - Нет глав"))
}
branch.isEmpty() -> {
return Observable.just(listOf())
if (USER_ID == "") {
Observable.error(Exception("Для просмотра 18+ контента необходима авторизация через WebView"))
} else {
return Observable.just(listOf())
}
}
else -> {
val mangaID = mangaIDs[manga.url.substringAfter("/api/titles/").substringBefore("/").substringBefore("?")]