Archived
fix: persist subsessions setting
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@jmfederico/pi-web": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Persist the Settings → Session daemon tracked subsessions toggle so it remains enabled after restart.
|
||||||
@@ -37,11 +37,11 @@ describe("config routes", () => {
|
|||||||
const response = await app.inject({
|
const response = await app.inject({
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
url: "/api/config",
|
url: "/api/config",
|
||||||
payload: { config: { host: "0.0.0.0", port: 9000, allowedHosts: true, spawnSessions: true, shortcuts: { "core:view.chat": "mod+1", "core:session.stop": null }, plugins: { info: { enabled: false, settings: { note: "hidden" } } } } },
|
payload: { config: { host: "0.0.0.0", port: 9000, allowedHosts: true, spawnSessions: true, subsessions: true, shortcuts: { "core:view.chat": "mod+1", "core:session.stop": null }, plugins: { info: { enabled: false, settings: { note: "hidden" } } } } },
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(response.statusCode).toBe(200);
|
expect(response.statusCode).toBe(200);
|
||||||
expect(savedConfig).toEqual({ host: "0.0.0.0", port: 9000, allowedHosts: true, spawnSessions: true, shortcuts: { "core:view.chat": "mod+1", "core:session.stop": null }, plugins: { info: { enabled: false, settings: { note: "hidden" } } } });
|
expect(savedConfig).toEqual({ host: "0.0.0.0", port: 9000, allowedHosts: true, spawnSessions: true, subsessions: true, shortcuts: { "core:view.chat": "mod+1", "core:session.stop": null }, plugins: { info: { enabled: false, settings: { note: "hidden" } } } });
|
||||||
expect(response.json<PiWebConfigResponse>().config).toEqual(savedConfig);
|
expect(response.json<PiWebConfigResponse>().config).toEqual(savedConfig);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ function parseConfigRequest(value: unknown): PiWebConfig {
|
|||||||
const shortcuts = value["shortcuts"];
|
const shortcuts = value["shortcuts"];
|
||||||
const plugins = value["plugins"];
|
const plugins = value["plugins"];
|
||||||
const spawnSessions = value["spawnSessions"];
|
const spawnSessions = value["spawnSessions"];
|
||||||
|
const subsessions = value["subsessions"];
|
||||||
if (host !== undefined) {
|
if (host !== undefined) {
|
||||||
if (typeof host !== "string") throw new Error("PI WEB config host must be a string");
|
if (typeof host !== "string") throw new Error("PI WEB config host must be a string");
|
||||||
config.host = host;
|
config.host = host;
|
||||||
@@ -74,6 +75,10 @@ function parseConfigRequest(value: unknown): PiWebConfig {
|
|||||||
if (typeof spawnSessions !== "boolean") throw new Error("PI WEB config spawnSessions must be a boolean");
|
if (typeof spawnSessions !== "boolean") throw new Error("PI WEB config spawnSessions must be a boolean");
|
||||||
config.spawnSessions = spawnSessions;
|
config.spawnSessions = spawnSessions;
|
||||||
}
|
}
|
||||||
|
if (subsessions !== undefined) {
|
||||||
|
if (typeof subsessions !== "boolean") throw new Error("PI WEB config subsessions must be a boolean");
|
||||||
|
config.subsessions = subsessions;
|
||||||
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user