fix: danmaku template now uses event rules; rules apply instantly on save

- _on_danmaku renders via event_text(rules, 'danmaku', ...) like all other
  events; hardcoded {uname}说、 {msg} format removed
- Drop message_format param from DanmakuHandler/DanmakuClient/server/main
- api_rules_post mutates the shared rules dict in place (clear+update)
  instead of rebinding, so running handlers pick up new templates
  immediately without restarting TTS
- UI save toast: '规则已保存并即时生效'
- Verified: custom template 卧槽!、是{uname}!、他说、 {msg} works;
  save-then-next-danmaku uses new template without restart
This commit is contained in:
2026-08-08 16:37:05 +08:00
parent 488abb9730
commit b7d0c26ad1
4 changed files with 14 additions and 22 deletions
+1 -1
View File
@@ -634,7 +634,7 @@ async function saveRules() {
const data = await resp.json();
if (data.error) { alert('保存失败: ' + data.error); return; }
renderRules(data.rules);
alert('规则已保存。重启TTS后生效。');
alert('规则已保存并即时生效。');
} catch(e) {
alert('保存失败: ' + e.message);
}