AS: fix for j2k (#16871)
This commit is contained in:
parent
2d3b223259
commit
750d06f90d
|
@ -63,21 +63,26 @@ class AsuraScansEn : MangaThemesia(
|
||||||
|
|
||||||
// Temp Url for manga/chapter
|
// Temp Url for manga/chapter
|
||||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||||
val newManga = manga.permUrlToTemp()
|
val newManga = manga.titleToUrlFrag()
|
||||||
|
|
||||||
return super.fetchChapterList(newManga)
|
return super.fetchChapterList(newManga)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
||||||
val newManga = manga.permUrlToTemp()
|
val newManga = manga.titleToUrlFrag()
|
||||||
|
|
||||||
return super.fetchMangaDetails(newManga)
|
return super.fetchMangaDetails(newManga)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMangaUrl(manga: SManga): String {
|
override fun getMangaUrl(manga: SManga): String {
|
||||||
val newManga = manga.permUrlToTemp()
|
val dbSlug = manga.url
|
||||||
|
.substringBefore("#")
|
||||||
|
.removeSuffix("/")
|
||||||
|
.substringAfterLast("/")
|
||||||
|
|
||||||
return baseUrl + newManga.url
|
val storedSlug = getSlugMap()[dbSlug] ?: dbSlug
|
||||||
|
|
||||||
|
return "$baseUrl$mangaUrlDirectory/$storedSlug/"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip scriptPages
|
// Skip scriptPages
|
||||||
|
@ -124,16 +129,10 @@ class AsuraScansEn : MangaThemesia(
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun SManga.permUrlToTemp(): SManga {
|
private fun SManga.titleToUrlFrag(): SManga {
|
||||||
return try {
|
return try {
|
||||||
val dbSlug = this.url
|
|
||||||
.removeSuffix("/")
|
|
||||||
.substringAfterLast("/")
|
|
||||||
|
|
||||||
val storedSlug = getSlugMap()[dbSlug] ?: dbSlug
|
|
||||||
|
|
||||||
this.apply {
|
this.apply {
|
||||||
url = "$mangaUrlDirectory/$storedSlug/#${title.toSearchQuery()}"
|
url = "$url#${title.toSearchQuery()}"
|
||||||
}
|
}
|
||||||
} catch (e: UninitializedPropertyAccessException) {
|
} catch (e: UninitializedPropertyAccessException) {
|
||||||
// when called from deep link, title is not present
|
// when called from deep link, title is not present
|
||||||
|
@ -143,26 +142,31 @@ class AsuraScansEn : MangaThemesia(
|
||||||
|
|
||||||
private fun urlChangeInterceptor(chain: Interceptor.Chain): Response {
|
private fun urlChangeInterceptor(chain: Interceptor.Chain): Response {
|
||||||
val request = chain.request()
|
val request = chain.request()
|
||||||
val response = chain.proceed(request)
|
|
||||||
|
|
||||||
val frag = request.url.fragment
|
val frag = request.url.fragment
|
||||||
|
|
||||||
if (frag.isNullOrEmpty()) {
|
if (frag.isNullOrEmpty()) {
|
||||||
return response
|
return chain.proceed(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val dbSlug = request.url.toString()
|
||||||
|
.substringBefore("#")
|
||||||
|
.removeSuffix("/")
|
||||||
|
.substringAfterLast("/")
|
||||||
|
|
||||||
|
val slugMap = getSlugMap().toMutableMap()
|
||||||
|
|
||||||
|
val storedSlug = slugMap[dbSlug] ?: dbSlug
|
||||||
|
|
||||||
|
val response = chain.proceed(
|
||||||
|
request.newBuilder()
|
||||||
|
.url("$baseUrl$mangaUrlDirectory/$storedSlug/")
|
||||||
|
.build(),
|
||||||
|
)
|
||||||
|
|
||||||
if (!response.isSuccessful && response.code == 404) {
|
if (!response.isSuccessful && response.code == 404) {
|
||||||
response.close()
|
response.close()
|
||||||
|
|
||||||
val dbSlug = request.url.toString()
|
|
||||||
.substringBefore("#")
|
|
||||||
.removeSuffix("/")
|
|
||||||
.substringAfterLast("/")
|
|
||||||
|
|
||||||
val slugMap = getSlugMap().toMutableMap()
|
|
||||||
|
|
||||||
val storedSlug = slugMap[dbSlug] ?: dbSlug
|
|
||||||
|
|
||||||
val newSlug = getNewSlug(storedSlug, frag)
|
val newSlug = getNewSlug(storedSlug, frag)
|
||||||
?: throw IOException("Migrate from Asura to Asura")
|
?: throw IOException("Migrate from Asura to Asura")
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class MangaThemesiaGenerator : ThemeSourceGenerator {
|
||||||
override val baseVersionCode: Int = 25
|
override val baseVersionCode: Int = 25
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
MultiLang("Asura Scans", "https://www.asurascans.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 22),
|
MultiLang("Asura Scans", "https://www.asurascans.com", listOf("en", "tr"), className = "AsuraScansFactory", pkgName = "asurascans", overrideVersionCode = 23),
|
||||||
MultiLang("Flame Scans", "https://flamescans.org", listOf("en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 4),
|
MultiLang("Flame Scans", "https://flamescans.org", listOf("en"), className = "FlameScansFactory", pkgName = "flamescans", overrideVersionCode = 4),
|
||||||
MultiLang("Komik Lab", "https://komiklab.com", listOf("en", "id"), className = "KomikLabFactory", pkgName = "komiklab", overrideVersionCode = 2),
|
MultiLang("Komik Lab", "https://komiklab.com", listOf("en", "id"), className = "KomikLabFactory", pkgName = "komiklab", overrideVersionCode = 2),
|
||||||
MultiLang("Miau Scan", "https://miauscan.com", listOf("es", "pt-BR")),
|
MultiLang("Miau Scan", "https://miauscan.com", listOf("es", "pt-BR")),
|
||||||
|
|
Loading…
Reference in New Issue