Fix links without http/https in ru-remanga (#8169)
This commit is contained in:
parent
7e9ca28ae0
commit
628fceecd7
|
@ -6,7 +6,7 @@ ext {
|
||||||
extName = 'Remanga'
|
extName = 'Remanga'
|
||||||
pkgNameSuffix = 'ru.remanga'
|
pkgNameSuffix = 'ru.remanga'
|
||||||
extClass = '.Remanga'
|
extClass = '.Remanga'
|
||||||
extVersionCode = 33
|
extVersionCode = 34
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ package eu.kanade.tachiyomi.extension.ru.remanga
|
||||||
|
|
||||||
import BookDto
|
import BookDto
|
||||||
import BranchesDto
|
import BranchesDto
|
||||||
|
import ChunksPageDto
|
||||||
import GenresDto
|
import GenresDto
|
||||||
import LibraryDto
|
import LibraryDto
|
||||||
import MangaDetDto
|
import MangaDetDto
|
||||||
import PageDto
|
import PageDto
|
||||||
import ChunksPageDto
|
|
||||||
import PageWrapperDto
|
import PageWrapperDto
|
||||||
import SeriesWrapperDto
|
import SeriesWrapperDto
|
||||||
import UserDto
|
import UserDto
|
||||||
|
@ -345,20 +345,27 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun fixLink(link: String): String {
|
||||||
|
if (!link.startsWith("http")) {
|
||||||
|
return "https://remanga.org$link"
|
||||||
|
}
|
||||||
|
return link
|
||||||
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.N)
|
@TargetApi(Build.VERSION_CODES.N)
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response): List<Page> {
|
||||||
val body = response.body?.string()!!
|
val body = response.body?.string()!!
|
||||||
return try {
|
return try {
|
||||||
val page = json.decodeFromString<SeriesWrapperDto<PageDto>>(body)
|
val page = json.decodeFromString<SeriesWrapperDto<PageDto>>(body)
|
||||||
page.content.pages.filter { it.height > 10 }.map {
|
page.content.pages.filter { it.height > 10 }.map {
|
||||||
Page(it.page, "", it.link)
|
Page(it.page, "", fixLink(it.link))
|
||||||
}
|
}
|
||||||
} catch (e: SerializationException) {
|
} catch (e: SerializationException) {
|
||||||
val page = json.decodeFromString<SeriesWrapperDto<ChunksPageDto>>(body)
|
val page = json.decodeFromString<SeriesWrapperDto<ChunksPageDto>>(body)
|
||||||
val result = mutableListOf<Page>()
|
val result = mutableListOf<Page>()
|
||||||
page.content.pages.forEach {
|
page.content.pages.forEach {
|
||||||
it.filter { page -> page.height > 10 }.forEach { page ->
|
it.filter { page -> page.height > 10 }.forEach { page ->
|
||||||
result.add(Page(result.size, "", page.link))
|
result.add(Page(result.size, "", fixLink(page.link)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue