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:
funkyhippo 2021-03-28 13:20:51 -07:00 committed by GitHub
parent 39ac1f81a6
commit d604f06811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 47 deletions

View File

@ -4,8 +4,8 @@ apply plugin: 'kotlin-android'
ext {
extName = 'Cubari'
pkgNameSuffix = "all.cubari"
extClass = '.Cubari'
extVersionCode = 1
extClass = '.CubariFactory'
extVersionCode = 2
libVersion = '1.2'
}

View File

@ -17,12 +17,11 @@ import org.json.JSONArray
import org.json.JSONObject
import rx.Observable
open class Cubari : HttpSource() {
open class Cubari(override val lang: String) : HttpSource() {
final override val name = "Cubari"
final override val baseUrl = "https://cubari.moe"
final override val supportsLatest = true
final override val lang = "all"
override fun headersBuilder() = Headers.Builder().apply {
add(
@ -218,7 +217,7 @@ open class Cubari : HttpSource() {
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)
} 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 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 {
PINNED,
UNPINNED

View File

@ -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")
)
}

View File

@ -17,20 +17,6 @@
android:host="guya.moe"
android:pathPattern="/read/manga/..*"
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>
</activity>
</application>

View File

@ -5,7 +5,7 @@ ext {
extName = 'Guya'
pkgNameSuffix = "en.guya"
extClass = '.Guya'
extVersionCode = 17
extVersionCode = 18
libVersion = '1.2'
}

View File

@ -21,10 +21,7 @@ class GuyaUrlActivity : Activity() {
val pathSegments = intent?.data?.pathSegments
if (host != null && pathSegments != null) {
val query = when (host) {
"m.imgur.com", "imgur.com" -> fromImgur(pathSegments)
else -> fromGuya(pathSegments)
}
val query = fromGuya(pathSegments)
if (query == null) {
Log.e("GuyaUrlActivity", "Unable to parse URI from intent $intent")
@ -49,29 +46,12 @@ class GuyaUrlActivity : Activity() {
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? {
if (pathSegments.size >= 3) {
return when (pathSegments[0]) {
"proxy" -> {
val source = pathSegments[1]
val id = pathSegments[2]
"${Guya.PROXY_PREFIX}$source/$id"
}
else -> {
val slug = pathSegments[2]
"${Guya.SLUG_PREFIX}$slug"
}
}
return if (pathSegments.size >= 3) {
val slug = pathSegments[2]
"${Guya.SLUG_PREFIX}$slug"
} else {
null
}
return null
}
}