diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt index 985dcaca2..de917dd31 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension import android.content.Context import android.graphics.drawable.Drawable import com.jakewharton.rxrelay.BehaviorRelay +import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.plusAssign import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi @@ -15,8 +16,10 @@ import eu.kanade.tachiyomi.extension.util.ExtensionLoader import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.util.lang.launchNow +import eu.kanade.tachiyomi.util.system.logcat import eu.kanade.tachiyomi.util.system.toast import kotlinx.coroutines.async +import logcat.LogPriority import rx.Observable import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -160,7 +163,8 @@ class ExtensionManager( val extensions: List = try { api.findExtensions() } catch (e: Exception) { - context.toast(e.message) + logcat(LogPriority.ERROR, e) + context.toast(R.string.extension_api_error) emptyList() } 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 308b3782d..87e85a4dd 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 @@ -22,11 +22,19 @@ internal class ExtensionGithubApi { suspend fun findExtensions(): List { return withIOContext { - networkService.client + val extensions = networkService.client .newCall(GET("${REPO_URL_PREFIX}index.min.json")) .await() .parseAs>() .toExtensions() + + // Sanity check - a small number of extensions probably means something broke + // with the repo generator + if (extensions.size < 100) { + throw Exception() + } + + extensions } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a6ff4ad9b..6154b5aef 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -261,6 +261,7 @@ This extension was signed with an untrusted certificate and wasn\'t activated.\n\nA malicious extension could read any login credentials stored in Tachiyomi or execute arbitrary code.\n\nBy trusting this certificate you accept these risks. This extension is no longer available. This extension is not from the official Tachiyomi extensions list. + Failed to get extensions list Version: %1$s Language: %1$s 18+