
- 在Info.plist中新增API签名密钥配置。 - 将Splash视图替换为SplashV2,优化启动逻辑和用户体验。 - 更新API请求中的User-Agent逻辑,使用UserAgentProvider提供的动态值。 - 在APILogger中添加敏感信息脱敏处理,增强安全性。 - 新增CreateFeedPage视图,支持用户发布动态功能。 - 更新MainPage和Splash视图的导航逻辑,整合统一的AppRoute管理。 - 移除冗余的SplashFeature视图,提升代码整洁性和可维护性。
33 lines
1.2 KiB
Swift
33 lines
1.2 KiB
Swift
import Foundation
|
||
|
||
/// 提供 API 签名密钥的统一入口
|
||
/// - 优先从 Info.plist 读取键 `API_SIGNING_KEY`
|
||
/// - Debug 环境下若缺失,回退到历史密钥以避免开发阶段中断,同时输出告警
|
||
/// - Release 环境下若缺失,输出错误并返回空字符串(应在发布前配置)
|
||
enum SigningKeyProvider {
|
||
/// Info.plist 中的键名
|
||
private static let plistKey = "API_SIGNING_KEY"
|
||
|
||
/// 获取签名密钥
|
||
static func signingKey() -> String {
|
||
if let key = Bundle.main.object(forInfoDictionaryKey: plistKey) as? String,
|
||
!key.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||
return key
|
||
}
|
||
|
||
#if DEBUG
|
||
// 仅在 Debug 回退,避免打断本地调试;请尽快在 Info.plist 配置 API_SIGNING_KEY
|
||
let legacy = "rpbs6us1m8r2j9g6u06ff2bo18orwaya"
|
||
debugWarnSync("⚠️ API_SIGNING_KEY 未配置,Debug 使用历史回退密钥(请尽快配置 Info.plist)")
|
||
return legacy
|
||
#else
|
||
debugErrorSync("❌ 缺少 API_SIGNING_KEY,请在 Info.plist 中配置")
|
||
assertionFailure("Missing API_SIGNING_KEY in Info.plist")
|
||
return ""
|
||
#endif
|
||
}
|
||
}
|
||
|
||
|
||
|