From 9d2a030bf588937b8f2a056d05998b4ceff5a587 Mon Sep 17 00:00:00 2001 From: Cuong-Tran Date: Sat, 1 Feb 2025 03:35:58 +0700 Subject: [PATCH] Remove extensions repo --- .github/ISSUE_TEMPLATE/config.yml | 10 +--- .github/ISSUE_TEMPLATE/report_issue.yml | 2 - .github/ISSUE_TEMPLATE/request_feature.yml | 2 - .../extension/interactor/TrustExtension.kt | 2 +- .../components/ExtensionReposContent.kt | 14 +++-- .../components/ExtensionReposDialogs.kt | 57 ++++--------------- .../browse/components/ExtensionReposScreen.kt | 10 ++-- .../extension/util/ExtensionLoader.kt | 8 +-- .../core/migration/migrations/Migrations.kt | 1 - .../OfficialExtensionRepositoryMigration.kt | 32 ----------- .../interactor/CreateExtensionRepo.kt | 7 +-- 11 files changed, 36 insertions(+), 109 deletions(-) delete mode 100644 app/src/main/java/mihon/core/migration/migrations/OfficialExtensionRepositoryMigration.kt diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 8dfd2f07b..ec828c361 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,5 @@ blank_issues_enabled: false contact_links: - - name: ⚠️ Extension/source issue - url: https://github.com/komikku-app/extensions/issues/new/choose - about: Issues and requests for official extensions and sources should be opened in the extensions repository instead - - name: 📦 Extensions - url: https://komikku-app.github.io/komikku-extensions/ - about: List of all available extensions with download links - - name: 🖥️ Mihon website - url: https://mihon.app/ + - name: 🖥️ Komikku website + url: https://komikku-app.github.io/ about: Guides, troubleshooting, and answers to common questions diff --git a/.github/ISSUE_TEMPLATE/report_issue.yml b/.github/ISSUE_TEMPLATE/report_issue.yml index 6c18b3f49..e9ac9da16 100644 --- a/.github/ISSUE_TEMPLATE/report_issue.yml +++ b/.github/ISSUE_TEMPLATE/report_issue.yml @@ -94,8 +94,6 @@ body: required: true - label: I have written a short but informative title. required: true - - label: If this is an issue with an official extension, I should be opening an issue in the [extensions repository](https://github.com/komikku-app/extensions/issues/new/choose). - required: true - label: I have gone through the [FAQ](https://mihon.app/docs/faq/general) and [troubleshooting guide](https://mihon.app/docs/guides/troubleshooting/). required: true - label: I have updated the app to version **[1.12.1](https://github.com/komikku-app/komikku/releases/latest)**. diff --git a/.github/ISSUE_TEMPLATE/request_feature.yml b/.github/ISSUE_TEMPLATE/request_feature.yml index 274bfd271..d55ab2091 100644 --- a/.github/ISSUE_TEMPLATE/request_feature.yml +++ b/.github/ISSUE_TEMPLATE/request_feature.yml @@ -31,8 +31,6 @@ body: required: true - label: I have written a short but informative title. required: true - - label: If this is an issue with an official extension, I should be opening an issue in the [extensions repository](https://github.com/komikku-app/extensions/issues/new/choose). - required: true - label: I have updated the app to version **[1.12.1](https://github.com/komikku-app/komikku/releases/latest)**. required: true - label: I will fill out all of the requested information in this form. diff --git a/app/src/main/java/eu/kanade/domain/extension/interactor/TrustExtension.kt b/app/src/main/java/eu/kanade/domain/extension/interactor/TrustExtension.kt index 01287cb15..61250c63c 100644 --- a/app/src/main/java/eu/kanade/domain/extension/interactor/TrustExtension.kt +++ b/app/src/main/java/eu/kanade/domain/extension/interactor/TrustExtension.kt @@ -14,7 +14,7 @@ class TrustExtension( suspend fun isTrusted(pkgInfo: PackageInfo, fingerprints: List): Boolean { // KMK --> - if (fingerprints.contains(CreateExtensionRepo.OFFICIAL_REPO_SIGNATURE)) return true + if (fingerprints.contains(CreateExtensionRepo.KOMIKKU_SIGNATURE)) return true // KMK <-- val trustedFingerprints = extensionRepoRepository.getAll().map { it.signingKeyFingerprint }.toHashSet() val key = "${pkgInfo.packageName}:${PackageInfoCompat.getLongVersionCode(pkgInfo)}:${fingerprints.last()}" diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt index f47042076..213c536ae 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposContent.kt @@ -36,6 +36,8 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.copyToClipboard import kotlinx.collections.immutable.ImmutableSet import kotlinx.collections.immutable.persistentSetOf +import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.KEIYOUSHI_SIGNATURE +import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.KOMIKKU_SIGNATURE import mihon.domain.extensionrepo.model.ExtensionRepo import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.padding @@ -101,7 +103,7 @@ private fun ExtensionRepoListItem( modifier = Modifier .padding(start = MaterialTheme.padding.medium), ) { - val resId = repoResId(repo.baseUrl) + val resId = repoResId(repo.signingKeyFingerprint) Image( bitmap = ImageBitmap.imageResource(id = resId), contentDescription = null, @@ -179,9 +181,9 @@ private fun ExtensionRepoListItem( } // KMK --> -fun repoResId(baseUrl: String) = when (baseUrl) { - "https://raw.githubusercontent.com/komikku-app/extensions/repo" -> R.mipmap.komikku - "https://raw.githubusercontent.com/keiyoushi/extensions/repo" -> R.mipmap.keiyoushi +fun repoResId(signKey: String) = when (signKey) { + KOMIKKU_SIGNATURE -> R.mipmap.komikku + KEIYOUSHI_SIGNATURE -> R.mipmap.keiyoushi else -> R.mipmap.extension } @@ -189,8 +191,8 @@ fun repoResId(baseUrl: String) = when (baseUrl) { @Composable fun ExtensionReposContentPreview() { val repos = persistentSetOf( - ExtensionRepo("https://raw.githubusercontent.com/komikku-app/extensions/repo", "Komikku", "", "", "key1"), - ExtensionRepo("https://raw.githubusercontent.com/keiyoushi/extensions/repo", "Keiyoushi", "", "", "key2"), + ExtensionRepo("https://repo", "Komikku", "", "", KOMIKKU_SIGNATURE), + ExtensionRepo("https://repo", "Keiyoushi", "", "", KEIYOUSHI_SIGNATURE), ExtensionRepo("https://repo", "Other", "", "", "key2"), ) ExtensionReposContent( diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposDialogs.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposDialogs.kt index 317ee2b14..80cada76b 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposDialogs.kt @@ -1,9 +1,6 @@ package eu.kanade.presentation.more.settings.screen.browse.components -import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.AlertDialog import androidx.compose.material3.OutlinedTextField @@ -15,16 +12,12 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.text.input.KeyboardType -import androidx.compose.ui.tooling.preview.Preview import kotlinx.collections.immutable.ImmutableSet -import kotlinx.collections.immutable.persistentSetOf import kotlinx.coroutines.delay -import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.OFFICIAL_REPO_BASE_URL import mihon.domain.extensionrepo.model.ExtensionRepo import tachiyomi.i18n.MR import tachiyomi.presentation.core.i18n.stringResource @@ -44,37 +37,19 @@ fun ExtensionRepoCreateDialog( AlertDialog( onDismissRequest = onDismissRequest, confirmButton = { - // KMK --> - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween, // Distribute space between items - verticalAlignment = Alignment.CenterVertically, // Align items vertically + TextButton( + enabled = name.isNotEmpty() && !nameAlreadyExists, + onClick = { + onCreate(name) + onDismissRequest() + }, ) { - TextButton( - onClick = { - name = "$OFFICIAL_REPO_BASE_URL/index.min.json" - }, - ) { - Text(text = stringResource(MR.strings.label_default)) - } - Row( - // Group the right-aligned elements - verticalAlignment = Alignment.CenterVertically, - ) { - TextButton(onClick = onDismissRequest) { - Text(text = stringResource(MR.strings.action_cancel)) - } - // KMK <-- - TextButton( - enabled = name.isNotEmpty() && !nameAlreadyExists, - onClick = { - onCreate(name) - onDismissRequest() - }, - ) { - Text(text = stringResource(MR.strings.action_add)) - } - } + Text(text = stringResource(MR.strings.action_add)) + } + }, + dismissButton = { + TextButton(onClick = onDismissRequest) { + Text(text = stringResource(MR.strings.action_cancel)) } }, title = { @@ -115,14 +90,6 @@ fun ExtensionRepoCreateDialog( } } -// KMK --> -@Preview(showBackground = true) -@Composable -fun ExtensionRepoCreateDialogPreview() { - ExtensionRepoCreateDialog({ }, { }, persistentSetOf()) -} -// KMK <-- - @Composable fun ExtensionRepoDeleteDialog( onDismissRequest: () -> Unit, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposScreen.kt index 68dfe1371..10614f3d0 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/browse/components/ExtensionReposScreen.kt @@ -24,7 +24,9 @@ import eu.kanade.presentation.components.AppBar import eu.kanade.presentation.more.settings.screen.browse.RepoScreenState import eu.kanade.tachiyomi.util.system.openInBrowser import kotlinx.collections.immutable.persistentSetOf -import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.OFFICIAL_REPO_WEBSITE +import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.KEIYOUSHI_SIGNATURE +import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.KOMIKKU_SIGNATURE +import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.REPO_HELP import mihon.domain.extensionrepo.model.ExtensionRepo import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.Scaffold @@ -79,7 +81,7 @@ fun ExtensionReposScreen( // KMK --> help = { TextButton( - onClick = { context.openInBrowser(OFFICIAL_REPO_WEBSITE) }, + onClick = { context.openInBrowser(REPO_HELP) }, modifier = Modifier.padding(top = MaterialTheme.padding.small), ) { Icon(imageVector = Icons.AutoMirrored.Outlined.Help, contentDescription = null) @@ -114,8 +116,8 @@ fun ExtensionReposScreen( private fun ExtensionReposScreenPreview() { val state = RepoScreenState.Success( repos = persistentSetOf( - ExtensionRepo("https://raw.githubusercontent.com/komikku-app/extensions/repo", "Komikku", "", "", "key1"), - ExtensionRepo("https://raw.githubusercontent.com/keiyoushi/extensions/repo", "Keiyoushi", "", "", "key2"), + ExtensionRepo("https://repo", "Komikku", "", "", KOMIKKU_SIGNATURE), + ExtensionRepo("https://repo", "Keiyoushi", "", "", KEIYOUSHI_SIGNATURE), ExtensionRepo("https://repo", "Other", "", "", "key2"), ), disabledRepos = setOf("https://repo"), diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index 068b4d176..b204141d3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -20,8 +20,8 @@ import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.runBlocking import logcat.LogPriority -import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.KEIYOUSHI_REPO_SIGNATURE -import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.OFFICIAL_REPO_SIGNATURE +import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.KEIYOUSHI_SIGNATURE +import mihon.domain.extensionrepo.interactor.CreateExtensionRepo.Companion.KOMIKKU_SIGNATURE import mihon.domain.extensionrepo.interactor.GetExtensionRepo import mihon.domain.extensionrepo.model.ExtensionRepo import tachiyomi.core.common.util.system.logcat @@ -428,11 +428,11 @@ internal object ExtensionLoader { } private fun isOfficiallySigned(signatures: List): Boolean { - return signatures.all { it == OFFICIAL_REPO_SIGNATURE } + return signatures.all { it == KOMIKKU_SIGNATURE } } private fun isKeiyoushiSigned(signatures: List): Boolean { - return signatures.all { it == KEIYOUSHI_REPO_SIGNATURE } + return signatures.all { it == KEIYOUSHI_SIGNATURE } } /** diff --git a/app/src/main/java/mihon/core/migration/migrations/Migrations.kt b/app/src/main/java/mihon/core/migration/migrations/Migrations.kt index 5fbb36465..2a212f43d 100644 --- a/app/src/main/java/mihon/core/migration/migrations/Migrations.kt +++ b/app/src/main/java/mihon/core/migration/migrations/Migrations.kt @@ -46,7 +46,6 @@ val migrations: List MoveEncryptionSettingsToAppStateMigration(), TrustExtensionRepositoryMigration(), // KMK --> - OfficialExtensionRepositoryMigration(), IntegratedHentaiMigration(), SetupAppUpdateMigration(), // KMK <-- diff --git a/app/src/main/java/mihon/core/migration/migrations/OfficialExtensionRepositoryMigration.kt b/app/src/main/java/mihon/core/migration/migrations/OfficialExtensionRepositoryMigration.kt deleted file mode 100644 index 754d7efbf..000000000 --- a/app/src/main/java/mihon/core/migration/migrations/OfficialExtensionRepositoryMigration.kt +++ /dev/null @@ -1,32 +0,0 @@ -package mihon.core.migration.migrations - -import logcat.LogPriority -import mihon.core.migration.Migration -import mihon.core.migration.MigrationContext -import mihon.domain.extensionrepo.exception.SaveExtensionRepoException -import mihon.domain.extensionrepo.interactor.CreateExtensionRepo -import mihon.domain.extensionrepo.repository.ExtensionRepoRepository -import tachiyomi.core.common.util.lang.withIOContext -import tachiyomi.core.common.util.system.logcat - -class OfficialExtensionRepositoryMigration : Migration { - override val version: Float = 70f - - override suspend fun invoke(migrationContext: MigrationContext): Boolean = withIOContext { - val extensionRepositoryRepository = - migrationContext.get() ?: return@withIOContext false - try { - extensionRepositoryRepository.upsertRepo( - baseUrl = CreateExtensionRepo.OFFICIAL_REPO_BASE_URL, - name = "Komikku Official", - shortName = "Komikku", - website = "https://komikku-app.github.io", - signingKeyFingerprint = CreateExtensionRepo.OFFICIAL_REPO_SIGNATURE, - ) - } catch (e: SaveExtensionRepoException) { - logcat(LogPriority.ERROR, e) { "Error inserting Official Extension Repo" } - return@withIOContext false - } - return@withIOContext true - } -} diff --git a/domain/src/main/java/mihon/domain/extensionrepo/interactor/CreateExtensionRepo.kt b/domain/src/main/java/mihon/domain/extensionrepo/interactor/CreateExtensionRepo.kt index cc9261d35..30ae5df3b 100644 --- a/domain/src/main/java/mihon/domain/extensionrepo/interactor/CreateExtensionRepo.kt +++ b/domain/src/main/java/mihon/domain/extensionrepo/interactor/CreateExtensionRepo.kt @@ -71,11 +71,10 @@ class CreateExtensionRepo( } companion object { - const val OFFICIAL_REPO_WEBSITE = "https://komikku-app.github.io" - const val OFFICIAL_REPO_BASE_URL = "https://raw.githubusercontent.com/komikku-app/extensions/repo" + const val REPO_HELP = "https://komikku-app.github.io/docs/guides/getting-started#adding-sources" // cuong-tran's key - const val OFFICIAL_REPO_SIGNATURE = "cbec121aa82ebb02aaa73806992e0368a97d47b5451ed6524816d03084c45905" - const val KEIYOUSHI_REPO_SIGNATURE = "9add655a78e96c4ec7a53ef89dccb557cb5d767489fac5e785d671a5a75d4da2" + const val KOMIKKU_SIGNATURE = "cbec121aa82ebb02aaa73806992e0368a97d47b5451ed6524816d03084c45905" + const val KEIYOUSHI_SIGNATURE = "9add655a78e96c4ec7a53ef89dccb557cb5d767489fac5e785d671a5a75d4da2" } }