Extension API: change fallback source and logic (#7400)
* Extension API: change fallback source and logic * remove ghproxy (cherry picked from commit 284445c364baa47c4f29a524c3e00f1e18360abb) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt (cherry picked from commit ef20995e7d1ff8b37b7adeb6caf86420bcf600ae)
This commit is contained in:
parent
8b7b4e05d2
commit
184aa4e211
@ -28,14 +28,17 @@ internal class ExtensionGithubApi {
|
|||||||
|
|
||||||
suspend fun findExtensions(): List<Extension.Available> {
|
suspend fun findExtensions(): List<Extension.Available> {
|
||||||
return withIOContext {
|
return withIOContext {
|
||||||
val response = try {
|
val githubResponse = if (requiresFallbackSource) null else try {
|
||||||
networkService.client
|
networkService.client
|
||||||
.newCall(GET("${REPO_URL_PREFIX}index.min.json"))
|
.newCall(GET("${REPO_URL_PREFIX}index.min.json"))
|
||||||
.await()
|
.await()
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
logcat(LogPriority.ERROR, e) { "Failed to get extensions from GitHub" }
|
logcat(LogPriority.ERROR, e) { "Failed to get extensions from GitHub" }
|
||||||
requiresFallbackSource = true
|
requiresFallbackSource = true
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
val response = githubResponse ?: run {
|
||||||
networkService.client
|
networkService.client
|
||||||
.newCall(GET("${FALLBACK_REPO_URL_PREFIX}index.min.json"))
|
.newCall(GET("${FALLBACK_REPO_URL_PREFIX}index.min.json"))
|
||||||
.await()
|
.await()
|
||||||
@ -169,7 +172,7 @@ internal class ExtensionGithubApi {
|
|||||||
|
|
||||||
private const val BASE_URL = "https://raw.githubusercontent.com/"
|
private const val BASE_URL = "https://raw.githubusercontent.com/"
|
||||||
private const val REPO_URL_PREFIX = "${BASE_URL}tachiyomiorg/tachiyomi-extensions/repo/"
|
private const val REPO_URL_PREFIX = "${BASE_URL}tachiyomiorg/tachiyomi-extensions/repo/"
|
||||||
private const val FALLBACK_BASE_URL = "https://fastly.jsdelivr.net/gh/"
|
private const val FALLBACK_BASE_URL = "https://gcore.jsdelivr.net/gh/"
|
||||||
private const val FALLBACK_REPO_URL_PREFIX = "${FALLBACK_BASE_URL}tachiyomiorg/tachiyomi-extensions@repo/"
|
private const val FALLBACK_REPO_URL_PREFIX = "${FALLBACK_BASE_URL}tachiyomiorg/tachiyomi-extensions@repo/"
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
Loading…
x
Reference in New Issue
Block a user