Change extension repo to extension store and add support for newer extension index format (#3349)

This commit is contained in:
AntsyLich
2026-06-03 06:35:44 +06:00
committed by GitHub
parent 748211c19b
commit b446d2a6b1
64 changed files with 1279 additions and 1218 deletions
@@ -4,8 +4,7 @@ import eu.kanade.domain.source.service.SourcePreferences
import logcat.LogPriority
import mihon.core.migration.Migration
import mihon.core.migration.MigrationContext
import mihon.domain.extensionrepo.exception.SaveExtensionRepoException
import mihon.domain.extensionrepo.repository.ExtensionRepoRepository
import mihon.domain.extension.repository.ExtensionStoreRepository
import tachiyomi.core.common.util.lang.withIOContext
import tachiyomi.core.common.util.system.logcat
@@ -14,18 +13,14 @@ class TrustExtensionRepositoryMigration : Migration {
override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext {
val sourcePreferences = migrationContext.get<SourcePreferences>() ?: return@withIOContext false
val extensionRepositoryRepository =
migrationContext.get<ExtensionRepoRepository>() ?: return@withIOContext false
val repository = migrationContext.get<ExtensionStoreRepository>() ?: return@withIOContext false
for ((index, source) in sourcePreferences.extensionRepos.get().withIndex()) {
try {
extensionRepositoryRepository.upsertRepo(
source,
"Repo #${index + 1}",
null,
source,
"NOFINGERPRINT-${index + 1}",
repository.insertFromPreference(
indexUrl = source.removeSuffix("/index.min.json").removeSuffix("/index.json") + "/repo.json",
name = "Repo #${index + 1}",
)
} catch (e: SaveExtensionRepoException) {
} catch (e: Exception) {
logcat(LogPriority.ERROR, e) { "Error Migrating Extension Repo with baseUrl: $source" }
}
}