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

+7
View File
@@ -211,6 +211,13 @@
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 {
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 LAST_HOST_KEY = "ts-web-client:last-host";
const LAST_NICKNAME_KEY = "ts-web-client:last-nickname";
type LogEntry = { text: string; kind: "info" | "error" };
interface ChannelInfo {
@@ -24,6 +27,11 @@ interface ClientInfo {
id: number;
channel: number;
name: string;
inputMuted: boolean;
outputMuted: boolean;
inputHardwareEnabled: boolean;
away: boolean;
isChannelCommander: boolean;
}
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() {
return (
<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true">
@@ -102,6 +121,7 @@ function ChannelTree({
>
<ClientIcon />
<span>{c.name}</span>
<ClientStatusIcons client={c} />
</div>
</li>
))}
@@ -141,8 +161,11 @@ interface PmThread {
type ActiveTab = "channel" | "server" | number;
function App() {
const [host, setHost] = useState("localhost");
const [nickname, setNickname] = useState("Claude Code");
const [host, setHost] = useState(() => localStorage.getItem(LAST_HOST_KEY) ?? "localhost");
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 [connected, setConnected] = useState(false);
const [connecting, setConnecting] = useState(false);
@@ -231,7 +254,15 @@ function App() {
socketRef.current = socket;
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) => {
@@ -242,6 +273,8 @@ function App() {
setConnecting(false);
setConnectError(null);
setConnected(true);
localStorage.setItem(LAST_HOST_KEY, host);
localStorage.setItem(LAST_NICKNAME_KEY, nickname);
setServerChat((prev) => [...prev, { from: "Server", message: data.welcomeMessage }]);
break;
case "channels":
@@ -422,6 +455,38 @@ function App() {
disabled={connected || connecting}
/>
</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 ? (
<button onClick={handleConnect} disabled={connecting}>
{connecting ? "Connecting…" : "Connect"}