fix(client): register locale + use ctx.slots.inject(settings.section) so DSHWatch settings appears as top-level entry

This commit is contained in:
2026-09-02 01:55:37 +08:00
parent f7aef1a2fc
commit b6a782301d
2 changed files with 33 additions and 12 deletions
+33 -12
View File
@@ -84,19 +84,40 @@ window.__ModuleLoader__.load({
// 注入:连接 API 等
const inject = ["slots", "locale", "connection", "remote", "settingsScope"];
// 文案
const zh = {
nav: "DSHWatch 设置",
title: "DSHWatch 设置",
desc: "手机/手表远程控制 DeepSeek Harness 的配置。",
save: "保存",
saved: "已保存 ✓",
loading: "加载中…",
readErr: "读取失败",
saveErr: "保存失败"
};
const en = {
nav: "DSHWatch Settings",
title: "DSHWatch Settings",
desc: "Config for remote-controlling this Harness from DSHWatch phone/watch.",
save: "Save",
saved: "Saved ✓",
loading: "Loading…",
readErr: "Failed to read",
saveErr: "Failed to save"
};
function apply(ctx) {
ctx.inject(["slots", "locale", "connection", "remote", "settingsScope"], (scope) => {
const api = scope.get("connection").api;
const injected = () => ({ api });
scope.slots.register({
name: "settings.section",
id: "dsh-watch",
order: 30,
label: () => "DSHWatch 设置",
locale: "dsh-watch.settings",
inject: injected
}, Section);
});
ctx.locale.register("dsh-watch.settings", { zh, en });
const { api } = ctx.get("connection");
const injected = () => ({ api });
ctx.slots.inject("settings.section", () => ctx.slots.register({
name: "settings.section",
id: "dsh-watch",
order: 30,
label: () => ctx.locale.bind("dsh-watch.settings")("nav"),
locale: "dsh-watch.settings",
inject: injected
}, Section));
}
exports.apply = apply;