Fix open in browser for existing MangaRock library items (#999)

This commit is contained in:
Eugene 2019-04-03 07:43:38 -04:00 committed by Carlos
parent bf4100995a
commit 6766428d0d
2 changed files with 18 additions and 8 deletions

View File

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

View File

@ -172,17 +172,27 @@ class MangaRock : HttpSource() {
}
}
// Always returns the "real" URL for the "Open in browser" action
override fun mangaDetailsRequest(manga: SManga): Request {
// Handle older entries with API URL ("/info?oid=mrs-series-...")
if (manga.url.startsWith("/info")) {
val oid = manga.url.substringAfterLast("=")
return GET("$baseUrl/manga/$oid", headers)
}
return super.mangaDetailsRequest(manga)
}
override fun chapterListRequest(manga: SManga) = getMangaApiRequest(manga)
private fun getMangaApiRequest(manga: SManga): Request {
return if (manga.url.contains("manga")) {
// Entries with "real" URL
val oid = manga.url.substringAfterLast("/")
GET("$apiUrl/info?oid=$oid", headers)
} else {
// Older entries with API URL
GET(apiUrl + manga.url, headers)
// Handle older entries with API URL ("/info?oid=mrs-series-...")
if (manga.url.startsWith("/info")) {
return GET(apiUrl + manga.url, headers)
}
val oid = manga.url.substringAfterLast("/")
return GET("$apiUrl/info?oid=$oid", headers)
}
override fun mangaDetailsParse(response: Response) = SManga.create().apply {