MangaRock chapter delay fix 2 (#1460)

MangaRock chapter delay fix 2
This commit is contained in:
Mike 2019-09-04 07:12:46 -04:00 committed by Eugene
parent 8eb67a4ee6
commit 498879ec2c
2 changed files with 9 additions and 7 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Manga Rock' appName = 'Tachiyomi: Manga Rock'
pkgNameSuffix = 'en.mangarock' pkgNameSuffix = 'en.mangarock'
extClass = '.MangaRock' extClass = '.MangaRock'
extVersionCode = 13 extVersionCode = 14
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -12,7 +12,12 @@ import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.model.SChapter import eu.kanade.tachiyomi.source.model.SChapter
import eu.kanade.tachiyomi.source.model.SManga import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.HttpSource
import okhttp3.* import okhttp3.MediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.Response
import okhttp3.ResponseBody
import org.json.JSONObject import org.json.JSONObject
import rx.Observable import rx.Observable
import java.util.ArrayList import java.util.ArrayList
@ -35,9 +40,6 @@ class MangaRock : HttpSource() {
override val supportsLatest = true override val supportsLatest = true
override fun headersBuilder(): Headers.Builder = Headers.Builder()
.add("Origin", "https://mangarock.com")
// Handles the page decoding // Handles the page decoding
override val client: OkHttpClient = super.client.newBuilder().addInterceptor(fun(chain): Response { override val client: OkHttpClient = super.client.newBuilder().addInterceptor(fun(chain): Response {
val url = chain.request().url().toString() val url = chain.request().url().toString()
@ -186,11 +188,11 @@ class MangaRock : HttpSource() {
private fun getMangaApiRequest(manga: SManga): Request { private fun getMangaApiRequest(manga: SManga): Request {
// Handle older entries with API URL ("/info?oid=mrs-series-...") // Handle older entries with API URL ("/info?oid=mrs-series-...")
if (manga.url.startsWith("/info")) { if (manga.url.startsWith("/info")) {
return GET("$apiUrl${manga.url}&country=", headers) return GET("$apiUrl${manga.url}&Country=", headers)
} }
val oid = manga.url.substringAfterLast("/") val oid = manga.url.substringAfterLast("/")
return GET("$apiUrl/info?oid=$oid&country=", headers) return GET("$apiUrl/info?oid=$oid&Country=", headers)
} }
override fun mangaDetailsParse(response: Response) = SManga.create().apply { override fun mangaDetailsParse(response: Response) = SManga.create().apply {