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:
MoepchiandClaude Sonnet 5 committed 2026-08-05 21:02:16 +02:00
1 parent db8b5ea958
commit 0f8576ac6c
7 files changed
+123 -1

No files matched your search

+59 -1
View File
@@ -3198,6 +3198,10 @@ function AppInner() {
const [changeNicknameOpen, setChangeNicknameOpen] = useState(false);
const [nicknameDraft, setNicknameDraft] = useState("");
const nicknameBackdrop = useBackdropDismiss(() => setChangeNicknameOpen(false));
const [serverQueryLoginOpen, setServerQueryLoginOpen] = useState(false);
const [serverQueryUsername, setServerQueryUsername] = useState("");
const [serverQueryPassword, setServerQueryPassword] = useState("");
const serverQueryLoginBackdrop = useBackdropDismiss(() => setServerQueryLoginOpen(false));
const [contacts, setContacts] = useState<Contact[]>(() => loadContacts());
const [contactsOpen, setContactsOpen] = useState(false);
const [recording, setRecording] = useState(false);
@@ -4164,6 +4168,18 @@ function AppInner() {
socketRef.current?.send(JSON.stringify({ type: "setNickname", nickname: newNickname }));
};
const handleServerQueryLogin = () => {
if (!serverQueryUsername.trim() || !serverQueryPassword) return;
socketRef.current?.send(
JSON.stringify({
type: "serverQueryLogin",
username: serverQueryUsername.trim(),
password: serverQueryPassword,
})
);
setServerQueryLoginOpen(false);
};
const handleOutputDeviceChange = async (deviceId: string) => {
setOutputDeviceId(deviceId);
await audioPlayerRef.current?.setOutputDevice(deviceId);
@@ -4845,7 +4861,15 @@ function AppInner() {
<span className="ts-menu-item-icon">📧</span>
<span className="ts-menu-item-label">{t("menu.extras.offlineMessages")}</span>
</button>
<button className="ts-menu-item" disabled>
<button
className="ts-menu-item"
onClick={() => {
setServerQueryUsername("");
setServerQueryPassword("");
setServerQueryLoginOpen(true);
setExtrasMenuOpen(false);
}}
>
<span className="ts-menu-item-icon">🔑</span>
<span className="ts-menu-item-label">{t("menu.extras.serverQueryLogin")}</span>
</button>
@@ -5350,6 +5374,40 @@ function AppInner() {
</div>
)}
{serverQueryLoginOpen && (
<div className="ts-poke-compose-backdrop" {...serverQueryLoginBackdrop}>
<div className="ts-poke-compose ts-serverquery-login-compose" onClick={(e) => e.stopPropagation()}>
<span>🔑 {t("menu.extras.serverQueryLogin")}</span>
<input
autoFocus
placeholder={t("serverQueryLogin.username")}
value={serverQueryUsername}
onChange={(e) => setServerQueryUsername(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Escape") setServerQueryLoginOpen(false);
}}
/>
<input
type="password"
placeholder={t("serverQueryLogin.password")}
value={serverQueryPassword}
onChange={(e) => setServerQueryPassword(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter") handleServerQueryLogin();
if (e.key === "Escape") setServerQueryLoginOpen(false);
}}
/>
<button
disabled={!serverQueryUsername.trim() || !serverQueryPassword}
onClick={handleServerQueryLogin}
>
{t("serverQueryLogin.login")}
</button>
<button onClick={() => setServerQueryLoginOpen(false)}>{t("favorites.cancel")}</button>
</div>
</div>
)}
{pokeTarget && (
<div className="ts-poke-compose-backdrop" {...pokeBackdrop}>
<div className="ts-poke-compose" onClick={(e) => e.stopPropagation()}>