From 510adfde4d2617cac71f26567aec68567c95e527 Mon Sep 17 00:00:00 2001 From: Song <168455@qq.com> Date: Wed, 8 Jul 2026 19:59:05 +0800 Subject: [PATCH] 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) --- CLAUDE.md | 2 +- .../java/com/a2i/forwarder/store/SettingsStore.kt | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 30c98f7..e24d564 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -85,7 +85,7 @@ NotifyListenerService (系统通知入口) | `core/CarrierBalanceQuery.kt` | 向运营商服务号发查询短信、解析回执余量、余额≤5 自动挂起。 | | `core/SmsFallbackForwarder.kt` | 断网时把紧要通知(验证码/来电)用短信发到 iPhone,5 分钟限频 + 余额检查。 | | `core/UpdateChecker.kt` | 查 GitHub Releases 最新版(24h 节流)→ 语义比较 → 下载 APK → FileProvider 调起系统安装器。 | -| `store/SettingsStore.kt` | Bark 服务器列表、全局开关、广告关键词等。`MutableStateFlow` + DataStore。 | +| `store/SettingsStore.kt` | Bark 服务器列表、全局开关、广告关键词、图标前缀等。`MutableStateFlow` + DataStore。图标前缀默认走自建 Gitea(`DEFAULT_ICON_PREFIX` `http://45.143.131.159:3000/song/a2i/raw/branch/main/icons/`,国内可达),旧 github 默认值自动迁移、用户自定义值保留。 | | `store/AppRulesStore.kt` | 黑/白名单模式 + 默认黑名单(系统 App + 输入法 + 三星剪贴板/键盘 + GMS + 录音机/相册/查找/密码管理 + 通话管理/AI通话);默认黑名单带版本号 `bl_version`,升级时把新增噪音包合并进老用户黑名单(只增不删)。 | | `ui/nav/AppNav.kt` | 4 个底部 Tab + 日志页。 | | `ui/theme/*` | 固定品牌配色(`Color.kt`)、自定义 `Typography`(`Type.kt`),`A2iTheme` 关闭动态取色、统一深浅色方案(`Theme.kt`)。 | diff --git a/app/src/main/java/com/a2i/forwarder/store/SettingsStore.kt b/app/src/main/java/com/a2i/forwarder/store/SettingsStore.kt index 6267fc5..b18e457 100644 --- a/app/src/main/java/com/a2i/forwarder/store/SettingsStore.kt +++ b/app/src/main/java/com/a2i/forwarder/store/SettingsStore.kt @@ -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/" } }