From 6024f6175bffa2ed27211ae6f3b27ef3b4e067cc Mon Sep 17 00:00:00 2001 From: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Date: Thu, 30 Jun 2022 06:34:25 +0800 Subject: [PATCH] Extension API: change fallback source and logic (#7400) * Extension API: change fallback source and logic * remove ghproxy (cherry picked from commit 284445c364baa47c4f29a524c3e00f1e18360abb) --- .../kanade/tachiyomi/extension/api/ExtensionGithubApi.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt index 92bae0dcb5..c395ecb4e4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/api/ExtensionGithubApi.kt @@ -27,14 +27,17 @@ internal class ExtensionGithubApi { suspend fun findExtensions(): List { return withIOContext { - val response = try { + val githubResponse = if (requiresFallbackSource) null else try { networkService.client .newCall(GET("${REPO_URL_PREFIX}index.min.json")) .await() } catch (e: Throwable) { logcat(LogPriority.ERROR, e) { "Failed to get extensions from GitHub" } requiresFallbackSource = true + null + } + val response = githubResponse ?: run { networkService.client .newCall(GET("${FALLBACK_REPO_URL_PREFIX}index.min.json")) .await() @@ -129,7 +132,7 @@ internal class ExtensionGithubApi { } private const val REPO_URL_PREFIX = "https://raw.githubusercontent.com/tachiyomiorg/tachiyomi-extensions/repo/" -private const val FALLBACK_REPO_URL_PREFIX = "https://fastly.jsdelivr.net/gh/tachiyomiorg/tachiyomi-extensions@repo/" +private const val FALLBACK_REPO_URL_PREFIX = "https://gcore.jsdelivr.net/gh/tachiyomiorg/tachiyomi-extensions@repo/" @Serializable private data class ExtensionJsonObject(