parent
5e808c0dbb
commit
1604adaa58
|
@ -5,7 +5,7 @@ ext {
|
||||||
appName = 'Tachiyomi: Guya'
|
appName = 'Tachiyomi: Guya'
|
||||||
pkgNameSuffix = "en.guya"
|
pkgNameSuffix = "en.guya"
|
||||||
extClass = '.Guya'
|
extClass = '.Guya'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import eu.kanade.tachiyomi.source.ConfigurableSource
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.support.v7.preference.ListPreference
|
import android.support.v7.preference.ListPreference
|
||||||
import android.support.v7.preference.PreferenceScreen
|
import android.support.v7.preference.PreferenceScreen
|
||||||
|
import eu.kanade.tachiyomi.extension.BuildConfig
|
||||||
import okhttp3.*
|
import okhttp3.*
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
@ -26,6 +27,10 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
override val supportsLatest = false
|
override val supportsLatest = false
|
||||||
override val lang = "en"
|
override val lang = "en"
|
||||||
|
|
||||||
|
override fun headersBuilder() = Headers.Builder().apply {
|
||||||
|
add("User-Agent", "Tachiyomi/${BuildConfig.VERSION_NAME}")
|
||||||
|
}
|
||||||
|
|
||||||
private val Scanlators: ScanlatorStore = ScanlatorStore()
|
private val Scanlators: ScanlatorStore = ScanlatorStore()
|
||||||
|
|
||||||
// Preferences confirguration
|
// Preferences confirguration
|
||||||
|
@ -36,7 +41,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
// Request builder for the "browse" page of the manga
|
// Request builder for the "browse" page of the manga
|
||||||
override fun popularMangaRequest(page: Int): Request {
|
override fun popularMangaRequest(page: Int): Request {
|
||||||
return GET("$baseUrl/api/get_all_series")
|
return GET("$baseUrl/api/get_all_series/", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the response object from the request
|
// Gets the response object from the request
|
||||||
|
@ -47,7 +52,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
// Overridden to use our overload
|
// Overridden to use our overload
|
||||||
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
||||||
return clientBuilder().newCall(GET("$baseUrl/api/get_all_series/"))
|
return clientBuilder().newCall(GET("$baseUrl/api/get_all_series/", headers))
|
||||||
.asObservableSuccess()
|
.asObservableSuccess()
|
||||||
.map {response ->
|
.map {response ->
|
||||||
mangaDetailsParse(response, manga)
|
mangaDetailsParse(response, manga)
|
||||||
|
@ -56,7 +61,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
// Called when the series is loaded, or when opening in browser
|
// Called when the series is loaded, or when opening in browser
|
||||||
override fun mangaDetailsRequest(manga: SManga): Request {
|
override fun mangaDetailsRequest(manga: SManga): Request {
|
||||||
return GET("$baseUrl/reader/series/" + manga.url)
|
return GET("$baseUrl/reader/series/" + manga.url + "/", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stub
|
// Stub
|
||||||
|
@ -71,7 +76,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
// Gets the chapter list based on the series being viewed
|
// Gets the chapter list based on the series being viewed
|
||||||
override fun chapterListRequest(manga: SManga): Request {
|
override fun chapterListRequest(manga: SManga): Request {
|
||||||
return GET("$baseUrl/api/series/" + manga.url)
|
return GET("$baseUrl/api/series/" + manga.url + "/", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called after the request
|
// Called after the request
|
||||||
|
@ -123,7 +128,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
return GET("$baseUrl/api/get_all_series")
|
return GET("$baseUrl/api/get_all_series/", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun searchMangaParse(response: Response): MangasPage {
|
override fun searchMangaParse(response: Response): MangasPage {
|
||||||
|
@ -132,7 +137,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
|
|
||||||
private fun searchMangaParse(response: Response, query: String): MangasPage {
|
private fun searchMangaParse(response: Response, query: String): MangasPage {
|
||||||
val res = response.body()!!.string()
|
val res = response.body()!!.string()
|
||||||
var json = JSONObject(res)
|
val json = JSONObject(res)
|
||||||
val truncatedJSON = JSONObject()
|
val truncatedJSON = JSONObject()
|
||||||
|
|
||||||
val iter = json.keys()
|
val iter = json.keys()
|
||||||
|
@ -299,7 +304,7 @@ open class Guya() : ConfigurableSource, HttpSource() {
|
||||||
private fun update() {
|
private fun update() {
|
||||||
if (scanlatorMap.isEmpty() && !polling) {
|
if (scanlatorMap.isEmpty() && !polling) {
|
||||||
polling = true
|
polling = true
|
||||||
clientBuilder().newCall(GET("$baseUrl/api/get_all_groups")).enqueue(
|
clientBuilder().newCall(GET("$baseUrl/api/get_all_groups/", headers)).enqueue(
|
||||||
object: Callback {
|
object: Callback {
|
||||||
override fun onResponse(call: Call, response: Response) {
|
override fun onResponse(call: Call, response: Response) {
|
||||||
val json = JSONObject(response.body()!!.string())
|
val json = JSONObject(response.body()!!.string())
|
||||||
|
|
Loading…
Reference in New Issue