feat: default icon prefix to self-hosted Gitea (CN-reachable)

Switch DEFAULT_ICON_PREFIX from github raw (flaky in CN) to the
self-hosted Gitea at 45.143.131.159:3000/song/a2i. Auto-migrate
existing users whose stored prefix is the old github default; custom
values kept. Icons are already mirrored to Gitea via every push.
CLAUDE.md synced.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-08 19:59:05 +08:00
parent ae4392c04e
commit 076643ea46
2 changed files with 14 additions and 3 deletions
@@ -94,7 +94,16 @@ class SettingsStore(
_servers.value = list
_currentServerId.value = p[K.CURRENT] ?: ID_OFFICIAL
currentServer.value = list.firstOrNull { it.id == _currentServerId.value } ?: list.firstOrNull()
iconPrefix.value = p[K.ICON_PREFIX] ?: DEFAULT_ICON_PREFIX
// 图标前缀:旧 github 默认值自动迁移到 Gitea;用户自定义值保留
val storedPrefix = p[K.ICON_PREFIX]
iconPrefix.value = when (storedPrefix) {
null -> DEFAULT_ICON_PREFIX
LEGACY_ICON_PREFIX -> {
scope.launch { edit { it[K.ICON_PREFIX] = DEFAULT_ICON_PREFIX } }
DEFAULT_ICON_PREFIX
}
else -> storedPrefix
}
forwardingEnabled.value = p[K.FWD] ?: true
codeEnabled.value = p[K.CODE] ?: true
adFilterEnabled.value = p[K.AD] ?: true
@@ -184,6 +193,8 @@ class SettingsStore(
companion object {
const val ID_OFFICIAL = "official"
const val DEFAULT_ICON_PREFIX = "https://raw.githubusercontent.com/lsxf/a2i/main/icons/"
// 图标前缀默认走自建 Gitea(国内可达);github raw 作为备份
const val DEFAULT_ICON_PREFIX = "http://45.143.131.159:3000/song/a2i/raw/branch/main/icons/"
const val LEGACY_ICON_PREFIX = "https://raw.githubusercontent.com/lsxf/a2i/main/icons/"
}
}