feat(config): 将默认活动 SID 更新为最新活动 2277

- 后端默认值与测试:DefaultConfig 默认 SID 改为 2277(旧活动 2203 已停止返回商品),更新单元测试断言
- 前端默认值与平滑迁移:pickConfig 默认 SID 设为 2277,localStorage 自动将旧版 2203 迁移至 2277
- 验证:Go 单测与 Vite 前端打包干净通过
This commit is contained in:
yml2213
2026-10-17 18:58:38 +08:00
parent d53306076e
commit 23f964e768
3 changed files with 17 additions and 2 deletions
+13 -1
View File
@@ -66,6 +66,9 @@ const leadDefaultMigrationBase = 'huya-go.gui.lead-default.v1'
const legacyDefaultLeadMs = 2500
const concurrencyDefaultMigrationBase = 'huya-go.gui.concurrency-v30.v1'
const defaultConcurrency = 30
const legacyDefaultSID = 2203
const defaultSID = 2277
const sidDefaultMigrationBase = 'huya-go.gui.sid-v2277.v1'
// 界面本地存储保留的日志上限,与后端的增量拉取配合使用。
const maxClientLogs = 1000
@@ -561,6 +564,15 @@ function readSavedConfig(): Partial<SavedConfig> {
localStorage.setItem(concurrencyMigrationKey, '1')
}
const sidMigrationKey = scopedKey(sidDefaultMigrationBase)
if (!localStorage.getItem(sidMigrationKey)) {
if (Number(saved.sid || 0) === legacyDefaultSID || !saved.sid) {
saved.sid = defaultSID
dirty = true
}
localStorage.setItem(sidMigrationKey, '1')
}
if (dirty) {
// 迁移必须立即落盘,否则下一次 readSavedConfig 又会读回旧值。
localStorage.setItem(configKey, JSON.stringify(saved))
@@ -668,7 +680,7 @@ function pickConfig(values: Partial<UiConfig>): UiConfig {
return {
transport: values.transport || 'wss',
wssHost: values.wssHost || '',
sid: Number(values.sid || 2203),
sid: Number(values.sid || defaultSID),
pid: Number(values.pid || 0),
name: values.name || '',
category: values.category || '',
+1 -1
View File
@@ -299,7 +299,7 @@ func (a *App) DefaultConfig() Config {
return Config{
Transport: "wss",
WSSHost: "",
SID: 2203,
SID: 2277,
DelayMS: 120,
// 线程是「同时在途请求数」上限。单机单实例默认 30,
// 5 个多开实例整机约 150 并发(与斗鱼单机 150 吞吐相当)。
+3
View File
@@ -70,6 +70,9 @@ func TestParseAccountsRequiresExplicitSelection(t *testing.T) {
func TestDefaultConfigUsesWindowMode(t *testing.T) {
cfg := (&App{}).DefaultConfig()
if cfg.SID != 2277 {
t.Fatalf("SID=%d, want 2277(最新活动 SID)", cfg.SID)
}
if cfg.LeadMS != 0 {
t.Fatalf("LeadMS=%d, want 0(动态提前量)", cfg.LeadMS)
}