diff --git a/app/src/main/kotlin/li/songe/gkd/data/GithubPoliciesAsset.kt b/app/src/main/kotlin/li/songe/gkd/data/GithubPoliciesAsset.kt index 19f8704..f454573 100644 --- a/app/src/main/kotlin/li/songe/gkd/data/GithubPoliciesAsset.kt +++ b/app/src/main/kotlin/li/songe/gkd/data/GithubPoliciesAsset.kt @@ -1,9 +1,13 @@ package li.songe.gkd.data import kotlinx.serialization.Serializable +import li.songe.gkd.util.FILE_SHORT_URL @Serializable data class GithubPoliciesAsset( val id: Int, val href: String, -) +) { + val shortHref: String + get() = FILE_SHORT_URL + id +} diff --git a/app/src/main/kotlin/li/songe/gkd/ui/home/SettingsPage.kt b/app/src/main/kotlin/li/songe/gkd/ui/home/SettingsPage.kt index 8b844a7..8c2ac34 100644 --- a/app/src/main/kotlin/li/songe/gkd/ui/home/SettingsPage.kt +++ b/app/src/main/kotlin/li/songe/gkd/ui/home/SettingsPage.kt @@ -291,7 +291,7 @@ fun useSettingsPage(): ScaffoldExt { is LoadStatus.Success -> { AlertDialog(title = { Text(text = "上传完成") }, text = { - Text(text = uploadStatusVal.result.href) + Text(text = uploadStatusVal.result.shortHref) }, onDismissRequest = {}, dismissButton = { TextButton(onClick = { vm.uploadStatusFlow.value = null @@ -300,7 +300,7 @@ fun useSettingsPage(): ScaffoldExt { } }, confirmButton = { TextButton(onClick = { - ClipboardUtils.copyText(uploadStatusVal.result.href) + ClipboardUtils.copyText(uploadStatusVal.result.shortHref) toast("复制成功") vm.uploadStatusFlow.value = null }) { diff --git a/app/src/main/kotlin/li/songe/gkd/util/Constants.kt b/app/src/main/kotlin/li/songe/gkd/util/Constants.kt index 8f327a8..5a80a48 100644 --- a/app/src/main/kotlin/li/songe/gkd/util/Constants.kt +++ b/app/src/main/kotlin/li/songe/gkd/util/Constants.kt @@ -6,6 +6,7 @@ import li.songe.gkd.BuildConfig const val VOLUME_CHANGED_ACTION = "android.media.VOLUME_CHANGED_ACTION" const val FILE_UPLOAD_URL = "https://u.gkd.li/" +const val FILE_SHORT_URL = "https://f.gkd.li/" const val IMPORT_BASE_URL = "https://i.gkd.li/i/" const val UPDATE_URL = "https://registry.npmmirror.com/@gkd-kit/app/latest/files/index.json"