Merge upstream/main into GreenTeaSpeak main to resolve PR #4 conflicts.

Keep TeaSpeak/GTS multi-tab work while integrating channel-password prompts and the Pulse theme.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nico B.andCursor committed 2026-09-06 00:54:04 +02:00
commit 3db5d90d89
7 files changed
+719 -20

No files matched your search

+45 -8
View File
@@ -27,7 +27,7 @@ use tsclientlib::{
data, ChannelGroupId, ChannelId, ClientDbId, ClientId, ClientType, CodecEncryptionMode,
Connection, DisconnectOptions, HostBannerMode, HostMessageMode, Identity, InMessage,
LicenseType, MaxClients, MessageHandle, MessageTarget, Permission, Reason, ServerGroupId,
ServerType, StreamItem, TextMessageTargetMode,
ServerType, StreamItem, TextMessageTargetMode, TsError,
};
use tsproto_packets::packets::{AudioData, CodecType, Direction, Flags, OutAudio, OutCommand, PacketType};
@@ -237,6 +237,11 @@ enum Event {
Disconnected { reason: String },
#[serde(rename = "error")]
Error { message: String },
/// A "switch" to a password-protected channel was rejected because no (or
/// the wrong) password was supplied. The frontend should prompt for a
/// password and retry with it rather than showing a generic error.
#[serde(rename = "channelPasswordRequired")]
ChannelPasswordRequired { channel_id: u64 },
/// Server-tab log notification (client join/leave/switch, channel group
/// assignment, channel/server changes, own permission errors).
#[serde(rename = "serverLog")]
@@ -840,6 +845,10 @@ async fn run(args: Args) -> Result<()> {
// `send_with_result()` for text messages gets us a `MessageResult` event we
// can surface as a visible error instead of the message just vanishing.
let mut pending_messages: HashMap<MessageHandle, String> = HashMap::new();
// Tracks which channel a pending "Channel switch" MessageResult is for, so
// a ChannelInvalidPassword failure can be reported as ChannelPasswordRequired
// for that specific channel instead of a generic error.
let mut pending_switch_channel: HashMap<MessageHandle, u64> = HashMap::new();
// When non-empty, outgoing voice is whispered to just these channels/clients
// instead of being sent to the current channel - set via the "whisper "
// stdin command, cleared via "unwhisper".
@@ -950,17 +959,37 @@ async fn run(args: Args) -> Result<()> {
emit(&Event::Disconnected { reason: "client requested".into() });
break;
} else if let Some(rest) = l.strip_prefix("switch ") {
match rest.trim().parse::<u64>() {
// "switch <id>" or "switch <id> <base64-encoded password>" - the
// password travels base64-encoded since this is a line-based
// stdin protocol and a password could contain spaces/newlines.
let mut switch_args = rest.trim().splitn(2, ' ');
let id_arg = switch_args.next().unwrap_or("");
let password_arg = switch_args.next();
match id_arg.parse::<u64>() {
Ok(id) => {
let password = password_arg.and_then(|p| {
base64::engine::general_purpose::STANDARD
.decode(p)
.ok()
.and_then(|bytes| String::from_utf8(bytes).ok())
});
// Build clientmove defensively: missing own client must not panic
// the whole connector (that looked like a dead Join from the UI).
let part = match con.get_state() {
Ok(state) => match state.clients.get(&state.own_client) {
Some(own) => {
// Always include cpw= (empty) like the GTS desktop client —
// some TeaSpeak builds are picky about an omitted key.
let mut part = own.client_move(ChannelId(id));
part.channel_password = Some(std::borrow::Cow::Borrowed(""));
match &password {
Some(pwd) => {
part = part.set_password(pwd);
}
None => {
// Always include cpw= (empty) like the GTS desktop client -
// some TeaSpeak builds are picky about an omitted key.
part.channel_password =
Some(std::borrow::Cow::Borrowed(""));
}
}
Some(part)
}
None => {
@@ -982,12 +1011,13 @@ async fn run(args: Args) -> Result<()> {
match part.send_with_result(&mut con) {
Ok(handle) => {
pending_messages.insert(handle, "Channel switch".into());
pending_switch_channel.insert(handle, id);
}
Err(e) => emit(&Event::Error { message: e.to_string() }),
}
}
}
Err(_) => emit(&Event::Error { message: format!("Invalid channel id: {rest}") }),
}
Err(_) => emit(&Event::Error { message: format!("Invalid channel id: {id_arg}") }),
}
} else if let Some(message) = l.strip_prefix("chat ") {
let part = OutSendTextMessagePart {
@@ -2162,8 +2192,15 @@ async fn run(args: Args) -> Result<()> {
}
Some(Ok(StreamItem::MessageResult(handle, result))) => {
if let Some(label) = pending_messages.remove(&handle) {
let switch_channel_id = pending_switch_channel.remove(&handle);
if let Err(e) = result {
if e.missing_permission.is_some() {
if label == "Channel switch" && e.error == TsError::ChannelInvalidPassword {
if let Some(channel_id) = switch_channel_id {
emit(&Event::ChannelPasswordRequired { channel_id });
} else {
emit(&Event::Error { message: format!("{label} failed: {e}") });
}
} else if e.missing_permission.is_some() {
emit(&Event::ServerLog {
entry: ServerLogEntry::PermissionError { action: label },
});
+1 -1
View File
@@ -134,7 +134,7 @@ wss.on("connection", (socket: WebSocket) => {
case "switchChannel": {
const channelId = Number(msg.channelId);
if (Number.isFinite(channelId)) {
await connection?.switchChannel(channelId);
await connection?.switchChannel(channelId, msg.channelPassword);
}
break;
}
+9 -2
View File
@@ -131,6 +131,7 @@ export type Ts3ConnectionEvent =
| { type: "talkers"; clients: number[] }
| { type: "disconnected"; reason: string }
| { type: "error"; message: string }
| { type: "channelPasswordRequired"; channelId: number }
| ({ type: "serverLog" } & ServerLogEntry)
| {
type: "clientConnectionInfo";
@@ -293,6 +294,7 @@ export class Ts3Connection {
| { type: "talkers"; clients: number[] }
| { type: "disconnected"; reason: string }
| { type: "error"; message: string }
| { type: "channelPasswordRequired"; channel_id: number }
| ({ type: "serverLog" } & ServerLogEntry)
| {
type: "clientConnectionInfo";
@@ -516,6 +518,8 @@ export class Ts3Connection {
message: event.message,
timestamp: event.timestamp,
});
} else if (event.type === "channelPasswordRequired") {
this.emit({ type: "channelPasswordRequired", channelId: event.channel_id });
} else {
this.emit(event);
}
@@ -537,10 +541,13 @@ export class Ts3Connection {
});
}
async switchChannel(channelId: number): Promise<void> {
async switchChannel(channelId: number, channelPassword?: string): Promise<void> {
const id = Number(channelId);
if (!Number.isFinite(id)) return;
this.child?.stdin.write(`switch ${id}\n`);
// The password travels base64-encoded on this line-based stdin protocol
// so it can safely contain spaces or other characters.
const passwordArg = channelPassword ? ` ${Buffer.from(channelPassword, "utf8").toString("base64")}` : "";
this.child?.stdin.write(`switch ${id}${passwordArg}\n`);
}
async getClientConnectionInfo(clientId: number): Promise<void> {
+490
View File
@@ -796,6 +796,487 @@
border: 2px solid var(--bg);
}
/* Pulse: alternate design, independent of the light/dark toggle (always
dark). Visual reference: a Discord-style client with a dark rounded
sidebar, pill-shaped channel/client rows and a floating card-based main
panel - reimplemented from scratch in our own markup/CSS (no code or
assets borrowed), reusing the same DOM/class names as Standard/Nova the
way Nova does, with its own indigo/violet accent (colors need not match
any particular reference client). */
:where(.ts-app.ts-design-pulse) {
--success: oklch(0.75 0.15 150);
--bg: oklch(0.19 0.02 290);
--bg-toolbar-1: oklch(0.155 0.018 290);
--bg-toolbar-2: oklch(0.235 0.024 290);
--border: oklch(0.32 0.02 290);
--border-soft: oklch(0.27 0.02 290);
--text: oklch(0.95 0.006 290);
--text-muted: oklch(0.64 0.014 290);
--text-faint: oklch(0.48 0.012 290);
--accent: #9d8cf0;
--input-bg: oklch(0.235 0.024 290);
--input-text: oklch(0.95 0.006 290);
--button-bg-1: oklch(0.235 0.024 290);
--button-bg-2: oklch(0.155 0.018 290);
--button-bg-hover-1: oklch(0.28 0.026 290);
--button-bg-hover-2: oklch(0.235 0.024 290);
--row-hover: oklch(0.27 0.03 290);
--client-text: oklch(0.95 0.006 290);
--self-text: #9d8cf0;
--log-bg: oklch(0.155 0.018 290);
--log-text: oklch(0.64 0.014 290);
--log-error: oklch(0.68 0.16 25);
color-scheme: dark;
font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.ts-app.ts-design-pulse button,
.ts-app.ts-design-pulse select,
.ts-app.ts-design-pulse input[type="text"],
.ts-app.ts-design-pulse input[type="password"],
.ts-app.ts-design-pulse input[type="search"],
.ts-app.ts-design-pulse .ts-dialog {
border-radius: 10px;
}
/* Top bar: rendered as a breadcrumb - app logo, then the server name, then
(when a channel is selected) a chevron and the channel name - instead of
Standard's menu-item row. The menu items themselves fold into a single
overflow button so the breadcrumb reads clean, mirroring the reference
client's header. */
.ts-app.ts-design-pulse > .ts-menubar {
order: 0;
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.65rem 1.2rem;
background: var(--bg-toolbar-1);
border-bottom: 1px solid var(--border-soft);
}
.ts-app.ts-design-pulse > .ts-menubar .ts-nova-menu-dropdown {
order: 1;
}
.ts-app.ts-design-pulse > .ts-menubar .ts-menubar-item {
border-radius: 8px;
color: var(--text-muted);
}
.ts-app.ts-design-pulse > .ts-menubar .ts-menubar-item-active {
background: var(--bg-toolbar-2);
color: var(--text);
}
.ts-app.ts-design-pulse > .ts-body {
order: 1;
}
.ts-app.ts-design-pulse > .ts-log {
order: 2;
}
/* Voice control bar, bottom-docked like Nova's, but pill-shaped controls on
a flat strip instead of Nova's rounded-square icon buttons. */
.ts-app.ts-design-pulse > .ts-toolbar {
order: 3;
flex-direction: row;
align-items: center;
background: var(--bg-toolbar-1);
border-bottom: none;
border-top: 1px solid var(--border-soft);
padding: 0.6rem 1.2rem;
}
.ts-app.ts-design-pulse > .ts-toolbar .ts-toolbar-icons {
flex: 1;
justify-content: center;
gap: 0.6rem;
flex-wrap: wrap;
}
.ts-app.ts-design-pulse > .ts-toolbar .ts-icon-button {
width: 40px;
height: 40px;
border-radius: 999px;
font-size: 16px;
}
.ts-app.ts-design-pulse > .ts-toolbar .ts-toolbar-sep {
height: 24px;
align-self: center;
margin: 0 0.3rem;
}
.ts-app.ts-design-pulse > .ts-toolbar .ts-app-logo {
border-radius: 999px;
}
.ts-pulse-topbar-server {
display: flex;
align-items: center;
gap: 0.55rem;
font-weight: 700;
font-size: 14px;
}
.ts-pulse-topbar-logo {
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border-radius: 7px;
background: var(--accent);
color: var(--bg-toolbar-1);
font-weight: 800;
font-size: 12px;
flex-shrink: 0;
}
.ts-pulse-topbar-crumb-sep {
color: var(--text-faint);
font-weight: 400;
}
.ts-pulse-topbar-channel {
color: var(--text-muted);
font-weight: 600;
}
.ts-app.ts-design-pulse .ts-icon-button,
.ts-app.ts-design-pulse .ts-toolbar-fields button,
.ts-app.ts-design-pulse .ts-chat-input-row button {
border-radius: 999px;
background: var(--button-bg-1);
padding: 0.35rem 0.6rem;
}
.ts-app.ts-design-pulse .ts-icon-button:hover,
.ts-app.ts-design-pulse .ts-toolbar-fields button:hover,
.ts-app.ts-design-pulse .ts-chat-input-row button:hover {
background: var(--button-bg-hover-1);
}
.ts-app.ts-design-pulse .ts-icon-caret {
height: 40px;
display: inline-flex;
align-items: center;
border-radius: 0 999px 999px 0;
background: var(--button-bg-1);
}
.ts-app.ts-design-pulse .ts-toolbar-away .ts-icon-button {
border-radius: 999px 0 0 999px;
}
/* Floating-card layout: sidebar and chat panel read as separate rounded
cards with a gap between them (and against the window edges), instead of
Standard's flush panes or Nova's single joined pair. */
.ts-app.ts-design-pulse .ts-upper {
gap: 0.7rem;
padding: 0.7rem 0.7rem 0;
}
.ts-app.ts-design-pulse .ts-tree-panel,
.ts-app.ts-design-pulse .ts-info-panel {
background: var(--bg-toolbar-1);
border: 1px solid var(--border-soft);
border-radius: 14px;
}
.ts-app.ts-design-pulse .ts-resize-handle-vertical,
.ts-app.ts-design-pulse .ts-resize-handle-horizontal {
background: transparent;
}
.ts-app.ts-design-pulse .ts-banner-panel {
border-radius: 14px;
border: 1px solid var(--border-soft);
margin: 0 0.7rem;
}
.ts-app.ts-design-pulse .ts-chat-panel {
background: var(--bg-toolbar-1);
border: 1px solid var(--border-soft);
border-radius: 14px;
overflow: hidden;
margin: 0.7rem;
}
/* Speaking Now strip: a row of avatar tiles for everyone in the player's
current channel, with the talking member's avatar highlighted - the
"who's speaking" strip from the reference client's connected view. */
.ts-app.ts-design-pulse .ts-speaking-now {
display: flex;
flex-wrap: wrap;
gap: 0.6rem;
padding: 0.7rem 0.9rem;
border-bottom: 1px solid var(--border-soft);
}
.ts-app.ts-design-pulse .ts-speaking-now-tile {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.3rem;
width: 52px;
}
.ts-app.ts-design-pulse .ts-speaking-now-avatar {
display: inline-flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border-radius: 50%;
font-size: 14px;
font-weight: 800;
color: oklch(0.18 0.02 290);
box-shadow: 0 0 0 2px transparent;
transition: box-shadow 0.15s ease;
}
.ts-app.ts-design-pulse .ts-speaking-now-tile-active .ts-speaking-now-avatar {
box-shadow: 0 0 0 3px var(--success);
}
.ts-app.ts-design-pulse .ts-speaking-now-name {
font-size: 10px;
color: var(--text-muted);
max-width: 52px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.ts-app.ts-design-pulse .ts-speaking-now-tile-active .ts-speaking-now-name {
color: var(--text);
}
/* Pill-shaped sidebar rows for channels/clients, accent bar on the
selected row instead of a full-row outline. */
.ts-app.ts-design-pulse .ts-row {
padding: 5px 8px;
border-radius: 999px;
margin: 1px 0;
}
.ts-app.ts-design-pulse .ts-client-row {
padding-left: 1.2rem;
}
.ts-app.ts-design-pulse .ts-row-selected {
border-radius: 999px;
outline: none;
background: var(--bg-toolbar-2);
box-shadow: inset 3px 0 0 var(--accent);
}
.ts-app.ts-design-pulse .ts-row:hover:not(.ts-row-selected) {
background: var(--row-hover);
}
/* Rounded circular avatar chips (vs. Nova's rounded squares), matching the
reference client's member-list look. */
.ts-app.ts-design-pulse .ts-client-avatar {
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border-radius: 50%;
flex-shrink: 0;
font-size: 9.5px;
font-weight: 800;
color: oklch(0.18 0.02 290);
}
.ts-app.ts-design-pulse .ts-talking .ts-client-avatar {
box-shadow: 0 0 0 2px var(--success);
}
/* Rounded pill tab bar for the channel/server/PM chat tabs, sitting above
the message list rather than flush against it. */
.ts-app.ts-design-pulse .ts-chat-tabs {
order: -1;
border-top: none;
border-bottom: 1px solid var(--border-soft);
padding: 0.55rem 0.7rem 0.4rem;
gap: 0.35rem;
}
.ts-app.ts-design-pulse .ts-chat-tab {
border: none;
border-radius: 999px;
background: var(--bg-toolbar-2);
color: var(--text-muted);
padding: 0.4rem 0.85rem;
font-weight: 600;
}
.ts-app.ts-design-pulse .ts-chat-tab:hover:not(.ts-chat-tab-active) {
color: var(--text);
}
.ts-app.ts-design-pulse .ts-chat-tab-active {
background: var(--accent);
color: var(--bg-toolbar-1);
font-weight: 700;
}
/* Bubble-style chat messages, own messages right-aligned in an accent
bubble, others left-aligned in a muted-surface bubble; log lines render
as a centered, faint pill. */
.ts-app.ts-design-pulse .ts-chat-messages {
padding: 0.9rem 1rem;
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.ts-app.ts-design-pulse .ts-chat-line {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 2px;
max-width: 70%;
padding: 0;
}
.ts-app.ts-design-pulse .ts-chat-line-self {
align-self: flex-end;
align-items: flex-end;
}
.ts-app.ts-design-pulse .ts-chat-from {
font-size: 11.5px;
font-weight: 700;
color: var(--text-muted);
}
.ts-app.ts-design-pulse .ts-chat-line-self .ts-chat-from {
color: var(--accent);
}
.ts-app.ts-design-pulse .ts-chat-bubble {
display: inline-block;
background: var(--bg-toolbar-2);
padding: 0.5rem 0.75rem;
border-radius: 14px 14px 14px 4px;
line-height: 1.45;
}
.ts-app.ts-design-pulse .ts-chat-line-self .ts-chat-bubble {
background: var(--accent);
color: var(--bg-toolbar-1);
border-radius: 14px 14px 4px 14px;
font-weight: 600;
}
.ts-app.ts-design-pulse .ts-chat-line-log {
align-self: center;
align-items: center;
max-width: none;
background: var(--bg-toolbar-2);
color: var(--text-faint);
font-style: italic;
font-size: 11.5px;
padding: 0.25rem 0.75rem;
border-radius: 999px;
}
.ts-app.ts-design-pulse .ts-chat-input-row {
border-top: 1px solid var(--border-soft);
padding: 0.6rem 0.8rem;
align-items: center;
}
.ts-app.ts-design-pulse .ts-chat-input-row textarea {
border-radius: 999px;
border-color: var(--border-soft);
background: var(--bg-toolbar-2);
padding: 0.55rem 1rem;
}
.ts-app.ts-design-pulse .ts-chat-input-row button {
width: 40px;
height: 40px;
padding: 0;
border: none;
border-radius: 50%;
background: var(--accent);
color: transparent;
font-size: 0;
flex-shrink: 0;
position: relative;
}
.ts-app.ts-design-pulse .ts-chat-input-row button:hover {
background: var(--accent);
filter: brightness(1.08);
}
.ts-app.ts-design-pulse .ts-chat-input-row button:disabled {
opacity: 0.4;
}
.ts-app.ts-design-pulse .ts-chat-input-row button::before {
content: "➤";
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 15px;
color: var(--bg-toolbar-1);
}
.ts-app.ts-design-pulse .ts-log {
border-top: 1px solid var(--border-soft);
margin: 0 0.7rem 0.7rem;
border: 1px solid var(--border-soft);
border-radius: 12px;
}
.ts-app.ts-design-pulse .ts-dialog {
border-radius: 14px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.ts-app.ts-design-pulse .ts-menu {
border-radius: 10px;
overflow: hidden;
}
.ts-app.ts-design-pulse .ts-menu-item:hover:not(:disabled) {
border-radius: 8px;
}
.ts-app.ts-design-pulse ::-webkit-scrollbar {
width: 10px;
height: 10px;
}
.ts-app.ts-design-pulse ::-webkit-scrollbar-track {
background: transparent;
}
.ts-app.ts-design-pulse ::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 999px;
border: 2px solid var(--bg);
}
/* Demo mode banner */
.ts-demo-banner {
@@ -1603,6 +2084,11 @@
.ts-menu-away {
min-width: 220px;
/* This dropdown hangs off the bottom toolbar, so opening downward (the
.ts-menu default) would push it below the viewport and force the whole
page to scroll - open upward instead. */
top: auto;
bottom: 100%;
}
/* Chat */
@@ -2616,6 +3102,10 @@
.ts-design-theme-swatch-greenteaspeak {
background: linear-gradient(135deg, #1f2329 40%, #6fbf5c 40%, #386896 70%, #c8b882 70%);
}
.ts-design-theme-swatch-pulse {
background: linear-gradient(135deg, oklch(0.22 0.02 285) 0%, oklch(0.15 0.03 290) 100%);
box-shadow: inset 0 0 0 1px #9d8cf0;
}
.ts-design-theme-card-name {
font-weight: 600;
+156 -9
View File
@@ -169,12 +169,13 @@ const DESIGN_THEME_KEY = "webspeak3:design-theme";
const DESIGN_SELECTION_KEY = "webspeak3:design-selection";
const CUSTOM_THEMES_KEY = "webspeak3:custom-themes";
type DesignTheme = "standard" | "nova" | "greenteaspeak";
type DesignTheme = "standard" | "nova" | "greenteaspeak" | "pulse";
/** A user-authored theme package: a name, which built-in layout it behaves like
* (Standard's plain chrome vs Nova's collapsed menu/splash vs GreenTeaSpeak shell),
* and raw CSS that gets injected while it's active - free-form, so it can restyle
* or even reflow the existing markup. */
* (Standard's plain chrome, Nova's collapsed menu/splash, GreenTeaSpeak shell,
* or Pulse's card/sidebar layout), and raw CSS that gets injected while it's
* active - free-form, so it can restyle or even reflow the existing markup
* (e.g. via flex `order`, `display:none`, overlays). */
type CustomTheme = {
id: string;
name: string;
@@ -183,7 +184,7 @@ type CustomTheme = {
};
function isDesignTheme(value: string): value is DesignTheme {
return value === "standard" || value === "nova" || value === "greenteaspeak";
return value === "standard" || value === "nova" || value === "greenteaspeak" || value === "pulse";
}
function loadDesignTheme(): DesignTheme {
@@ -201,6 +202,7 @@ function resolveDesignThemeBase(selection: string, customThemes: CustomTheme[]):
function designThemeClassName(theme: DesignTheme): string {
if (theme === "nova") return " ts-design-nova";
if (theme === "pulse") return " ts-design-pulse";
if (isGreenteaSpeakTheme(theme)) return " ts-design-greenteaspeak";
return "";
}
@@ -208,6 +210,7 @@ function designThemeClassName(theme: DesignTheme): string {
function designThemeLabel(theme: DesignTheme, t: (key: string) => string): string {
if (theme === "nova") return t("design.theme.nova");
if (theme === "greenteaspeak") return t("design.theme.greenteaspeak");
if (theme === "pulse") return t("design.theme.pulse");
return t("design.theme.standard");
}
@@ -905,6 +908,46 @@ function ChannelTree({
);
}
/** Pulse-theme-only: a row of avatar tiles for everyone in the player's current
* channel, with a highlighted ring on whoever is currently talking - the
* "who's speaking" strip from the reference client's connected view. Purely
* derived from state ChannelTree already has (own channel + `talkers`), no
* new backend data needed. */
function SpeakingNowBar({
clients,
talkers,
ownClientId,
}: {
clients: ClientInfo[];
talkers: Set<number>;
ownClientId: number | null;
}) {
const own = clients.find((c) => c.id === ownClientId);
if (!own) return null;
const channelClients = clients.filter((c) => c.channel === own.channel);
if (channelClients.length === 0) return null;
return (
<div className="ts-speaking-now">
{channelClients.map((c) => (
<div
key={c.id}
className={`ts-speaking-now-tile${talkers.has(c.id) ? " ts-speaking-now-tile-active" : ""}`}
title={c.name}
>
<span
className="ts-speaking-now-avatar"
style={{ background: c.id === ownClientId ? "var(--accent)" : clientAvatarColor(c.name) }}
>
{c.name.trim().charAt(0).toUpperCase() || "?"}
</span>
<span className="ts-speaking-now-name">{c.name}</span>
</div>
))}
</div>
);
}
function InfoPanel({
selected,
host,
@@ -1349,6 +1392,59 @@ function ConnectDialog({
);
}
function ChannelPasswordDialog({
channelName,
wrongPassword,
onSubmit,
onCancel,
}: {
channelName: string;
wrongPassword: boolean;
onSubmit: (password: string) => void;
onCancel: () => void;
}) {
const t = useT();
const [password, setPassword] = useState("");
const backdrop = { onClick: onCancel };
return (
<div className="ts-dialog-backdrop" {...backdrop}>
<div className="ts-dialog ts-channel-password-dialog" onClick={(e) => e.stopPropagation()}>
<div className="ts-dialog-titlebar">
<span>{t("channelPasswordDialog.title")}</span>
</div>
<div className="ts-dialog-body">
<p>
{wrongPassword ? t("channelPasswordDialog.wrongPassword") : t("channelPasswordDialog.prompt")}
{channelName ? ` (${channelName})` : ""}
</p>
<label className="ts-dialog-field ts-dialog-field-grow">
<input
type="password"
autoFocus
value={password}
onChange={(e) => setPassword(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter") onSubmit(password);
if (e.key === "Escape") onCancel();
}}
/>
</label>
</div>
<div className="ts-dialog-buttons">
<div className="ts-dialog-buttons-right">
<button type="button" onClick={onCancel}>
{t("channelPasswordDialog.cancel")}
</button>
<button type="button" onClick={() => onSubmit(password)}>
{t("channelPasswordDialog.submit")}
</button>
</div>
</div>
</div>
</div>
);
}
function FavoritesDialog({
favorites,
prefillNew,
@@ -4038,6 +4134,7 @@ function DesignPanel({
name: t("design.theme.greenteaspeak"),
desc: t("design.theme.greenteaspeak.desc"),
},
{ id: "pulse", name: t("design.theme.pulse"), desc: t("design.theme.pulse.desc") },
];
const handleSaveEditing = () => {
@@ -4101,6 +4198,7 @@ function DesignPanel({
<option value="standard">{t("design.theme.standard")}</option>
<option value="nova">{t("design.theme.nova")}</option>
<option value="greenteaspeak">{t("design.theme.greenteaspeak")}</option>
<option value="pulse">{t("design.theme.pulse")}</option>
</select>
</label>
<label className="ts-options-field">
@@ -4800,6 +4898,13 @@ function AppInner() {
() => localStorage.getItem(LAST_PRIVILEGE_KEY) ?? ""
);
const [serverType, setServerType] = useState<ServerType>(loadServerType);
// Prompt shown when switching into a password-protected channel mid-session
// (the initial-connect "default channel" password above is a separate field).
const [channelPasswordPrompt, setChannelPasswordPrompt] = useState<{
channelId: number;
channelName: string;
wrongPassword: boolean;
} | null>(null);
const [connectDialogOpen, setConnectDialogOpen] = useState(false);
const [connectDialogExpanded, setConnectDialogExpanded] = useState(false);
const [log, setLog] = useState<LogEntry[]>([]);
@@ -5018,6 +5123,9 @@ function AppInner() {
const [recording, setRecording] = useState(false);
const whisperLogIdRef = useRef(0);
const prevWhisperTargetsRef = useRef<{ channels: Set<number>; clients: Set<number> } | null>(null);
// Channel passwords entered this session, so re-entering a channel already
// unlocked doesn't prompt again. In-memory only - cleared on disconnect.
const channelPasswordCacheRef = useRef<Map<number, string>>(new Map());
const logClient = (level: LogLevel, category: string, message: string) => {
const entry: ClientLogEntry = { id: ++logIdRef.current, timestamp: Date.now(), category, level, message };
@@ -5316,6 +5424,8 @@ function AppInner() {
setConnected(false);
setConnecting(false);
setConnectError(null);
setChannelPasswordPrompt(null);
channelPasswordCacheRef.current.clear();
setChannels([]);
setClients([]);
setOwnClientId(null);
@@ -5694,12 +5804,27 @@ function AppInner() {
case "disconnected": {
const wasConnected = hasConnectedRef.current;
cleanDisconnectRef.current = true;
setChannelPasswordPrompt(null);
channelPasswordCacheRef.current.clear();
appendLog({ text: `Disconnected: ${data.reason}`, kind: "info" });
logClient("info", "Connection", `Disconnected: ${data.reason}`);
if (wasConnected) void playSound("disconnect");
removeSession(sessionId, { skipSocketClose: true });
break;
}
case "channelPasswordRequired": {
// A cached password just got rejected (channel password changed,
// or was wrong) - drop it so the next auto-switch doesn't reuse it.
channelPasswordCacheRef.current.delete(data.channelId);
setChannelPasswordPrompt((prev) => ({
channelId: data.channelId,
// `channels` here can be stale (this handler's closure is fixed at
// connect time) - the dialog falls back to showing just the id.
channelName: channels.find((c) => c.id === data.channelId)?.name ?? "",
wrongPassword: prev?.channelId === data.channelId,
}));
break;
}
case "error":
logClient("error", "Connection", data.message);
if (hasConnectedRef.current) {
@@ -6447,11 +6572,11 @@ function AppInner() {
audioPlayerRef.current?.playTestTone();
};
const handleSwitchChannel = (channelId: number) => {
const handleSwitchChannel = (channelId: number, channelPassword?: string) => {
const id = Number(channelId);
if (!Number.isFinite(id)) return;
// Prefer server-reported own client id — nickname match breaks when the
// server renames us (Guest → Guest1) or another client shares our nick.
// Prefer server-reported own client id - nickname match breaks when the
// server renames us (Guest -> Guest1) or another client shares our nick.
const me =
ownClientId != null
? clients.find((c) => c.id === ownClientId)
@@ -6462,9 +6587,19 @@ function AppInner() {
appendLog({ text: t("tree.joinNotConnected"), kind: "error" });
return;
}
socket.send(JSON.stringify({ type: "switchChannel", channelId: id }));
const password = channelPassword ?? channelPasswordCacheRef.current.get(id);
socket.send(JSON.stringify({ type: "switchChannel", channelId: id, channelPassword: password }));
};
const handleChannelPasswordSubmit = (password: string) => {
if (!channelPasswordPrompt) return;
channelPasswordCacheRef.current.set(channelPasswordPrompt.channelId, password);
handleSwitchChannel(channelPasswordPrompt.channelId, password);
setChannelPasswordPrompt(null);
};
const handleChannelPasswordCancel = () => setChannelPasswordPrompt(null);
const handleSelectItem = (item: SelectedItem) => setSelected(item);
useEffect(() => {
@@ -7839,6 +7974,15 @@ function AppInner() {
/>
)}
{channelPasswordPrompt && (
<ChannelPasswordDialog
channelName={channelPasswordPrompt.channelName}
wrongPassword={channelPasswordPrompt.wrongPassword}
onSubmit={handleChannelPasswordSubmit}
onCancel={handleChannelPasswordCancel}
/>
)}
{inviteFriendOpen && (
<InviteFriendDialog
host={host}
@@ -8590,6 +8734,9 @@ function AppInner() {
<div className="ts-resize-handle-horizontal" onMouseDown={startUpperResize} />
<div className="ts-chat-panel">
{connected && designTheme === "pulse" && (
<SpeakingNowBar clients={clients} talkers={displayTalkers} ownClientId={ownClient?.id ?? null} />
)}
<div className="ts-chat-messages">
{activeTab === "channel"
? chat.map((entry, i) => (
+16
View File
@@ -90,6 +90,12 @@ const translations: Record<Lang, Record<string, string>> = {
"connect.newTab": "In neuem Tab",
"connect.cancel": "Abbrechen",
"channelPasswordDialog.title": "Channel-Passwort erforderlich",
"channelPasswordDialog.prompt": "Dieser Channel ist passwortgeschützt. Bitte Passwort eingeben:",
"channelPasswordDialog.wrongPassword": "Falsches Passwort, bitte erneut versuchen:",
"channelPasswordDialog.submit": "Beitreten",
"channelPasswordDialog.cancel": "Abbrechen",
"collectedUrls.title": "Gesammelte URLs",
"collectedUrls.search": "Suchen:",
"collectedUrls.url": "URL",
@@ -246,6 +252,8 @@ const translations: Record<Lang, Record<string, string>> = {
"design.theme.nova.desc": "Moderneres, dunkles Design mit abgerundeten Elementen.",
"design.theme.greenteaspeak": "GreenTeaSpeak",
"design.theme.greenteaspeak.desc": "Klassisches GreenTeaSpeak-Client-Layout mit dunklen Panels und goldener Menüleiste.",
"design.theme.pulse": "Pulse",
"design.theme.pulse.desc": "Karten-Layout mit Breadcrumb-Leiste und farbigem Akzent.",
"design.status.connected": "Verbunden",
"design.custom.new": "+ Neues Design",
"design.custom.import": "Design importieren",
@@ -642,6 +650,12 @@ const translations: Record<Lang, Record<string, string>> = {
"connect.newTab": "In new tab",
"connect.cancel": "Cancel",
"channelPasswordDialog.title": "Channel password required",
"channelPasswordDialog.prompt": "This channel is password-protected. Please enter the password:",
"channelPasswordDialog.wrongPassword": "Wrong password, please try again:",
"channelPasswordDialog.submit": "Join",
"channelPasswordDialog.cancel": "Cancel",
"collectedUrls.title": "Collected URLs",
"collectedUrls.search": "Search:",
"collectedUrls.url": "URL",
@@ -798,6 +812,8 @@ const translations: Record<Lang, Record<string, string>> = {
"design.theme.nova.desc": "A more modern, dark design with rounded elements.",
"design.theme.greenteaspeak": "GreenTeaSpeak",
"design.theme.greenteaspeak.desc": "Classic GreenTeaSpeak client layout with dark panels and a gold menu bar.",
"design.theme.pulse": "Pulse",
"design.theme.pulse.desc": "Card-based layout with a breadcrumb bar and a color accent.",
"design.status.connected": "Connected",
"design.custom.new": "+ New design",
"design.custom.import": "Import design",
+2
View File
@@ -234,6 +234,8 @@ export const zhCN: Record<string, string> = {
"design.theme.nova.desc": "更现代的深色设计,带圆角元素。",
"design.theme.greenteaspeak": "GreenTeaSpeak",
"design.theme.greenteaspeak.desc": "经典 GreenTeaSpeak 客户端布局:深色面板与金色菜单栏。",
"design.theme.pulse": "Pulse",
"design.theme.pulse.desc": "卡片式布局,带面包屑栏和彩色强调。",
"design.status.connected": "已连接",
"options.section.erweiterungen": "扩展",
"options.section.hotkeys": "快捷键",