mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Add ServerQuery Login dialog
Wires up the previously-disabled "ServerQuery Login" Extras menu item with a username/password form. Sends the raw TS3 "login" command (client_login_name/client_login_password) over the existing connection - no typed builder exists for it upstream, same situation as the other raw-command features this session. Credentials are base64-encoded over the connector's stdin protocol (rather than naive space-splitting) so passwords with spaces or special characters survive the trip intact. Fire-and-forget like kick/ban: the dialog closes on submit and relies on the existing generic error/permission-error event path for feedback. Verified against the real server end-to-end - bogus credentials round-tripped through connector -> gateway -> frontend and surfaced as a clean error event (this particular server responds "NotImplemented" to post-connect query login, which is itself proof the command reached the server and got a real protocol-level reply). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
db8b5ea958
commit
0f8576ac6c
7 files changed
+123
-1
No files matched your search
@@ -1247,6 +1247,39 @@ async fn run(args: Args) -> Result<()> {
|
||||
}
|
||||
_ => emit(&Event::Error { message: format!("Invalid delservergroup args: {rest}") }),
|
||||
}
|
||||
} else if let Some(rest) = l.strip_prefix("serverquerylogin ") {
|
||||
let mut parts = rest.trim().splitn(2, ' ');
|
||||
let user_b64 = parts.next().unwrap_or("");
|
||||
let pass_b64 = parts.next().unwrap_or("");
|
||||
let decoded = base64::engine::general_purpose::STANDARD
|
||||
.decode(user_b64)
|
||||
.ok()
|
||||
.and_then(|b| String::from_utf8(b).ok())
|
||||
.zip(
|
||||
base64::engine::general_purpose::STANDARD
|
||||
.decode(pass_b64)
|
||||
.ok()
|
||||
.and_then(|b| String::from_utf8(b).ok()),
|
||||
);
|
||||
match decoded {
|
||||
Some((username, password)) => {
|
||||
let mut packet = OutCommand::new(
|
||||
Direction::C2S,
|
||||
Flags::empty(),
|
||||
PacketType::Command,
|
||||
"login",
|
||||
);
|
||||
packet.write_arg("client_login_name", &username);
|
||||
packet.write_arg("client_login_password", &password);
|
||||
match packet.send_with_result(&mut con) {
|
||||
Ok(handle) => {
|
||||
pending_messages.insert(handle, "ServerQuery Login".into());
|
||||
}
|
||||
Err(e) => emit(&Event::Error { message: e.to_string() }),
|
||||
}
|
||||
}
|
||||
None => emit(&Event::Error { message: "Invalid serverquerylogin args".into() }),
|
||||
}
|
||||
} else if let Some(b64) = l.strip_prefix("audio ") {
|
||||
match base64::engine::general_purpose::STANDARD.decode(b64.trim()) {
|
||||
Ok(bytes) => {
|
||||
|
||||
Reference in new issue
Block a user