Migrate Guya proxy to Cubari, QoL updates to Cubari. (#6324)
* Remove Guya proxy intents. * Cubari sourceFactory for easier discoverability, search improvements.
This commit is contained in:
parent
39ac1f81a6
commit
d604f06811
|
@ -4,8 +4,8 @@ apply plugin: 'kotlin-android'
|
||||||
ext {
|
ext {
|
||||||
extName = 'Cubari'
|
extName = 'Cubari'
|
||||||
pkgNameSuffix = "all.cubari"
|
pkgNameSuffix = "all.cubari"
|
||||||
extClass = '.Cubari'
|
extClass = '.CubariFactory'
|
||||||
extVersionCode = 1
|
extVersionCode = 2
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,12 +17,11 @@ import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
|
|
||||||
open class Cubari : HttpSource() {
|
open class Cubari(override val lang: String) : HttpSource() {
|
||||||
|
|
||||||
final override val name = "Cubari"
|
final override val name = "Cubari"
|
||||||
final override val baseUrl = "https://cubari.moe"
|
final override val baseUrl = "https://cubari.moe"
|
||||||
final override val supportsLatest = true
|
final override val supportsLatest = true
|
||||||
final override val lang = "all"
|
|
||||||
|
|
||||||
override fun headersBuilder() = Headers.Builder().apply {
|
override fun headersBuilder() = Headers.Builder().apply {
|
||||||
add(
|
add(
|
||||||
|
@ -218,7 +217,7 @@ open class Cubari : HttpSource() {
|
||||||
searchMangaParse(response, trimmedQuery)
|
searchMangaParse(response, trimmedQuery)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> Observable.just(MangasPage(ArrayList(), false))
|
else -> throw Exception(SEARCH_FALLBACK_MSG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +229,7 @@ open class Cubari : HttpSource() {
|
||||||
|
|
||||||
return GET("$baseUrl/read/api/$source/series/$slug/", headers)
|
return GET("$baseUrl/read/api/$source/series/$slug/", headers)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
throw Exception("Unable to parse. Is your query in the format of ${Cubari.PROXY_PREFIX}<source>/<slug>?")
|
throw Exception(SEARCH_FALLBACK_MSG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,6 +344,8 @@ open class Cubari : HttpSource() {
|
||||||
const val ARTIST_FALLBACK = "Unknown"
|
const val ARTIST_FALLBACK = "Unknown"
|
||||||
const val DESCRIPTION_FALLBACK = "No description."
|
const val DESCRIPTION_FALLBACK = "No description."
|
||||||
|
|
||||||
|
const val SEARCH_FALLBACK_MSG = "Unable to parse. Is your query in the format of $PROXY_PREFIX<source>/<slug>?"
|
||||||
|
|
||||||
enum class SortType {
|
enum class SortType {
|
||||||
PINNED,
|
PINNED,
|
||||||
UNPINNED
|
UNPINNED
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package eu.kanade.tachiyomi.extension.all.cubari
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.source.Source
|
||||||
|
import eu.kanade.tachiyomi.source.SourceFactory
|
||||||
|
|
||||||
|
class CubariFactory : SourceFactory {
|
||||||
|
override fun createSources(): List<Source> = listOf(
|
||||||
|
Cubari("en"),
|
||||||
|
Cubari("all"),
|
||||||
|
Cubari("other")
|
||||||
|
)
|
||||||
|
}
|
|
@ -17,20 +17,6 @@
|
||||||
android:host="guya.moe"
|
android:host="guya.moe"
|
||||||
android:pathPattern="/read/manga/..*"
|
android:pathPattern="/read/manga/..*"
|
||||||
android:scheme="https" />
|
android:scheme="https" />
|
||||||
|
|
||||||
<data
|
|
||||||
android:host="guya.moe"
|
|
||||||
android:pathPattern="/proxy/..*"
|
|
||||||
android:scheme="https" />
|
|
||||||
|
|
||||||
<data
|
|
||||||
android:host="*imgur.com"
|
|
||||||
android:pathPattern="/a/..*"
|
|
||||||
android:scheme="https" />
|
|
||||||
<data
|
|
||||||
android:host="*imgur.com"
|
|
||||||
android:pathPattern="/gallery/..*"
|
|
||||||
android:scheme="https" />
|
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Guya'
|
extName = 'Guya'
|
||||||
pkgNameSuffix = "en.guya"
|
pkgNameSuffix = "en.guya"
|
||||||
extClass = '.Guya'
|
extClass = '.Guya'
|
||||||
extVersionCode = 17
|
extVersionCode = 18
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,7 @@ class GuyaUrlActivity : Activity() {
|
||||||
val pathSegments = intent?.data?.pathSegments
|
val pathSegments = intent?.data?.pathSegments
|
||||||
|
|
||||||
if (host != null && pathSegments != null) {
|
if (host != null && pathSegments != null) {
|
||||||
val query = when (host) {
|
val query = fromGuya(pathSegments)
|
||||||
"m.imgur.com", "imgur.com" -> fromImgur(pathSegments)
|
|
||||||
else -> fromGuya(pathSegments)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (query == null) {
|
if (query == null) {
|
||||||
Log.e("GuyaUrlActivity", "Unable to parse URI from intent $intent")
|
Log.e("GuyaUrlActivity", "Unable to parse URI from intent $intent")
|
||||||
|
@ -49,29 +46,12 @@ class GuyaUrlActivity : Activity() {
|
||||||
exitProcess(0)
|
exitProcess(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fromImgur(pathSegments: List<String>): String? {
|
|
||||||
if (pathSegments.size >= 2) {
|
|
||||||
val id = pathSegments[1]
|
|
||||||
|
|
||||||
return "${Guya.PROXY_PREFIX}imgur/$id"
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun fromGuya(pathSegments: MutableList<String>): String? {
|
private fun fromGuya(pathSegments: MutableList<String>): String? {
|
||||||
if (pathSegments.size >= 3) {
|
return if (pathSegments.size >= 3) {
|
||||||
return when (pathSegments[0]) {
|
val slug = pathSegments[2]
|
||||||
"proxy" -> {
|
"${Guya.SLUG_PREFIX}$slug"
|
||||||
val source = pathSegments[1]
|
} else {
|
||||||
val id = pathSegments[2]
|
null
|
||||||
"${Guya.PROXY_PREFIX}$source/$id"
|
|
||||||
}
|
|
||||||
else -> {
|
|
||||||
val slug = pathSegments[2]
|
|
||||||
"${Guya.SLUG_PREFIX}$slug"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue