[RU]Remanga fix out-of-sync manga in the library and catalog (#9506)

This commit is contained in:
e-shl 2021-10-18 14:15:47 +05:00 committed by GitHub
parent eba9fad248
commit 237689c1b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 11 deletions

View File

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

View File

@ -137,8 +137,8 @@ class Remanga : ConfigurableSource, HttpSource() {
title = en_name
url = "/api/titles/$dir/"
thumbnail_url = if (img.high.isNotEmpty()) {
"$baseUrl/${img.high}"
} else "$baseUrl/${img.mid}"
baseUrl + img.high
} else baseUrl + img.mid
}
private val simpleDateFormat by lazy { SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US) }
@ -239,7 +239,7 @@ class Remanga : ConfigurableSource, HttpSource() {
// Do not change the title name to ensure work with a multilingual catalog!
title = en_name
url = "/api/titles/$dir/"
thumbnail_url = "$baseUrl/${img.high}"
thumbnail_url = baseUrl + img.high
var altName = ""
if (another_name.isNotEmpty()) {
altName = "Альтернативные названия:\n" + another_name + "\n\n"
@ -250,11 +250,7 @@ class Remanga : ConfigurableSource, HttpSource() {
}
}
private fun titleDetailsRequest(manga: SManga): Request {
val titleId = manga.url
val newHeaders = headersBuilder().build()
return GET("$baseUrl/$titleId", newHeaders)
return GET(baseUrl + manga.url, headers)
}
// Workaround to allow "Open in browser" use the real URL.
@ -284,7 +280,7 @@ class Remanga : ConfigurableSource, HttpSource() {
}
private fun mangaBranches(manga: SManga): List<BranchesDto> {
val responseString = client.newCall(GET("$baseUrl/${manga.url}")).execute().body?.string() ?: return emptyList()
val responseString = client.newCall(GET(baseUrl + manga.url)).execute().body?.string() ?: return emptyList()
// manga requiring login return "content" as a JsonArray instead of the JsonObject we expect
val content = json.decodeFromString<JsonObject>(responseString)["content"]
return if (content is JsonObject) {
@ -304,7 +300,7 @@ class Remanga : ConfigurableSource, HttpSource() {
return Observable.just(listOf())
}
manga.status == SManga.LICENSED -> {
Observable.error(Exception("Licensed - No chapters to show"))
Observable.error(Exception("Лицензировано - Нет глав"))
}
else -> {
val branchId = branch.maxByOrNull { selector(it) }!!.id