启动器新增游戏设置页(频道开关+活动开关),窗口标题改名

- 服务端新增活动开关运行时配置与 GM 接口(GET/POST /dnf/gm/activity-switches),
  持久化到 Settings,接入月签到/周签到/PC房↔累计在线的实时下发
- 服务端新增频道开关 GM 接口(channel-switches),目录生成时过滤禁用频道
- channelcatalog/channelinfo 支持按禁用频道 ID 过滤目录与客户端脚本
- 启动器新增「游戏设置」页面:频道开关 Tab + 活动开关 Tab
- native.py/server.py 新增对应转发 API
- 窗口标题/页面 title/侧边栏「90轮回」统一改为「DNF90 灵狐小竹整合单机版」
This commit is contained in:
hanfuit committed 2026-11-04 20:08:50 +08:00
1 parent 977a4a1196
commit 0ced464168
15 files changed
+1022 -14

No files matched your search

@@ -52,6 +52,10 @@ const (
// gmChannelReloadOperation 频道热重载:重读 channel_info.etc 并热替换频道表 +
// 对账游戏端口监听,不需要重启进程。
gmChannelReloadOperation = "POST /dnf/gm/channels/reload"
// gmActivitySwitchesOperation 活动开关设置:切换某活动是否下发。
gmActivitySwitchesOperation = "POST /dnf/gm/activity-switches"
// gmChannelSwitchOperation 频道开关设置:切换某频道是否启用。
gmChannelSwitchOperation = "POST /dnf/gm/channel-switch"
// gmRecordQueryOperation 记录查询。只读操作,但沿用统一的操作串便于审计日志对齐。
gmRecordQueryOperation = "POST /dnf/gm/records/query"
)
@@ -125,6 +129,58 @@ func registerGMAdminRoutes(env *appkit.Env, service *dnfbridge.Service) {
}
writeGMData(w, http.StatusOK, result)
}))
// 活动开关:读取当前各活动的开关状态(供启动器「游戏设置 → 活动开关」展示)。
env.AdminMux.HandleFunc("GET /dnf/gm/activity-switches", read(func(w http.ResponseWriter, r *http.Request) {
switches, err := service.GMActivitySwitches(r.Context())
if err != nil {
writeGMToolError(w, err)
return
}
writeGMData(w, http.StatusOK, switches)
}))
// 活动开关:切换某活动的开/关。
env.AdminMux.HandleFunc("POST /dnf/gm/activity-switches", write(gmActivitySwitchesOperation, func(w http.ResponseWriter, r *http.Request) {
var request struct {
Key string `json:"key"`
Enabled bool `json:"enabled"`
}
if err := decodeGMJSON(w, r, &request); err != nil {
writeGMToolError(w, err)
return
}
switches, err := service.GMSetActivitySwitch(r.Context(), request.Key, request.Enabled)
if err != nil {
writeGMToolError(w, err)
return
}
writeGMData(w, http.StatusOK, switches)
}))
// 频道开关:读取当前各频道的启用状态(含被手动关闭的频道)。
env.AdminMux.HandleFunc("GET /dnf/gm/channel-switches", read(func(w http.ResponseWriter, r *http.Request) {
switches, err := service.GMChannelSwitches(r.Context())
if err != nil {
writeGMToolError(w, err)
return
}
writeGMData(w, http.StatusOK, switches)
}))
// 频道开关:切换某频道的启用/停用(改运行时目录并热对账端口,无需重启)。
env.AdminMux.HandleFunc("POST /dnf/gm/channel-switch", write(gmChannelSwitchOperation, func(w http.ResponseWriter, r *http.Request) {
var request struct {
ChannelID int `json:"channel_id"`
Enabled bool `json:"enabled"`
}
if err := decodeGMJSON(w, r, &request); err != nil {
writeGMToolError(w, err)
return
}
switches, err := service.GMSetChannelSwitch(r.Context(), request.ChannelID, request.Enabled)
if err != nil {
writeGMToolError(w, err)
return
}
writeGMData(w, http.StatusOK, switches)
}))
// 记录查询(点券消费/对话/副本)。三类记录都落在服务端的 JSONL 文件里,
// 这里只做检索,不改任何运行态,所以走 read()。
env.AdminMux.HandleFunc("GET /dnf/gm/records/meta", read(func(w http.ResponseWriter, r *http.Request) {