From 2615904b1ead5632100780695abda07652895281 Mon Sep 17 00:00:00 2001 From: Moepchi Date: Fri, 16 Oct 2026 08:41:58 +0000 Subject: [PATCH] Send server-log field names in camelCase rename_all on the enum only renamed the kind tags, so the channel switch entry arrived as from_channel/to_channel and the Server tab showed the raw {fromChannel}/{toChannel} placeholders. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU --- connector/src/main.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/connector/src/main.rs b/connector/src/main.rs index f7e7d38..1541c98 100644 --- a/connector/src/main.rs +++ b/connector/src/main.rs @@ -234,11 +234,11 @@ fn parse_codec_encryption_mode(s: &str) -> Option { /// Human-facing entries for the Server tab's log-style notifications /// (client join/leave/switch, channel group assignment, channel/server /// changes, own permission errors) - mirrors what the native TS3 client -/// shows inline in the server chat. `rename_all = "camelCase"` covers both -/// the `kind` tag values and field names, so this needs no remapping on the +/// shows inline in the server chat. `rename_all` covers the `kind` tag values +/// and `rename_all_fields` the field names, so this needs no remapping on the /// gateway side (unlike the snake_case variants below). #[derive(Serialize)] -#[serde(tag = "kind", rename_all = "camelCase")] +#[serde(tag = "kind", rename_all = "camelCase", rename_all_fields = "camelCase")] enum ServerLogEntry { ClientJoin { client: String, channel: String }, ClientLeave { client: String }, @@ -3194,6 +3194,19 @@ mod tests { format!("7\t{offset}\t{total}\t/a b.txt\t{}", base64::engine::general_purpose::STANDARD.encode(data)) } + #[test] + fn server_log_fields_are_camel_case() { + let entry = ServerLogEntry::ClientChannelSwitch { + client: "a".into(), + from_channel: "b".into(), + to_channel: "c".into(), + }; + assert_eq!( + serde_json::to_string(&entry).unwrap(), + r#"{"kind":"clientChannelSwitch","client":"a","fromChannel":"b","toChannel":"c"}"# + ); + } + #[test] fn upload_chunks_assemble_in_order_and_reject_gaps() { let mut partials = HashMap::new();