mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74f688aba8 | ||
|
|
a300daedeb | ||
|
|
46ae5b120e | ||
|
|
284645f18d | ||
|
|
67c4bc1072 | ||
|
|
7bcced06fd | ||
|
|
f5cb4dd160 | ||
|
|
a0ede4a12a | ||
|
|
6c1fec8dcc | ||
|
|
6c4ace585d |
No files matched your search
@@ -46,10 +46,18 @@
|
||||
|---|---|
|
||||
| 🔌 **Real TeamSpeak protocol** | Connects to actual TS3/TS6 servers over a WebSocket gateway — the server stays exactly as-is |
|
||||
| 🎙️ **Low-latency voice** | Opus-encoded voice with voice activation ("Sprachaktivierung") and adjustable sensitivity |
|
||||
| 🤫 **Whisper** | Target your voice at specific channels or clients instead of your whole current channel |
|
||||
| 🔊 **Custom audio output picker** | Route playback to any output device — works even in browsers without `AudioContext.setSinkId` |
|
||||
| 💬 **Full text chat** | Channel, server-wide, and private (1:1) chat, each in its own tab |
|
||||
| 🌳 **Live channel/client tree** | Correct ordering, status icons (channel commander, away, muted, deafened), click to switch channels |
|
||||
| 💬 **Full text chat** | Channel, server-wide, and private (1:1) chat, each in its own tab — Shift+Enter for a newline |
|
||||
| 🌳 **Live channel/client tree** | Correct ordering, status icons (channel commander, away, muted, deafened), country flags, click to switch channels |
|
||||
| 🖱️ **Right-click context menu** | Private chat, poke, copy name, and whisper-target toggle straight from a client's row |
|
||||
| 📜 **Server log** | Join/leave/switch, channel-group, and channel/server-change events shown inline, like the native client |
|
||||
| 🔔 **Custom sound notifications** | Per-event sounds (connect, poke, messages, ...) with volume control and `.ts3soundpack` import |
|
||||
| 🪪 **Persistent identity** | Keeps the same client UID across sessions instead of generating a new one every connect |
|
||||
| 👉 **Poke & away status** | Poke clients with an optional message; set yourself away with presets or a custom status |
|
||||
| ⭐ **Favorites & reconnect** | Remembers your last server/nickname; switch servers without leaving your tab |
|
||||
| 📱 **Mobile-friendly layout** | Responsive single-column layout for narrow screens, not just a shrunk desktop UI |
|
||||
| 🌍 **Localized UI** | Interface available in German and English, detected automatically or switchable in Options |
|
||||
| 🌗 **Dark / light theme** | Clean, modern UI that adapts to your preference |
|
||||
| 🔁 **Seamless reconnect** | Switch connections mid-session — old state tears down cleanly, no leaks or duplicates |
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ struct ClientInfo {
|
||||
away_message: String,
|
||||
is_channel_commander: bool,
|
||||
country: String,
|
||||
uid: String,
|
||||
}
|
||||
|
||||
/// Human-facing entries for the Server tab's log-style notifications
|
||||
@@ -145,6 +146,34 @@ enum Event {
|
||||
#[serde(flatten)]
|
||||
entry: ServerLogEntry,
|
||||
},
|
||||
/// Reply to a "clientconninfo <id>" request - live stats for one client's
|
||||
/// connection (ping, packet loss, bytes/packets sent+received).
|
||||
#[serde(rename = "clientConnectionInfo")]
|
||||
ClientConnectionInfo {
|
||||
client_id: u16,
|
||||
ping_ms: Option<f64>,
|
||||
connected_secs: Option<i64>,
|
||||
ip: Option<String>,
|
||||
packets_sent: u64,
|
||||
bytes_sent: u64,
|
||||
packets_received: u64,
|
||||
bytes_received: u64,
|
||||
packet_loss_percent: f32,
|
||||
},
|
||||
/// Reply to a "serverconninfo" request - aggregate connection stats for
|
||||
/// the whole server-side link.
|
||||
#[serde(rename = "serverConnectionInfo")]
|
||||
ServerConnectionInfo {
|
||||
ping_ms: f64,
|
||||
connected_secs: i64,
|
||||
packet_loss_percent: f32,
|
||||
packets_sent_total: u64,
|
||||
bytes_sent_total: u64,
|
||||
packets_received_total: u64,
|
||||
bytes_received_total: u64,
|
||||
bandwidth_sent_last_second: u64,
|
||||
bandwidth_received_last_second: u64,
|
||||
},
|
||||
}
|
||||
|
||||
fn emit(event: &Event) {
|
||||
@@ -319,6 +348,7 @@ fn snapshot(con: &data::Connection) -> Event {
|
||||
away_message: c.away_message.clone().unwrap_or_default(),
|
||||
is_channel_commander: c.is_channel_commander,
|
||||
country: c.country_code.clone(),
|
||||
uid: c.uid.as_ref().map(|u| u.to_string()).unwrap_or_default(),
|
||||
})
|
||||
.collect();
|
||||
Event::Channels { channels, clients }
|
||||
@@ -450,6 +480,11 @@ async fn run(args: Args) -> Result<()> {
|
||||
// stdin command, cleared via "unwhisper".
|
||||
let mut whisper_channels: Vec<u64> = Vec::new();
|
||||
let mut whisper_clients: Vec<u16> = Vec::new();
|
||||
// Set by "clientconninfo"/"serverconninfo" while waiting for the server's
|
||||
// reply to land in book state (it arrives async as a later BookEvents
|
||||
// batch, not as a direct command result) - checked and emitted below.
|
||||
let mut pending_client_conninfo: Option<ClientId> = None;
|
||||
let mut pending_server_conninfo = false;
|
||||
|
||||
enum LoopOutcome {
|
||||
StdinLine(std::io::Result<Option<String>>),
|
||||
@@ -587,6 +622,11 @@ async fn run(args: Args) -> Result<()> {
|
||||
if let Err(e) = part.send(&mut con) {
|
||||
emit(&Event::Error { message: e.to_string() });
|
||||
}
|
||||
} else if let Some(rest) = l.strip_prefix("nickname ") {
|
||||
let part = con.get_state()?.client_update().set_name(rest.trim());
|
||||
if let Err(e) = part.send(&mut con) {
|
||||
emit(&Event::Error { message: e.to_string() });
|
||||
}
|
||||
} else if let Some(rest) = l.strip_prefix("whisper ") {
|
||||
// Format: "whisper <channelId,channelId,...>;<clientId,clientId,...>"
|
||||
// (either side may be empty, e.g. "whisper 5;" or "whisper ;12,13").
|
||||
@@ -598,6 +638,39 @@ async fn run(args: Args) -> Result<()> {
|
||||
} else if l == "unwhisper" {
|
||||
whisper_channels.clear();
|
||||
whisper_clients.clear();
|
||||
} else if let Some(rest) = l.strip_prefix("clientconninfo ") {
|
||||
match rest.trim().parse::<u16>() {
|
||||
Ok(id) => {
|
||||
let client_id = ClientId(id);
|
||||
let part = con.get_state()?.clients.get(&client_id).map(|c| c.connection_info());
|
||||
match part {
|
||||
// send_with_result (rather than send) so a missing-permission
|
||||
// rejection (e.g. viewing another client's connection info
|
||||
// without b_client_view_connection_info) surfaces as a visible
|
||||
// error instead of leaving the dialog stuck loading forever.
|
||||
Some(part) => match part.send_with_result(&mut con) {
|
||||
Ok(handle) => {
|
||||
pending_client_conninfo = Some(client_id);
|
||||
pending_messages.insert(handle, "Connection info".into());
|
||||
}
|
||||
Err(e) => emit(&Event::Error { message: e.to_string() }),
|
||||
},
|
||||
None => {
|
||||
emit(&Event::Error { message: format!("Unknown client id: {id}") })
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(_) => emit(&Event::Error { message: format!("Invalid client id: {rest}") }),
|
||||
}
|
||||
} else if l == "serverconninfo" {
|
||||
let part = con.get_state()?.server.connection_info();
|
||||
match part.send_with_result(&mut con) {
|
||||
Ok(handle) => {
|
||||
pending_server_conninfo = true;
|
||||
pending_messages.insert(handle, "Server connection info".into());
|
||||
}
|
||||
Err(e) => emit(&Event::Error { message: e.to_string() }),
|
||||
}
|
||||
} else if let Some(b64) = l.strip_prefix("audio ") {
|
||||
match base64::engine::general_purpose::STANDARD.decode(b64.trim()) {
|
||||
Ok(bytes) => {
|
||||
@@ -697,6 +770,51 @@ async fn run(args: Args) -> Result<()> {
|
||||
log_book_event(con.get_state()?, event);
|
||||
}
|
||||
}
|
||||
if let Some(client_id) = pending_client_conninfo {
|
||||
match con.get_state()?.clients.get(&client_id) {
|
||||
Some(client) => {
|
||||
if let Some(data) = &client.connection_data {
|
||||
emit(&Event::ClientConnectionInfo {
|
||||
client_id: client_id.0,
|
||||
ping_ms: data.ping.map(|d| d.as_seconds_f64() * 1000.0),
|
||||
connected_secs: data.connected_time.map(|d| d.whole_seconds()),
|
||||
ip: data.client_address.map(|a| a.ip().to_string()),
|
||||
packets_sent: data.packets_sent_speech.unwrap_or(0)
|
||||
+ data.packets_sent_keepalive.unwrap_or(0)
|
||||
+ data.packets_sent_control.unwrap_or(0),
|
||||
bytes_sent: data.bytes_sent_speech.unwrap_or(0)
|
||||
+ data.bytes_sent_keepalive.unwrap_or(0)
|
||||
+ data.bytes_sent_control.unwrap_or(0),
|
||||
packets_received: data.packets_received_speech.unwrap_or(0)
|
||||
+ data.packets_received_keepalive.unwrap_or(0)
|
||||
+ data.packets_received_control.unwrap_or(0),
|
||||
bytes_received: data.bytes_received_speech.unwrap_or(0)
|
||||
+ data.bytes_received_keepalive.unwrap_or(0)
|
||||
+ data.bytes_received_control.unwrap_or(0),
|
||||
packet_loss_percent: data.client_to_server_packetloss_total,
|
||||
});
|
||||
pending_client_conninfo = None;
|
||||
}
|
||||
}
|
||||
None => pending_client_conninfo = None,
|
||||
}
|
||||
}
|
||||
if pending_server_conninfo {
|
||||
if let Some(data) = &con.get_state()?.server.connection_data {
|
||||
emit(&Event::ServerConnectionInfo {
|
||||
ping_ms: data.ping.as_seconds_f64() * 1000.0,
|
||||
connected_secs: data.connected_time_total.whole_seconds(),
|
||||
packet_loss_percent: data.packetloss_total,
|
||||
packets_sent_total: data.packets_sent_total,
|
||||
bytes_sent_total: data.bytes_sent_total,
|
||||
packets_received_total: data.packets_received_total,
|
||||
bytes_received_total: data.bytes_received_total,
|
||||
bandwidth_sent_last_second: data.bandwidth_sent_last_second_total,
|
||||
bandwidth_received_last_second: data.bandwidth_received_last_second_total,
|
||||
});
|
||||
pending_server_conninfo = false;
|
||||
}
|
||||
}
|
||||
emit(&snapshot(con.get_state()?));
|
||||
}
|
||||
Some(Ok(StreamItem::Audio(packet))) => {
|
||||
|
||||
@@ -114,10 +114,22 @@ wss.on("connection", (socket: WebSocket) => {
|
||||
await connection?.setOutputMuted(msg.muted);
|
||||
break;
|
||||
}
|
||||
case "setNickname": {
|
||||
await connection?.setNickname(msg.nickname);
|
||||
break;
|
||||
}
|
||||
case "setWhisperTargets": {
|
||||
await connection?.setWhisperTargets(msg.channelIds ?? [], msg.clientIds ?? []);
|
||||
break;
|
||||
}
|
||||
case "getClientConnectionInfo": {
|
||||
await connection?.getClientConnectionInfo(msg.clientId);
|
||||
break;
|
||||
}
|
||||
case "getServerConnectionInfo": {
|
||||
await connection?.getServerConnectionInfo();
|
||||
break;
|
||||
}
|
||||
case "disconnect": {
|
||||
await connection?.disconnect(msg.message ?? "");
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,7 @@ export interface ClientInfo {
|
||||
awayMessage: string;
|
||||
isChannelCommander: boolean;
|
||||
country: string;
|
||||
uid: string;
|
||||
}
|
||||
|
||||
export type ServerLogEntry =
|
||||
@@ -65,7 +66,31 @@ export type Ts3ConnectionEvent =
|
||||
| { type: "talkers"; clients: number[] }
|
||||
| { type: "disconnected"; reason: string }
|
||||
| { type: "error"; message: string }
|
||||
| ({ type: "serverLog" } & ServerLogEntry);
|
||||
| ({ type: "serverLog" } & ServerLogEntry)
|
||||
| {
|
||||
type: "clientConnectionInfo";
|
||||
clientId: number;
|
||||
pingMs: number | null;
|
||||
connectedSecs: number | null;
|
||||
ip: string | null;
|
||||
packetsSent: number;
|
||||
bytesSent: number;
|
||||
packetsReceived: number;
|
||||
bytesReceived: number;
|
||||
packetLossPercent: number;
|
||||
}
|
||||
| {
|
||||
type: "serverConnectionInfo";
|
||||
pingMs: number;
|
||||
connectedSecs: number;
|
||||
packetLossPercent: number;
|
||||
packetsSentTotal: number;
|
||||
bytesSentTotal: number;
|
||||
packetsReceivedTotal: number;
|
||||
bytesReceivedTotal: number;
|
||||
bandwidthSentLastSecond: number;
|
||||
bandwidthReceivedLastSecond: number;
|
||||
};
|
||||
|
||||
export interface Ts3ConnectOptions {
|
||||
host: string;
|
||||
@@ -122,6 +147,7 @@ export class Ts3Connection {
|
||||
away_message: string;
|
||||
is_channel_commander: boolean;
|
||||
country: string;
|
||||
uid: string;
|
||||
}
|
||||
|
||||
interface RawChannelInfo {
|
||||
@@ -155,7 +181,31 @@ export class Ts3Connection {
|
||||
| { type: "talkers"; clients: number[] }
|
||||
| { type: "disconnected"; reason: string }
|
||||
| { type: "error"; message: string }
|
||||
| ({ type: "serverLog" } & ServerLogEntry);
|
||||
| ({ type: "serverLog" } & ServerLogEntry)
|
||||
| {
|
||||
type: "clientConnectionInfo";
|
||||
client_id: number;
|
||||
ping_ms: number | null;
|
||||
connected_secs: number | null;
|
||||
ip: string | null;
|
||||
packets_sent: number;
|
||||
bytes_sent: number;
|
||||
packets_received: number;
|
||||
bytes_received: number;
|
||||
packet_loss_percent: number;
|
||||
}
|
||||
| {
|
||||
type: "serverConnectionInfo";
|
||||
ping_ms: number;
|
||||
connected_secs: number;
|
||||
packet_loss_percent: number;
|
||||
packets_sent_total: number;
|
||||
bytes_sent_total: number;
|
||||
packets_received_total: number;
|
||||
bytes_received_total: number;
|
||||
bandwidth_sent_last_second: number;
|
||||
bandwidth_received_last_second: number;
|
||||
};
|
||||
|
||||
if (event.type === "connected") {
|
||||
this.emit({
|
||||
@@ -192,6 +242,7 @@ export class Ts3Connection {
|
||||
awayMessage: c.away_message,
|
||||
isChannelCommander: c.is_channel_commander,
|
||||
country: c.country,
|
||||
uid: c.uid,
|
||||
})),
|
||||
});
|
||||
} else if (event.type === "privateMessage") {
|
||||
@@ -202,6 +253,32 @@ export class Ts3Connection {
|
||||
fromSelf: event.from_self,
|
||||
message: event.message,
|
||||
});
|
||||
} else if (event.type === "clientConnectionInfo") {
|
||||
this.emit({
|
||||
type: "clientConnectionInfo",
|
||||
clientId: event.client_id,
|
||||
pingMs: event.ping_ms,
|
||||
connectedSecs: event.connected_secs,
|
||||
ip: event.ip,
|
||||
packetsSent: event.packets_sent,
|
||||
bytesSent: event.bytes_sent,
|
||||
packetsReceived: event.packets_received,
|
||||
bytesReceived: event.bytes_received,
|
||||
packetLossPercent: event.packet_loss_percent,
|
||||
});
|
||||
} else if (event.type === "serverConnectionInfo") {
|
||||
this.emit({
|
||||
type: "serverConnectionInfo",
|
||||
pingMs: event.ping_ms,
|
||||
connectedSecs: event.connected_secs,
|
||||
packetLossPercent: event.packet_loss_percent,
|
||||
packetsSentTotal: event.packets_sent_total,
|
||||
bytesSentTotal: event.bytes_sent_total,
|
||||
packetsReceivedTotal: event.packets_received_total,
|
||||
bytesReceivedTotal: event.bytes_received_total,
|
||||
bandwidthSentLastSecond: event.bandwidth_sent_last_second,
|
||||
bandwidthReceivedLastSecond: event.bandwidth_received_last_second,
|
||||
});
|
||||
} else {
|
||||
this.emit(event);
|
||||
}
|
||||
@@ -227,6 +304,14 @@ export class Ts3Connection {
|
||||
this.child?.stdin.write(`switch ${channelId}\n`);
|
||||
}
|
||||
|
||||
async getClientConnectionInfo(clientId: number): Promise<void> {
|
||||
this.child?.stdin.write(`clientconninfo ${clientId}\n`);
|
||||
}
|
||||
|
||||
async getServerConnectionInfo(): Promise<void> {
|
||||
this.child?.stdin.write(`serverconninfo\n`);
|
||||
}
|
||||
|
||||
async sendChatMessage(message: string): Promise<void> {
|
||||
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
|
||||
if (sanitized) this.child?.stdin.write(`chat ${sanitized}\n`);
|
||||
@@ -268,6 +353,11 @@ export class Ts3Connection {
|
||||
this.child?.stdin.write(`muteoutput ${muted ? "1" : "0"}\n`);
|
||||
}
|
||||
|
||||
async setNickname(nickname: string): Promise<void> {
|
||||
const sanitized = nickname.replace(/[\r\n]+/g, " ").trim();
|
||||
if (sanitized) this.child?.stdin.write(`nickname ${sanitized}\n`);
|
||||
}
|
||||
|
||||
/** Empty channelIds/clientIds clears whisper mode, returning outgoing
|
||||
* voice to the normal current-channel broadcast. */
|
||||
async setWhisperTargets(channelIds: number[], clientIds: number[]): Promise<void> {
|
||||
|
||||
+354
@@ -440,6 +440,42 @@
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-info-connection-link {
|
||||
margin-top: 0.5rem;
|
||||
background: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
color: var(--accent);
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.ts-info-connection-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.ts-connection-info-dialog {
|
||||
width: 380px;
|
||||
}
|
||||
|
||||
.ts-connection-info-loading {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-connection-info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 0.35rem 0.75rem;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ts-connection-info-grid span:nth-child(odd) {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-row-selected {
|
||||
background: var(--row-hover);
|
||||
outline: 1px solid var(--border);
|
||||
@@ -541,6 +577,20 @@
|
||||
background: color-mix(in srgb, var(--log-error) 30%, var(--button-bg-1)) !important;
|
||||
}
|
||||
|
||||
.ts-recording-on {
|
||||
background: color-mix(in srgb, var(--log-error) 35%, var(--button-bg-1)) !important;
|
||||
animation: ts-recording-pulse 1.4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes ts-recording-pulse {
|
||||
0%, 100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.55;
|
||||
}
|
||||
}
|
||||
|
||||
.ts-client-away-message {
|
||||
color: var(--text-muted);
|
||||
font-style: italic;
|
||||
@@ -767,6 +817,310 @@
|
||||
width: 420px;
|
||||
}
|
||||
|
||||
.ts-collected-urls-dialog {
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
.ts-invite-friend-dialog {
|
||||
width: 520px;
|
||||
}
|
||||
|
||||
.ts-client-log-dialog {
|
||||
width: 760px;
|
||||
}
|
||||
|
||||
.ts-whisper-history-dialog {
|
||||
width: 560px;
|
||||
}
|
||||
|
||||
.ts-contacts-dialog {
|
||||
width: 640px;
|
||||
}
|
||||
|
||||
.ts-contacts-body {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.ts-contacts-list-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.4rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ts-contacts-fields-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.ts-contacts-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 3px;
|
||||
height: 220px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ts-contacts-list-item {
|
||||
padding: 0.3rem 0.5rem;
|
||||
cursor: pointer;
|
||||
font-size: 12px;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
.ts-contacts-list-item:hover {
|
||||
background: var(--hover-bg, rgba(255, 255, 255, 0.05));
|
||||
}
|
||||
|
||||
.ts-contacts-list-item-selected {
|
||||
background: var(--accent-soft, rgba(78, 161, 247, 0.2));
|
||||
}
|
||||
|
||||
.ts-contacts-list-empty {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-contacts-online-dot {
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: #4caf50;
|
||||
margin-right: 0.4rem;
|
||||
}
|
||||
|
||||
.ts-contacts-category-acquaintance {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.ts-contacts-category-friend {
|
||||
color: #4caf50;
|
||||
}
|
||||
|
||||
.ts-contacts-category-blocked {
|
||||
color: #e5534b;
|
||||
}
|
||||
|
||||
.ts-contacts-category-group {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ts-contacts-actions {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
padding-top: 0.4rem;
|
||||
border-top: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
.ts-whisper-history-list {
|
||||
height: 260px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 3px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ts-whisper-history-empty {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-whisper-history-row {
|
||||
display: flex;
|
||||
gap: 0.6rem;
|
||||
padding: 0.3rem 0.5rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
.ts-whisper-lists-dialog {
|
||||
width: 480px;
|
||||
}
|
||||
|
||||
.ts-whisper-lists-list {
|
||||
list-style: none;
|
||||
margin: 0.5rem 0 0;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 3px;
|
||||
max-height: 260px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ts-whisper-lists-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
padding: 0.4rem 0.5rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ts-whisper-lists-item-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ts-whisper-lists-item-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ts-whisper-lists-item-detail {
|
||||
color: var(--text-muted);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.ts-whisper-lists-item-actions {
|
||||
display: flex;
|
||||
gap: 0.4rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-whisper-lists-empty {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-identities-dialog {
|
||||
width: 460px;
|
||||
}
|
||||
|
||||
.ts-identities-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 3px;
|
||||
max-height: 260px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ts-identities-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.35rem 0.5rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ts-identities-item-active {
|
||||
background: var(--accent-soft, rgba(78, 161, 247, 0.15));
|
||||
}
|
||||
|
||||
.ts-identities-name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ts-identities-status {
|
||||
color: var(--text-muted);
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ts-log-level-row {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ts-log-list {
|
||||
height: 320px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid var(--border-soft);
|
||||
border-radius: 3px;
|
||||
font-family: monospace;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.ts-log-row {
|
||||
display: flex;
|
||||
gap: 0.6rem;
|
||||
padding: 0.15rem 0.4rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ts-log-time {
|
||||
color: var(--text-muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-log-category {
|
||||
flex-shrink: 0;
|
||||
width: 90px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ts-log-level {
|
||||
flex-shrink: 0;
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
.ts-log-message {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ts-log-row-critical .ts-log-level,
|
||||
.ts-log-row-error .ts-log-level {
|
||||
color: #e5534b;
|
||||
}
|
||||
|
||||
.ts-log-row-warning .ts-log-level {
|
||||
color: #e5c34b;
|
||||
}
|
||||
|
||||
.ts-collected-urls-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
max-height: 360px;
|
||||
display: block;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ts-collected-urls-table thead,
|
||||
.ts-collected-urls-table tbody {
|
||||
display: table;
|
||||
width: 100%;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.ts-collected-urls-table th {
|
||||
text-align: left;
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
padding: 0.3rem 0.4rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
.ts-collected-urls-table td {
|
||||
padding: 0.3rem 0.4rem;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ts-collected-urls-table a {
|
||||
color: var(--link, #4ea1f7);
|
||||
}
|
||||
|
||||
.ts-away-dialog .ts-dialog-row {
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
+1561
-47
File diff suppressed because it is too large.
Load diff
+40
-4
@@ -29,6 +29,7 @@ interface DemoClient {
|
||||
awayMessage: string;
|
||||
isChannelCommander: boolean;
|
||||
country: string;
|
||||
uid: string;
|
||||
}
|
||||
|
||||
const DEMO_CHANNELS: DemoChannel[] = [
|
||||
@@ -38,10 +39,10 @@ const DEMO_CHANNELS: DemoChannel[] = [
|
||||
];
|
||||
|
||||
const DEMO_NPCS: DemoClient[] = [
|
||||
{ id: 102, channel: 1, name: "Alex", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: true, country: "US" },
|
||||
{ id: 103, channel: 2, name: "Sam", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "GB" },
|
||||
{ id: 104, channel: 2, name: "Jordan", inputMuted: true, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "CA" },
|
||||
{ id: 105, channel: 3, name: "Riley", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: true, awayMessage: "brb, grabbing coffee", isChannelCommander: false, country: "DE" },
|
||||
{ id: 102, channel: 1, name: "Alex", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: true, country: "US", uid: "demo-uid-alex" },
|
||||
{ id: 103, channel: 2, name: "Sam", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "GB", uid: "demo-uid-sam" },
|
||||
{ id: 104, channel: 2, name: "Jordan", inputMuted: true, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "CA", uid: "demo-uid-jordan" },
|
||||
{ id: 105, channel: 3, name: "Riley", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: true, awayMessage: "brb, grabbing coffee", isChannelCommander: false, country: "DE", uid: "demo-uid-riley" },
|
||||
];
|
||||
|
||||
const SELF_ID = 101;
|
||||
@@ -166,6 +167,40 @@ export class DemoSocket {
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "getClientConnectionInfo": {
|
||||
this.after(400, () =>
|
||||
this.emit({
|
||||
type: "clientConnectionInfo",
|
||||
clientId: msg.clientId,
|
||||
pingMs: 12.4,
|
||||
connectedSecs: 217,
|
||||
ip: msg.clientId === SELF_ID ? "127.0.0.1" : null,
|
||||
packetsSent: 4213,
|
||||
bytesSent: 512_340,
|
||||
packetsReceived: 3987,
|
||||
bytesReceived: 498_120,
|
||||
packetLossPercent: 0,
|
||||
})
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "getServerConnectionInfo": {
|
||||
this.after(400, () =>
|
||||
this.emit({
|
||||
type: "serverConnectionInfo",
|
||||
pingMs: 8.1,
|
||||
connectedSecs: 217,
|
||||
packetLossPercent: 0,
|
||||
packetsSentTotal: 21_004,
|
||||
bytesSentTotal: 2_411_000,
|
||||
packetsReceivedTotal: 19_872,
|
||||
bytesReceivedTotal: 2_198_500,
|
||||
bandwidthSentLastSecond: 4200,
|
||||
bandwidthReceivedLastSecond: 3900,
|
||||
})
|
||||
);
|
||||
break;
|
||||
}
|
||||
// "disconnect" is intentionally unhandled here: handleDisconnect() in
|
||||
// App.tsx always calls socket.close() right after sending it, and
|
||||
// close() already emits the "disconnected" event below.
|
||||
@@ -220,6 +255,7 @@ export class DemoSocket {
|
||||
awayMessage: "",
|
||||
isChannelCommander: false,
|
||||
country: "",
|
||||
uid: "demo-uid-self",
|
||||
};
|
||||
this.emit({ type: "channels", channels: DEMO_CHANNELS, clients: [self, ...DEMO_NPCS] });
|
||||
}
|
||||
|
||||
+194
-4
@@ -25,9 +25,7 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"menu.extras.identities": "Identitäten",
|
||||
"menu.extras.contacts": "Kontakte",
|
||||
"menu.extras.collectedUrls": "Gesammelte URLs",
|
||||
"menu.extras.fileTransfers": "Dateitransfers",
|
||||
"menu.extras.inviteFriend": "Freund einladen",
|
||||
"menu.extras.offlineMessages": "Offline Nachrichten",
|
||||
"menu.extras.whisperLists": "Whisperlisten",
|
||||
"menu.extras.whisperHistory": "Whisper Verlauf",
|
||||
"menu.extras.clientLog": "Client Protokoll",
|
||||
@@ -80,6 +78,102 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"connect.newTab": "In neuem Tab",
|
||||
"connect.cancel": "Abbrechen",
|
||||
|
||||
"collectedUrls.title": "Gesammelte URLs",
|
||||
"collectedUrls.search": "Suchen:",
|
||||
"collectedUrls.url": "URL",
|
||||
"collectedUrls.count": "Anzahl",
|
||||
"collectedUrls.lastSeen": "Zuletzt erwähnt",
|
||||
"collectedUrls.mentionedBy": "Erwähnt von",
|
||||
"collectedUrls.clearList": "Liste löschen",
|
||||
|
||||
"inviteFriend.title": "Freund einladen",
|
||||
"inviteFriend.type": "Art der Einladung",
|
||||
"inviteFriend.includeChannel": "Aktuellen Channel einfügen",
|
||||
"inviteFriend.link": "Link",
|
||||
"inviteFriend.addPermissionKey": "Berechtigungsschlüssel hinzufügen",
|
||||
"inviteFriend.copyToClipboard": "In Zwischenablage kopieren",
|
||||
"inviteFriend.copied": "Kopiert!",
|
||||
|
||||
"clientLog.title": "Client Protokoll",
|
||||
"clientLog.level.critical": "Kritisch",
|
||||
"clientLog.level.error": "Fehler",
|
||||
"clientLog.level.warning": "Warnungen",
|
||||
"clientLog.level.info": "Info",
|
||||
"clientLog.level.debug": "Debug",
|
||||
"clientLog.search": "Suchen:",
|
||||
"clientLog.filter": "Filter:",
|
||||
"clientLog.caseSensitive": "Groß-/Kleinschreibung",
|
||||
"clientLog.mark": "Markieren",
|
||||
|
||||
"whisperHistory.title": "Whisper Verlauf - {server}",
|
||||
"whisperHistory.empty": "Kein Whisper-Verlauf vorhanden.",
|
||||
"whisperHistory.started": "Whispern an: {targets}",
|
||||
"whisperHistory.stopped": "Whispern beendet",
|
||||
"whisperHistory.clear": "Löschen",
|
||||
"whisperHistory.options": "Optionen",
|
||||
|
||||
"whisperLists.title": "Whisperlisten",
|
||||
"whisperLists.namePlaceholder": "Name der Liste",
|
||||
"whisperLists.saveCurrent": "Aktuelle Auswahl speichern",
|
||||
"whisperLists.itemDetail": "{channels} Channel, {clients} Clients",
|
||||
"whisperLists.activate": "Aktivieren",
|
||||
"whisperLists.delete": "Löschen",
|
||||
"whisperLists.empty": "Keine Whisperlisten gespeichert. Wähle Whisper-Ziele aus und speichere sie hier als Liste.",
|
||||
|
||||
"identities.title": "Identitäten",
|
||||
"identities.activate": "Aktivieren",
|
||||
"identities.add": "Neue Identität",
|
||||
"identities.delete": "Löschen",
|
||||
"identities.newName": "Neue Identität",
|
||||
"identities.generated": "Erstellt",
|
||||
"identities.pending": "Wird bei der nächsten Verbindung erstellt",
|
||||
|
||||
"connectionInfo.clientTitle": "Verbindungsinformationen - {name}",
|
||||
"connectionInfo.serverTitle": "Serververbindungsinformationen",
|
||||
"connectionInfo.loading": "Wird geladen…",
|
||||
"connectionInfo.unavailable": "Keine Antwort vom Server (fehlende Berechtigung?).",
|
||||
"connectionInfo.ping": "Ping:",
|
||||
"connectionInfo.connectedSince": "Verbunden seit:",
|
||||
"connectionInfo.ip": "IP-Adresse:",
|
||||
"connectionInfo.packetLoss": "Paketverlust:",
|
||||
"connectionInfo.packetsSent": "Pakete gesendet:",
|
||||
"connectionInfo.packetsReceived": "Pakete empfangen:",
|
||||
"connectionInfo.bytesSent": "Daten gesendet:",
|
||||
"connectionInfo.bytesReceived": "Daten empfangen:",
|
||||
"connectionInfo.bandwidthSent": "Bandbreite gesendet:",
|
||||
"connectionInfo.bandwidthReceived": "Bandbreite empfangen:",
|
||||
|
||||
"menu.self.recordingProfile": "Aufnahmeprofil",
|
||||
"menu.self.playbackProfile": "Wiedergabeprofil",
|
||||
"menu.self.hotkeyProfile": "Hotkeyprofil",
|
||||
"menu.self.soundPack": "Sound Pack",
|
||||
"menu.self.setAway": "Abwesend setzen",
|
||||
"menu.self.enableMic": "Mikrofon aktivieren",
|
||||
"menu.self.disableMic": "Mikrofon ausschalten",
|
||||
"menu.self.muteOutput": "Lautsprecher/Kopfhörer ausschalten",
|
||||
"menu.self.unmuteOutput": "Lautsprecher/Kopfhörer einschalten",
|
||||
"menu.self.changeNickname": "Nickname ändern",
|
||||
"menu.self.requestTalkPower": "Talk Power anfordern",
|
||||
"menu.self.setAvatar": "Avatar setzen",
|
||||
"menu.self.setPhoneticNickname": "Phonetischen Nicknamen setzen",
|
||||
"menu.self.connectionInfo": "Verbindungsinformationen",
|
||||
|
||||
"contacts.title": "Kontakte",
|
||||
"contacts.addOnlineClient": "Online-Client auswählen...",
|
||||
"contacts.add": "Hinzufügen",
|
||||
"contacts.remove": "Entfernen",
|
||||
"contacts.empty": "Noch keine Kontakte.",
|
||||
"contacts.customName": "Benutzerdefinierter Name:",
|
||||
"contacts.category.acquaintance": "Bekannter",
|
||||
"contacts.category.blocked": "Blockiert",
|
||||
"contacts.category.friend": "Freund",
|
||||
"contacts.phoneticName": "Phonetischer Name:",
|
||||
"contacts.show": "Anzeige",
|
||||
"contacts.ignore": "Ignorieren",
|
||||
"contacts.unignore": "Nicht mehr ignorieren",
|
||||
"contacts.whisper": "Whispern",
|
||||
"contacts.preferences": "Voreinstellungen",
|
||||
|
||||
"favorites.title": "🔖 myTeamSpeak Favoriten",
|
||||
"favorites.synced": "Synchronisierte Favoriten",
|
||||
"favorites.notLoggedIn": "Nicht angemeldet",
|
||||
@@ -212,6 +306,7 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"clientContext.privateChat": "Privater Chat",
|
||||
"clientContext.poke": "Anstupsen",
|
||||
"clientContext.copyName": "Namen kopieren",
|
||||
"clientContext.connectionInfo": "Verbindungsinformationen anzeigen",
|
||||
"clientContext.addWhisperTarget": "Als Whisper-Ziel hinzufügen",
|
||||
"clientContext.removeWhisperTarget": "Als Whisper-Ziel entfernen",
|
||||
"clientContext.assignChannelGroup": "Channel-Gruppe zuweisen",
|
||||
@@ -269,9 +364,7 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"menu.extras.identities": "Identities",
|
||||
"menu.extras.contacts": "Contacts",
|
||||
"menu.extras.collectedUrls": "Collected URLs",
|
||||
"menu.extras.fileTransfers": "File Transfers",
|
||||
"menu.extras.inviteFriend": "Invite a friend",
|
||||
"menu.extras.offlineMessages": "Offline Messages",
|
||||
"menu.extras.whisperLists": "Whisper Lists",
|
||||
"menu.extras.whisperHistory": "Whisper History",
|
||||
"menu.extras.clientLog": "Client Log",
|
||||
@@ -324,6 +417,102 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"connect.newTab": "In new tab",
|
||||
"connect.cancel": "Cancel",
|
||||
|
||||
"collectedUrls.title": "Collected URLs",
|
||||
"collectedUrls.search": "Search:",
|
||||
"collectedUrls.url": "URL",
|
||||
"collectedUrls.count": "Count",
|
||||
"collectedUrls.lastSeen": "Last mentioned",
|
||||
"collectedUrls.mentionedBy": "Mentioned by",
|
||||
"collectedUrls.clearList": "Clear list",
|
||||
|
||||
"inviteFriend.title": "Invite a friend",
|
||||
"inviteFriend.type": "Invitation type",
|
||||
"inviteFriend.includeChannel": "Insert current channel",
|
||||
"inviteFriend.link": "Link",
|
||||
"inviteFriend.addPermissionKey": "Add permission key",
|
||||
"inviteFriend.copyToClipboard": "Copy to clipboard",
|
||||
"inviteFriend.copied": "Copied!",
|
||||
|
||||
"clientLog.title": "Client Log",
|
||||
"clientLog.level.critical": "Critical",
|
||||
"clientLog.level.error": "Errors",
|
||||
"clientLog.level.warning": "Warnings",
|
||||
"clientLog.level.info": "Info",
|
||||
"clientLog.level.debug": "Debug",
|
||||
"clientLog.search": "Search:",
|
||||
"clientLog.filter": "Filter:",
|
||||
"clientLog.caseSensitive": "Case sensitive",
|
||||
"clientLog.mark": "Mark",
|
||||
|
||||
"whisperHistory.title": "Whisper History - {server}",
|
||||
"whisperHistory.empty": "No whisper history yet.",
|
||||
"whisperHistory.started": "Whispering to: {targets}",
|
||||
"whisperHistory.stopped": "Stopped whispering",
|
||||
"whisperHistory.clear": "Clear",
|
||||
"whisperHistory.options": "Options",
|
||||
|
||||
"whisperLists.title": "Whisper Lists",
|
||||
"whisperLists.namePlaceholder": "List name",
|
||||
"whisperLists.saveCurrent": "Save current selection",
|
||||
"whisperLists.itemDetail": "{channels} channels, {clients} clients",
|
||||
"whisperLists.activate": "Activate",
|
||||
"whisperLists.delete": "Delete",
|
||||
"whisperLists.empty": "No whisper lists saved yet. Select whisper targets and save them here as a list.",
|
||||
|
||||
"identities.title": "Identities",
|
||||
"identities.activate": "Activate",
|
||||
"identities.add": "New Identity",
|
||||
"identities.delete": "Delete",
|
||||
"identities.newName": "New Identity",
|
||||
"identities.generated": "Generated",
|
||||
"identities.pending": "Will be generated on next connection",
|
||||
|
||||
"connectionInfo.clientTitle": "Connection Info - {name}",
|
||||
"connectionInfo.serverTitle": "Server Connection Info",
|
||||
"connectionInfo.loading": "Loading…",
|
||||
"connectionInfo.unavailable": "No response from the server (missing permission?).",
|
||||
"connectionInfo.ping": "Ping:",
|
||||
"connectionInfo.connectedSince": "Connected since:",
|
||||
"connectionInfo.ip": "IP address:",
|
||||
"connectionInfo.packetLoss": "Packet loss:",
|
||||
"connectionInfo.packetsSent": "Packets sent:",
|
||||
"connectionInfo.packetsReceived": "Packets received:",
|
||||
"connectionInfo.bytesSent": "Data sent:",
|
||||
"connectionInfo.bytesReceived": "Data received:",
|
||||
"connectionInfo.bandwidthSent": "Bandwidth sent:",
|
||||
"connectionInfo.bandwidthReceived": "Bandwidth received:",
|
||||
|
||||
"menu.self.recordingProfile": "Recording Profile",
|
||||
"menu.self.playbackProfile": "Playback Profile",
|
||||
"menu.self.hotkeyProfile": "Hotkey Profile",
|
||||
"menu.self.soundPack": "Sound Pack",
|
||||
"menu.self.setAway": "Set Away",
|
||||
"menu.self.enableMic": "Enable Microphone",
|
||||
"menu.self.disableMic": "Disable Microphone",
|
||||
"menu.self.muteOutput": "Mute Speakers/Headphones",
|
||||
"menu.self.unmuteOutput": "Unmute Speakers/Headphones",
|
||||
"menu.self.changeNickname": "Change Nickname",
|
||||
"menu.self.requestTalkPower": "Request Talk Power",
|
||||
"menu.self.setAvatar": "Set Avatar",
|
||||
"menu.self.setPhoneticNickname": "Set Phonetic Nickname",
|
||||
"menu.self.connectionInfo": "Connection Info",
|
||||
|
||||
"contacts.title": "Contacts",
|
||||
"contacts.addOnlineClient": "Select an online client...",
|
||||
"contacts.add": "Add",
|
||||
"contacts.remove": "Remove",
|
||||
"contacts.empty": "No contacts yet.",
|
||||
"contacts.customName": "Custom Name:",
|
||||
"contacts.category.acquaintance": "Acquaintance",
|
||||
"contacts.category.blocked": "Blocked",
|
||||
"contacts.category.friend": "Friend",
|
||||
"contacts.phoneticName": "Phonetic Name:",
|
||||
"contacts.show": "Show",
|
||||
"contacts.ignore": "Ignore",
|
||||
"contacts.unignore": "Unignore",
|
||||
"contacts.whisper": "Whisper",
|
||||
"contacts.preferences": "Preferences",
|
||||
|
||||
"favorites.title": "🔖 myTeamSpeak Bookmarks",
|
||||
"favorites.synced": "Synced Bookmarks",
|
||||
"favorites.notLoggedIn": "Not logged in",
|
||||
@@ -456,6 +645,7 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"clientContext.privateChat": "Private chat",
|
||||
"clientContext.poke": "Poke",
|
||||
"clientContext.copyName": "Copy name",
|
||||
"clientContext.connectionInfo": "Show connection info",
|
||||
"clientContext.addWhisperTarget": "Add as whisper target",
|
||||
"clientContext.removeWhisperTarget": "Remove as whisper target",
|
||||
"clientContext.assignChannelGroup": "Assign channel group",
|
||||
|
||||
@@ -134,6 +134,11 @@ export class MicCapture {
|
||||
this.silence.connect(this.context.destination);
|
||||
}
|
||||
|
||||
/** The raw mic input node, e.g. to additionally route it into a recorder. */
|
||||
getSourceNode(): AudioNode | null {
|
||||
return this.source;
|
||||
}
|
||||
|
||||
/** Routes the raw mic signal to `destination` too, so you can hear yourself (a mic test), until disabled again. */
|
||||
setMonitoring(enabled: boolean, destination: AudioNode): void {
|
||||
if (!this.source) return;
|
||||
@@ -166,6 +171,45 @@ export class MicCapture {
|
||||
}
|
||||
}
|
||||
|
||||
function writeAsciiString(view: DataView, offset: number, text: string): void {
|
||||
for (let i = 0; i < text.length; i++) view.setUint8(offset + i, text.charCodeAt(i));
|
||||
}
|
||||
|
||||
/** Encodes raw stereo float samples (range -1..1) as an uncompressed 16-bit PCM WAV file. */
|
||||
export function encodeWavStereo(left: Float32Array, right: Float32Array, sampleRate: number): Blob {
|
||||
const numChannels = 2;
|
||||
const bytesPerSample = 2;
|
||||
const blockAlign = numChannels * bytesPerSample;
|
||||
const dataSize = left.length * blockAlign;
|
||||
const buffer = new ArrayBuffer(44 + dataSize);
|
||||
const view = new DataView(buffer);
|
||||
|
||||
writeAsciiString(view, 0, "RIFF");
|
||||
view.setUint32(4, 36 + dataSize, true);
|
||||
writeAsciiString(view, 8, "WAVE");
|
||||
writeAsciiString(view, 12, "fmt ");
|
||||
view.setUint32(16, 16, true);
|
||||
view.setUint16(20, 1, true); // PCM
|
||||
view.setUint16(22, numChannels, true);
|
||||
view.setUint32(24, sampleRate, true);
|
||||
view.setUint32(28, sampleRate * blockAlign, true);
|
||||
view.setUint16(32, blockAlign, true);
|
||||
view.setUint16(34, 16, true);
|
||||
writeAsciiString(view, 36, "data");
|
||||
view.setUint32(40, dataSize, true);
|
||||
|
||||
let offset = 44;
|
||||
for (let i = 0; i < left.length; i++) {
|
||||
const l = Math.max(-1, Math.min(1, left[i]));
|
||||
const r = Math.max(-1, Math.min(1, right[i]));
|
||||
view.setInt16(offset, l < 0 ? l * 0x8000 : l * 0x7fff, true);
|
||||
view.setInt16(offset + 2, r < 0 ? r * 0x8000 : r * 0x7fff, true);
|
||||
offset += blockAlign;
|
||||
}
|
||||
|
||||
return new Blob([buffer], { type: "audio/wav" });
|
||||
}
|
||||
|
||||
/** Output ("audiooutput") devices available for playback, e.g. for a device picker. */
|
||||
export async function listAudioOutputDevices(): Promise<MediaDeviceInfo[]> {
|
||||
if (!navigator.mediaDevices) return [];
|
||||
|
||||
Reference in new issue
Block a user