MangaGalaxy/Iken: don't proxy thumbnail urls (#4322)
This commit is contained in:
parent
4fc5107823
commit
fa37d45021
|
@ -2,4 +2,4 @@ plugins {
|
||||||
id("lib-multisrc")
|
id("lib-multisrc")
|
||||||
}
|
}
|
||||||
|
|
||||||
baseVersionCode = 1
|
baseVersionCode = 2
|
||||||
|
|
|
@ -4,7 +4,6 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.JsonPrimitive
|
import kotlinx.serialization.json.JsonPrimitive
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import java.text.ParseException
|
import java.text.ParseException
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
@ -31,14 +30,10 @@ class Manga(
|
||||||
private val seriesStatus: String? = null,
|
private val seriesStatus: String? = null,
|
||||||
val genres: List<Genre> = emptyList(),
|
val genres: List<Genre> = emptyList(),
|
||||||
) {
|
) {
|
||||||
fun toSManga(baseUrl: String) = SManga.create().apply {
|
fun toSManga() = SManga.create().apply {
|
||||||
url = "$slug#$id"
|
url = "$slug#$id"
|
||||||
title = postTitle
|
title = postTitle
|
||||||
thumbnail_url = "$baseUrl/_next/image".toHttpUrl().newBuilder().apply {
|
thumbnail_url = featuredImage
|
||||||
addQueryParameter("url", featuredImage)
|
|
||||||
addQueryParameter("w", "828")
|
|
||||||
addQueryParameter("q", "75")
|
|
||||||
}.toString()
|
|
||||||
author = this@Manga.author?.takeUnless { it.isEmpty() }
|
author = this@Manga.author?.takeUnless { it.isEmpty() }
|
||||||
artist = this@Manga.artist?.takeUnless { it.isEmpty() }
|
artist = this@Manga.artist?.takeUnless { it.isEmpty() }
|
||||||
description = buildString {
|
description = buildString {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import kotlinx.serialization.json.Json
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
abstract class Iken(
|
abstract class Iken(
|
||||||
|
@ -43,7 +44,7 @@ abstract class Iken(
|
||||||
it.genres.map { genre ->
|
it.genres.map { genre ->
|
||||||
genre.name to genre.id.toString()
|
genre.name to genre.id.toString()
|
||||||
}
|
}
|
||||||
}
|
}.distinct()
|
||||||
}
|
}
|
||||||
.associateBy { it.slug }
|
.associateBy { it.slug }
|
||||||
}
|
}
|
||||||
|
@ -56,7 +57,7 @@ abstract class Iken(
|
||||||
.map { it.absUrl("href").substringAfterLast("/series/") }
|
.map { it.absUrl("href").substringAfterLast("/series/") }
|
||||||
|
|
||||||
val entries = slugs.mapNotNull {
|
val entries = slugs.mapNotNull {
|
||||||
titleCache[it]?.toSManga(baseUrl)
|
titleCache[it]?.toSManga()
|
||||||
}
|
}
|
||||||
|
|
||||||
return MangasPage(entries, false)
|
return MangasPage(entries, false)
|
||||||
|
@ -84,7 +85,7 @@ abstract class Iken(
|
||||||
|
|
||||||
val entries = data.posts
|
val entries = data.posts
|
||||||
.filterNot { it.isNovel }
|
.filterNot { it.isNovel }
|
||||||
.map { it.toSManga(baseUrl) }
|
.map { it.toSManga() }
|
||||||
|
|
||||||
val hasNextPage = data.totalCount > (page * perPage)
|
val hasNextPage = data.totalCount > (page * perPage)
|
||||||
|
|
||||||
|
@ -98,32 +99,28 @@ abstract class Iken(
|
||||||
Filter.Header("Open popular mangas if genre filter is empty"),
|
Filter.Header("Open popular mangas if genre filter is empty"),
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun mangaDetailsRequest(manga: SManga): Request {
|
|
||||||
val id = manga.url.substringAfterLast("#")
|
|
||||||
val url = "$baseUrl/api/chapters?postId=$id&skip=0&take=1000&order=desc&userid="
|
|
||||||
|
|
||||||
return GET(url, headers)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getMangaUrl(manga: SManga): String {
|
override fun getMangaUrl(manga: SManga): String {
|
||||||
val slug = manga.url.substringBeforeLast("#")
|
val slug = manga.url.substringBeforeLast("#")
|
||||||
|
|
||||||
return "$baseUrl/series/$slug"
|
return "$baseUrl/series/$slug"
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
||||||
val data = response.parseAs<Post<Manga>>()
|
val slug = manga.url.substringBeforeLast("#")
|
||||||
|
val update = titleCache[slug]?.toSManga() ?: manga
|
||||||
|
|
||||||
assert(!data.post.isNovel) { "Novels are unsupported" }
|
return Observable.just(update)
|
||||||
|
|
||||||
// genres are only returned in search call
|
|
||||||
// and not when fetching details
|
|
||||||
return data.post.toSManga(baseUrl).apply {
|
|
||||||
genre = titleCache[data.post.slug]?.getGenres()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun chapterListRequest(manga: SManga) = mangaDetailsRequest(manga)
|
override fun mangaDetailsParse(response: Response) =
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
|
||||||
|
override fun chapterListRequest(manga: SManga): Request {
|
||||||
|
val id = manga.url.substringAfterLast("#")
|
||||||
|
val url = "$baseUrl/api/chapters?postId=$id&skip=0&take=1000&order=desc&userid="
|
||||||
|
|
||||||
|
return GET(url, headers)
|
||||||
|
}
|
||||||
|
|
||||||
override fun chapterListParse(response: Response): List<SChapter> {
|
override fun chapterListParse(response: Response): List<SChapter> {
|
||||||
val data = response.parseAs<Post<ChapterListResponse>>()
|
val data = response.parseAs<Post<ChapterListResponse>>()
|
||||||
|
|
Loading…
Reference in New Issue