feat(signature): make host configurable and add WS reconnect

- New optional env SIGNATURE_HOST overrides the hardcoded
  192.168.10.5:2967 (defaults preserved for back-compat).
- WebSocket now reconnects with exponential backoff (1s, 2s, 4s ...
  capped at 30s) on close/error. Previously a dropped signature
  server connection silently disabled signature playback until the
  bot was restarted.
This commit is contained in:
Claude Owner
2026-05-26 14:40:05 +09:00
parent 9123afc14e
commit fe10ed1bd9
2 changed files with 31 additions and 2 deletions

View File

@@ -13,6 +13,7 @@ export const Config = {
nid_ses: process.env.CHZZK_NID_SES?.trim(),
},
_ttsPath: process.env.TTSPATH?.trim(),
_signatureHost: process.env.SIGNATURE_HOST?.trim() || "192.168.10.5:2967",
debug: process.env.DEBUG?.trim()?.toLocaleLowerCase() === "true",
dev: process.env.DEV?.trim()?.toLocaleLowerCase() === "true",
replaceObj: { ...def_replaceObj, ...JSON.parse(process.env.REPLACETEXT?.trim() || "[{}]")[0] },
@@ -48,6 +49,9 @@ export const Config = {
get ttsPath() {
if (!this._ttsPath) throw new ReferenceError("TTSPATH is missing");
return this._ttsPath;
},
get signatureHost() {
return this._signatureHost;
}
};