Add server/channel passwords, connection autofill, and client status icons

Server/channel passwords are now optional connect fields (hidden behind a
lock toggle so the normal flow stays uncluttered). The last successfully
used server/nickname is remembered via localStorage and autofilled on
load. The channel tree now shows per-client status badges (channel
commander, away, mic muted, deafened) sourced directly from tsclientlib's
existing client data.

Also credits Claude Code in the README, since it wrote the vast majority
of this project's code.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
MoepchiandClaude Sonnet 5 committed 2026-07-28 20:41:29 +02:00
1 parent 4306da474b
commit 76cb90360c
6 files changed
+151 -13

No files matched your search

+8 -1
View File
@@ -9,8 +9,11 @@ reimagined.
## Features ## Features
- Connect to a real TeamSpeak (3/6) server - Connect to a real TeamSpeak (3/6) server, with optional server and
default-channel passwords
- Remembers the last server/nickname you connected with
- Channel/client tree with correct ordering, click to switch channels - Channel/client tree with correct ordering, click to switch channels
- Per-client status icons (channel commander, away, mic muted, deafened)
- Text chat: channel, server-wide, and private (1:1) — each in its own tab - Text chat: channel, server-wide, and private (1:1) — each in its own tab
- Voice with voice activation ("Sprachaktivierung", not push-to-talk), - Voice with voice activation ("Sprachaktivierung", not push-to-talk),
adjustable sensitivity, and per-client speaking indicators adjustable sensitivity, and per-client speaking indicators
@@ -44,3 +47,7 @@ Browser (web/) <--WebSocket--> Gateway (gateway/) <--stdin/stdout JSON--> Ru
## Installation ## Installation
See [INSTALL.md](INSTALL.md). See [INSTALL.md](INSTALL.md).
## Credits
The vast majority of this project's code was written by [Claude Code](https://claude.com/claude-code) (Anthropic's Claude), working iteratively with the repo owner one feature at a time.
+28 -2
View File
@@ -33,6 +33,12 @@ struct Args {
/// Nickname to use on the server /// Nickname to use on the server
#[arg(short, long, default_value = "Browser User")] #[arg(short, long, default_value = "Browser User")]
nickname: String, nickname: String,
/// Server password, if the server requires one
#[arg(long)]
server_password: Option<String>,
/// Password for the default channel to join, if it's password-protected
#[arg(long)]
channel_password: Option<String>,
} }
#[derive(Serialize)] #[derive(Serialize)]
@@ -48,6 +54,11 @@ struct ClientInfo {
id: u16, id: u16,
channel: u64, channel: u64,
name: String, name: String,
input_muted: bool,
output_muted: bool,
input_hardware_enabled: bool,
away: bool,
is_channel_commander: bool,
} }
#[derive(Serialize)] #[derive(Serialize)]
@@ -134,7 +145,16 @@ fn snapshot(con: &data::Connection) -> Event {
let clients = con let clients = con
.clients .clients
.values() .values()
.map(|c| ClientInfo { id: c.id.0, channel: c.channel.0, name: c.name.clone() }) .map(|c| ClientInfo {
id: c.id.0,
channel: c.channel.0,
name: c.name.clone(),
input_muted: c.input_muted,
output_muted: c.output_muted,
input_hardware_enabled: c.input_hardware_enabled,
away: c.away_message.is_some(),
is_channel_commander: c.is_channel_commander,
})
.collect(); .collect();
Event::Channels { channels, clients } Event::Channels { channels, clients }
} }
@@ -172,7 +192,13 @@ async fn run(args: Args) -> Result<()> {
tracing_subscriber::fmt().with_env_filter("warn").with_writer(std::io::stderr).init(); tracing_subscriber::fmt().with_env_filter("warn").with_writer(std::io::stderr).init();
let address = args.address.clone(); let address = args.address.clone();
let con_config = Connection::build(args.address).name(args.nickname); let mut con_config = Connection::build(args.address).name(args.nickname);
if let Some(pwd) = args.server_password {
con_config = con_config.password(pwd);
}
if let Some(pwd) = args.channel_password {
con_config = con_config.channel_password(pwd);
}
let mut con = con_config.connect().map_err(|e| friendly_connect_error(&address, e))?; let mut con = con_config.connect().map_err(|e| friendly_connect_error(&address, e))?;
+2
View File
@@ -18,6 +18,8 @@ wss.on("connection", (socket: WebSocket) => {
const options: Ts3ConnectOptions = { const options: Ts3ConnectOptions = {
host: msg.host, host: msg.host,
nickname: msg.nickname, nickname: msg.nickname,
serverPassword: msg.serverPassword,
channelPassword: msg.channelPassword,
}; };
connection = new Ts3Connection(options); connection = new Ts3Connection(options);
connection.onEvent((event) => socket.send(JSON.stringify(event))); connection.onEvent((event) => socket.send(JSON.stringify(event)));
+38 -7
View File
@@ -21,6 +21,11 @@ export interface ClientInfo {
id: number; id: number;
channel: number; channel: number;
name: string; name: string;
inputMuted: boolean;
outputMuted: boolean;
inputHardwareEnabled: boolean;
away: boolean;
isChannelCommander: boolean;
} }
export type Ts3ConnectionEvent = export type Ts3ConnectionEvent =
@@ -37,6 +42,8 @@ export type Ts3ConnectionEvent =
export interface Ts3ConnectOptions { export interface Ts3ConnectOptions {
host: string; host: string;
nickname: string; nickname: string;
serverPassword?: string;
channelPassword?: string;
} }
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -61,18 +68,27 @@ export class Ts3Connection {
} }
async connect(): Promise<void> { async connect(): Promise<void> {
this.child = spawn(CONNECTOR_BIN, [ const args = ["--address", this.options.host, "--nickname", this.options.nickname];
"--address", if (this.options.serverPassword) args.push("--server-password", this.options.serverPassword);
this.options.host, if (this.options.channelPassword) args.push("--channel-password", this.options.channelPassword);
"--nickname", this.child = spawn(CONNECTOR_BIN, args);
this.options.nickname,
]);
createInterface({ input: this.child.stdout }).on("line", (line) => { createInterface({ input: this.child.stdout }).on("line", (line) => {
try { try {
interface RawClientInfo {
id: number;
channel: number;
name: string;
input_muted: boolean;
output_muted: boolean;
input_hardware_enabled: boolean;
away: boolean;
is_channel_commander: boolean;
}
const event = JSON.parse(line) as const event = JSON.parse(line) as
| { type: "connected"; welcome_message: string } | { type: "connected"; welcome_message: string }
| { type: "channels"; channels: ChannelInfo[]; clients: ClientInfo[] } | { type: "channels"; channels: ChannelInfo[]; clients: RawClientInfo[] }
| { type: "chatMessage"; from: string; message: string } | { type: "chatMessage"; from: string; message: string }
| { type: "serverMessage"; from: string; message: string } | { type: "serverMessage"; from: string; message: string }
| { type: "privateMessage"; partner_id: number; partner_name: string; from_self: boolean; message: string } | { type: "privateMessage"; partner_id: number; partner_name: string; from_self: boolean; message: string }
@@ -83,6 +99,21 @@ export class Ts3Connection {
if (event.type === "connected") { if (event.type === "connected") {
this.emit({ type: "connected", welcomeMessage: event.welcome_message }); this.emit({ type: "connected", welcomeMessage: event.welcome_message });
} else if (event.type === "channels") {
this.emit({
type: "channels",
channels: event.channels,
clients: event.clients.map((c) => ({
id: c.id,
channel: c.channel,
name: c.name,
inputMuted: c.input_muted,
outputMuted: c.output_muted,
inputHardwareEnabled: c.input_hardware_enabled,
away: c.away,
isChannelCommander: c.is_channel_commander,
})),
});
} else if (event.type === "privateMessage") { } else if (event.type === "privateMessage") {
this.emit({ this.emit({
type: "privateMessage", type: "privateMessage",
+7
View File
@@ -211,6 +211,13 @@
background: color-mix(in srgb, #4caf50 15%, transparent); background: color-mix(in srgb, #4caf50 15%, transparent);
} }
.ts-status-icons {
display: inline-flex;
gap: 0.15rem;
font-size: 11px;
opacity: 0.85;
}
.ts-mic-on { .ts-mic-on {
background: color-mix(in srgb, #4caf50 30%, var(--button-bg-1)) !important; background: color-mix(in srgb, #4caf50 30%, var(--button-bg-1)) !important;
} }
+68 -3
View File
@@ -11,6 +11,9 @@ import {
const GATEWAY_URL = "ws://localhost:8080"; const GATEWAY_URL = "ws://localhost:8080";
const LAST_HOST_KEY = "ts-web-client:last-host";
const LAST_NICKNAME_KEY = "ts-web-client:last-nickname";
type LogEntry = { text: string; kind: "info" | "error" }; type LogEntry = { text: string; kind: "info" | "error" };
interface ChannelInfo { interface ChannelInfo {
@@ -24,6 +27,11 @@ interface ClientInfo {
id: number; id: number;
channel: number; channel: number;
name: string; name: string;
inputMuted: boolean;
outputMuted: boolean;
inputHardwareEnabled: boolean;
away: boolean;
isChannelCommander: boolean;
} }
function ChannelIcon() { function ChannelIcon() {
@@ -49,6 +57,17 @@ function ClientIcon() {
); );
} }
function ClientStatusIcons({ client }: { client: ClientInfo }) {
return (
<span className="ts-status-icons">
{client.isChannelCommander && <span title="Channel commander">⭐</span>}
{client.away && <span title="Away">💤</span>}
{(client.inputMuted || !client.inputHardwareEnabled) && <span title="Microphone muted">🔇</span>}
{client.outputMuted && <span title="Sound muted (deafened)">🔕</span>}
</span>
);
}
function ServerIcon() { function ServerIcon() {
return ( return (
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"> <svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
@@ -102,6 +121,7 @@ function ChannelTree({
> >
<ClientIcon /> <ClientIcon />
<span>{c.name}</span> <span>{c.name}</span>
<ClientStatusIcons client={c} />
</div> </div>
</li> </li>
))} ))}
@@ -141,8 +161,11 @@ interface PmThread {
type ActiveTab = "channel" | "server" | number; type ActiveTab = "channel" | "server" | number;
function App() { function App() {
const [host, setHost] = useState("localhost"); const [host, setHost] = useState(() => localStorage.getItem(LAST_HOST_KEY) ?? "localhost");
const [nickname, setNickname] = useState("Claude Code"); const [nickname, setNickname] = useState(() => localStorage.getItem(LAST_NICKNAME_KEY) ?? "Claude Code");
const [serverPassword, setServerPassword] = useState("");
const [channelPassword, setChannelPassword] = useState("");
const [showPasswordFields, setShowPasswordFields] = useState(false);
const [log, setLog] = useState<LogEntry[]>([]); const [log, setLog] = useState<LogEntry[]>([]);
const [connected, setConnected] = useState(false); const [connected, setConnected] = useState(false);
const [connecting, setConnecting] = useState(false); const [connecting, setConnecting] = useState(false);
@@ -231,7 +254,15 @@ function App() {
socketRef.current = socket; socketRef.current = socket;
socket.onopen = () => { socket.onopen = () => {
socket.send(JSON.stringify({ type: "connect", host, nickname })); socket.send(
JSON.stringify({
type: "connect",
host,
nickname,
serverPassword: serverPassword || undefined,
channelPassword: channelPassword || undefined,
})
);
}; };
socket.onmessage = (event) => { socket.onmessage = (event) => {
@@ -242,6 +273,8 @@ function App() {
setConnecting(false); setConnecting(false);
setConnectError(null); setConnectError(null);
setConnected(true); setConnected(true);
localStorage.setItem(LAST_HOST_KEY, host);
localStorage.setItem(LAST_NICKNAME_KEY, nickname);
setServerChat((prev) => [...prev, { from: "Server", message: data.welcomeMessage }]); setServerChat((prev) => [...prev, { from: "Server", message: data.welcomeMessage }]);
break; break;
case "channels": case "channels":
@@ -422,6 +455,38 @@ function App() {
disabled={connected || connecting} disabled={connected || connecting}
/> />
</label> </label>
{!connected && (
<button
className={showPasswordFields ? "ts-mic-on" : undefined}
onClick={() => setShowPasswordFields((v) => !v)}
disabled={connecting}
title="Server/channel password"
>
🔒
</button>
)}
{!connected && showPasswordFields && (
<>
<label>
Server password
<input
type="password"
value={serverPassword}
onChange={(e) => setServerPassword(e.target.value)}
disabled={connecting}
/>
</label>
<label>
Channel password
<input
type="password"
value={channelPassword}
onChange={(e) => setChannelPassword(e.target.value)}
disabled={connecting}
/>
</label>
</>
)}
{!connected ? ( {!connected ? (
<button onClick={handleConnect} disabled={connecting}> <button onClick={handleConnect} disabled={connecting}>
{connecting ? "Connecting…" : "Connect"} {connecting ? "Connecting…" : "Connect"}