mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-02 17:32:50 +08:00
Add "Virtuellen Server editieren" dialog
Wires up tsclientlib's typed Server::edit() builder (name, welcome message, password, host message/banner/button settings, nickname, phonetic name, codec encryption mode) through a new "serveredit" stdin command. Frontend dialog has Host and Verschiedenes tabs fully implemented, with Übertragung/Anti-Flood/Sicherheit/Protokoll shown as not-yet-implemented placeholders (their fields have no typed setter in tsclientlib's generated bindings, would need hand-built raw commands). Entry point is a new link in the server info panel, next to the connection-info one added earlier. Every field is optional in the payload - blank means "leave unchanged" - except the password field, which has an explicit "remove password" checkbox for the clear case. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
330ecccadb
commit
181b0fc43b
7 files changed
+493
-3
No files matched your search
Generated
+1
@@ -2641,6 +2641,7 @@ dependencies = [
|
||||
"futures",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"time",
|
||||
"tokio",
|
||||
"tracing-subscriber",
|
||||
"tsclientlib",
|
||||
|
||||
@@ -15,3 +15,4 @@ clap = { version = "4", features = ["derive"] }
|
||||
anyhow = "1"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
base64 = "0.22"
|
||||
time = "0.3"
|
||||
+129
-3
@@ -7,7 +7,7 @@ use audiopus::coder::Encoder as OpusEncoder;
|
||||
use base64::Engine;
|
||||
use clap::Parser;
|
||||
use futures::prelude::*;
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::io::{AsyncBufReadExt, BufReader};
|
||||
|
||||
use tsclientlib::audio::AudioHandler;
|
||||
@@ -15,8 +15,9 @@ use tsclientlib::events::{Event as BookEvent, PropertyId, PropertyValue};
|
||||
use tsclientlib::messages::c2s::{OutClientPokeRequestPart, OutSendTextMessagePart};
|
||||
use tsclientlib::prelude::*;
|
||||
use tsclientlib::{
|
||||
data, ChannelId, ClientId, Connection, DisconnectOptions, Identity, MaxClients, MessageHandle,
|
||||
MessageTarget, Reason, StreamItem, TextMessageTargetMode,
|
||||
data, ChannelId, ClientId, CodecEncryptionMode, Connection, DisconnectOptions, HostBannerMode,
|
||||
HostMessageMode, Identity, MaxClients, MessageHandle, MessageTarget, Reason, StreamItem,
|
||||
TextMessageTargetMode,
|
||||
};
|
||||
use tsproto_packets::packets::{AudioData, CodecType, Direction, Flags, OutAudio, OutCommand, PacketType};
|
||||
|
||||
@@ -78,6 +79,64 @@ struct ClientInfo {
|
||||
uid: String,
|
||||
}
|
||||
|
||||
/// Payload for the "serveredit " stdin command - every field is optional so
|
||||
/// the frontend only needs to send what actually changed. Covers the fields
|
||||
/// tsclientlib's `Server::edit()` builder exposes named setters for; a few
|
||||
/// exotic ones (antiflood tuning, quotas, log toggles) have no typed setter
|
||||
/// upstream and aren't included here.
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct ServerEditPayload {
|
||||
name: Option<String>,
|
||||
welcome_message: Option<String>,
|
||||
/// `Some("")` clears the password; `None` leaves it unchanged.
|
||||
password: Option<String>,
|
||||
max_clients: Option<u16>,
|
||||
hostmessage: Option<String>,
|
||||
/// "none" | "log" | "modal" | "modalquit"
|
||||
hostmessage_mode: Option<String>,
|
||||
hostbanner_url: Option<String>,
|
||||
hostbanner_gfx_url: Option<String>,
|
||||
hostbanner_gfx_interval_secs: Option<i64>,
|
||||
/// "noadjust" | "adjustignoreaspect" | "adjustkeepaspect"
|
||||
hostbanner_mode: Option<String>,
|
||||
hostbutton_tooltip: Option<String>,
|
||||
hostbutton_url: Option<String>,
|
||||
hostbutton_gfx_url: Option<String>,
|
||||
nickname: Option<String>,
|
||||
phonetic_name: Option<String>,
|
||||
/// "perchannel" | "forcedoff" | "forcedon"
|
||||
codec_encryption_mode: Option<String>,
|
||||
}
|
||||
|
||||
fn parse_host_message_mode(s: &str) -> Option<HostMessageMode> {
|
||||
match s.to_ascii_lowercase().as_str() {
|
||||
"none" => Some(HostMessageMode::None),
|
||||
"log" => Some(HostMessageMode::Log),
|
||||
"modal" => Some(HostMessageMode::Modal),
|
||||
"modalquit" => Some(HostMessageMode::Modalquit),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_host_banner_mode(s: &str) -> Option<HostBannerMode> {
|
||||
match s.to_ascii_lowercase().as_str() {
|
||||
"noadjust" => Some(HostBannerMode::NoAdjust),
|
||||
"adjustignoreaspect" => Some(HostBannerMode::AdjustIgnoreAspect),
|
||||
"adjustkeepaspect" => Some(HostBannerMode::AdjustKeepAspect),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_codec_encryption_mode(s: &str) -> Option<CodecEncryptionMode> {
|
||||
match s.to_ascii_lowercase().as_str() {
|
||||
"perchannel" => Some(CodecEncryptionMode::PerChannel),
|
||||
"forcedoff" => Some(CodecEncryptionMode::ForcedOff),
|
||||
"forcedon" => Some(CodecEncryptionMode::ForcedOn),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Human-facing entries for the Server tab's log-style notifications
|
||||
/// (client join/leave/switch, channel group assignment, channel/server
|
||||
/// changes, own permission errors) - mirrors what the native TS3 client
|
||||
@@ -741,6 +800,73 @@ async fn run(args: Args) -> Result<()> {
|
||||
}
|
||||
Err(_) => emit(&Event::Error { message: format!("Invalid client id: {id_str}") }),
|
||||
}
|
||||
} else if let Some(rest) = l.strip_prefix("serveredit ") {
|
||||
match serde_json::from_str::<ServerEditPayload>(rest) {
|
||||
Ok(payload) => {
|
||||
let mut part = con.get_state()?.server.edit();
|
||||
if let Some(v) = &payload.name {
|
||||
part = part.set_name(v);
|
||||
}
|
||||
if let Some(v) = &payload.welcome_message {
|
||||
part = part.set_welcome_message(v);
|
||||
}
|
||||
if let Some(v) = &payload.password {
|
||||
part = part.set_password(if v.is_empty() { None } else { Some(v) });
|
||||
}
|
||||
if let Some(v) = payload.max_clients {
|
||||
part = part.set_max_clients(v);
|
||||
}
|
||||
if let Some(v) = &payload.hostmessage {
|
||||
part = part.set_hostmessage(v);
|
||||
}
|
||||
if let Some(mode) =
|
||||
payload.hostmessage_mode.as_deref().and_then(parse_host_message_mode)
|
||||
{
|
||||
part = part.set_hostmessage_mode(mode);
|
||||
}
|
||||
if let Some(v) = &payload.hostbanner_url {
|
||||
part = part.set_hostbanner_url(v);
|
||||
}
|
||||
if let Some(v) = &payload.hostbanner_gfx_url {
|
||||
part = part.set_hostbanner_gfx_url(v);
|
||||
}
|
||||
if let Some(secs) = payload.hostbanner_gfx_interval_secs {
|
||||
part = part.set_hostbanner_gfx_interval(time::Duration::seconds(secs));
|
||||
}
|
||||
if let Some(mode) =
|
||||
payload.hostbanner_mode.as_deref().and_then(parse_host_banner_mode)
|
||||
{
|
||||
part = part.set_hostbanner_mode(mode);
|
||||
}
|
||||
if let Some(v) = &payload.hostbutton_tooltip {
|
||||
part = part.set_hostbutton_tooltip(v);
|
||||
}
|
||||
if let Some(v) = &payload.hostbutton_url {
|
||||
part = part.set_hostbutton_url(v);
|
||||
}
|
||||
if let Some(v) = &payload.hostbutton_gfx_url {
|
||||
part = part.set_hostbutton_gfx_url(v);
|
||||
}
|
||||
if let Some(v) = &payload.nickname {
|
||||
part = part.set_nickname(v);
|
||||
}
|
||||
if let Some(v) = &payload.phonetic_name {
|
||||
part = part.set_phonetic_name(v);
|
||||
}
|
||||
if let Some(mode) =
|
||||
payload.codec_encryption_mode.as_deref().and_then(parse_codec_encryption_mode)
|
||||
{
|
||||
part = part.set_codec_encryption_mode(mode);
|
||||
}
|
||||
match part.send_with_result(&mut con) {
|
||||
Ok(handle) => {
|
||||
pending_messages.insert(handle, "Server edit".into());
|
||||
}
|
||||
Err(e) => emit(&Event::Error { message: e.to_string() }),
|
||||
}
|
||||
}
|
||||
Err(e) => emit(&Event::Error { message: format!("Invalid server edit payload: {e}") }),
|
||||
}
|
||||
} else if l == "serverconninfo" {
|
||||
let part = con.get_state()?.server.connection_info();
|
||||
match part.send_with_result(&mut con) {
|
||||
|
||||
@@ -142,6 +142,10 @@ wss.on("connection", (socket: WebSocket) => {
|
||||
await connection?.banClient(msg.clientId, msg.seconds ?? 0, msg.reason ?? "");
|
||||
break;
|
||||
}
|
||||
case "editServer": {
|
||||
await connection?.editServer(msg.payload ?? {});
|
||||
break;
|
||||
}
|
||||
case "disconnect": {
|
||||
await connection?.disconnect(msg.message ?? "");
|
||||
break;
|
||||
|
||||
@@ -327,6 +327,30 @@ export class Ts3Connection {
|
||||
this.child?.stdin.write(`banclient ${clientId} ${Math.max(0, Math.floor(seconds))} ${sanitized}\n`);
|
||||
}
|
||||
|
||||
/** Every field is optional - only send what actually changed. JSON.stringify
|
||||
* already escapes embedded newlines, so this is safe as a single stdin line
|
||||
* without extra sanitization. */
|
||||
async editServer(payload: {
|
||||
name?: string;
|
||||
welcomeMessage?: string;
|
||||
password?: string;
|
||||
maxClients?: number;
|
||||
hostmessage?: string;
|
||||
hostmessageMode?: string;
|
||||
hostbannerUrl?: string;
|
||||
hostbannerGfxUrl?: string;
|
||||
hostbannerGfxIntervalSecs?: number;
|
||||
hostbannerMode?: string;
|
||||
hostbuttonTooltip?: string;
|
||||
hostbuttonUrl?: string;
|
||||
hostbuttonGfxUrl?: string;
|
||||
nickname?: string;
|
||||
phoneticName?: string;
|
||||
codecEncryptionMode?: string;
|
||||
}): Promise<void> {
|
||||
this.child?.stdin.write(`serveredit ${JSON.stringify(payload)}\n`);
|
||||
}
|
||||
|
||||
async sendChatMessage(message: string): Promise<void> {
|
||||
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
|
||||
if (sanitized) this.child?.stdin.write(`chat ${sanitized}\n`);
|
||||
|
||||
+258
@@ -492,6 +492,7 @@ function InfoPanel({
|
||||
channels,
|
||||
clients,
|
||||
onShowServerConnectionInfo,
|
||||
onEditServer,
|
||||
}: {
|
||||
selected: SelectedItem | null;
|
||||
host: string;
|
||||
@@ -503,6 +504,7 @@ function InfoPanel({
|
||||
channels: ChannelInfo[];
|
||||
clients: ClientInfo[];
|
||||
onShowServerConnectionInfo: () => void;
|
||||
onEditServer: () => void;
|
||||
}) {
|
||||
const t = useT();
|
||||
if (!selected || selected.type === "server") {
|
||||
@@ -534,6 +536,9 @@ function InfoPanel({
|
||||
<button className="ts-info-connection-link" onClick={onShowServerConnectionInfo}>
|
||||
🔌 {t("connectionInfo.serverTitle")}
|
||||
</button>
|
||||
<button className="ts-info-connection-link" onClick={onEditServer}>
|
||||
✏️ {t("serverEdit.title")}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -2354,6 +2359,242 @@ function OptionsDialog({
|
||||
);
|
||||
}
|
||||
|
||||
const SERVER_EDIT_TABS = ["host", "misc", "transmission", "antiflood", "security", "log"] as const;
|
||||
|
||||
interface ServerEditPayload {
|
||||
name?: string;
|
||||
welcomeMessage?: string;
|
||||
password?: string;
|
||||
maxClients?: number;
|
||||
hostmessage?: string;
|
||||
hostmessageMode?: string;
|
||||
hostbannerUrl?: string;
|
||||
hostbannerGfxUrl?: string;
|
||||
hostbannerGfxIntervalSecs?: number;
|
||||
hostbannerMode?: string;
|
||||
hostbuttonTooltip?: string;
|
||||
hostbuttonUrl?: string;
|
||||
hostbuttonGfxUrl?: string;
|
||||
nickname?: string;
|
||||
phoneticName?: string;
|
||||
codecEncryptionMode?: string;
|
||||
}
|
||||
|
||||
function ServerEditDialog({
|
||||
serverName,
|
||||
welcomeMessage,
|
||||
hostbannerGfxUrl,
|
||||
onSave,
|
||||
onClose,
|
||||
}: {
|
||||
serverName: string;
|
||||
welcomeMessage: string;
|
||||
hostbannerGfxUrl: string;
|
||||
onSave: (payload: ServerEditPayload) => void;
|
||||
onClose: () => void;
|
||||
}) {
|
||||
const t = useT();
|
||||
const backdrop = useBackdropDismiss(onClose);
|
||||
const [tab, setTab] = useState<(typeof SERVER_EDIT_TABS)[number]>("host");
|
||||
|
||||
const [name, setName] = useState(serverName);
|
||||
const [welcome, setWelcome] = useState(welcomeMessage);
|
||||
const [clearPassword, setClearPassword] = useState(false);
|
||||
const [password, setPassword] = useState("");
|
||||
const [hostmessage, setHostmessage] = useState("");
|
||||
const [hostmessageMode, setHostmessageMode] = useState("");
|
||||
const [hostbannerUrl, setHostbannerUrl] = useState("");
|
||||
const [bannerGfxUrl, setBannerGfxUrl] = useState(hostbannerGfxUrl);
|
||||
const [hostbannerGfxInterval, setHostbannerGfxInterval] = useState("");
|
||||
const [hostbannerMode, setHostbannerMode] = useState("");
|
||||
const [hostbuttonTooltip, setHostbuttonTooltip] = useState("");
|
||||
const [hostbuttonUrl, setHostbuttonUrl] = useState("");
|
||||
const [hostbuttonGfxUrl, setHostbuttonGfxUrl] = useState("");
|
||||
const [maxClients, setMaxClients] = useState("");
|
||||
const [nickname, setNickname] = useState("");
|
||||
const [phoneticName, setPhoneticName] = useState("");
|
||||
const [codecEncryptionMode, setCodecEncryptionMode] = useState("");
|
||||
|
||||
const handleSave = () => {
|
||||
const payload: ServerEditPayload = {};
|
||||
if (name.trim() && name !== serverName) payload.name = name.trim();
|
||||
if (welcome !== welcomeMessage) payload.welcomeMessage = welcome;
|
||||
if (clearPassword) payload.password = "";
|
||||
else if (password) payload.password = password;
|
||||
if (hostmessage) payload.hostmessage = hostmessage;
|
||||
if (hostmessageMode) payload.hostmessageMode = hostmessageMode;
|
||||
if (hostbannerUrl) payload.hostbannerUrl = hostbannerUrl;
|
||||
if (bannerGfxUrl !== hostbannerGfxUrl) payload.hostbannerGfxUrl = bannerGfxUrl;
|
||||
if (hostbannerGfxInterval) payload.hostbannerGfxIntervalSecs = Number(hostbannerGfxInterval) || 0;
|
||||
if (hostbannerMode) payload.hostbannerMode = hostbannerMode;
|
||||
if (hostbuttonTooltip) payload.hostbuttonTooltip = hostbuttonTooltip;
|
||||
if (hostbuttonUrl) payload.hostbuttonUrl = hostbuttonUrl;
|
||||
if (hostbuttonGfxUrl) payload.hostbuttonGfxUrl = hostbuttonGfxUrl;
|
||||
if (maxClients) payload.maxClients = Number(maxClients) || 0;
|
||||
if (nickname) payload.nickname = nickname;
|
||||
if (phoneticName) payload.phoneticName = phoneticName;
|
||||
if (codecEncryptionMode) payload.codecEncryptionMode = codecEncryptionMode;
|
||||
onSave(payload);
|
||||
onClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="ts-dialog-backdrop" {...backdrop}>
|
||||
<div className="ts-dialog ts-options-dialog" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="ts-dialog-titlebar">
|
||||
<span>{t("serverEdit.title")}</span>
|
||||
<button onClick={onClose} title={t("dialog.close")}>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
<div className="ts-options-body">
|
||||
<div className="ts-options-sidebar">
|
||||
{SERVER_EDIT_TABS.map((id) => (
|
||||
<button
|
||||
key={id}
|
||||
className={`ts-options-sidebar-item${id === tab ? " ts-options-sidebar-item-active" : ""}`}
|
||||
onClick={() => setTab(id)}
|
||||
>
|
||||
<span>{t(`serverEdit.tab.${id}`)}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<div className="ts-options-content">
|
||||
{tab === "host" && (
|
||||
<>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.name")}
|
||||
<input value={name} onChange={(e) => setName(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.welcomeMessage")}
|
||||
<textarea rows={3} value={welcome} onChange={(e) => setWelcome(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
<span>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={clearPassword}
|
||||
onChange={(e) => setClearPassword(e.target.checked)}
|
||||
/>{" "}
|
||||
{t("serverEdit.clearPassword")}
|
||||
</span>
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.newPassword")}
|
||||
<input
|
||||
type="password"
|
||||
disabled={clearPassword}
|
||||
value={password}
|
||||
onChange={(e) => setPassword(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostmessage")}
|
||||
<input value={hostmessage} onChange={(e) => setHostmessage(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostmessageMode")}
|
||||
<select value={hostmessageMode} onChange={(e) => setHostmessageMode(e.target.value)}>
|
||||
<option value="">{t("serverEdit.unchanged")}</option>
|
||||
<option value="none">{t("serverEdit.hostmessageMode.none")}</option>
|
||||
<option value="log">{t("serverEdit.hostmessageMode.log")}</option>
|
||||
<option value="modal">{t("serverEdit.hostmessageMode.modal")}</option>
|
||||
<option value="modalquit">{t("serverEdit.hostmessageMode.modalquit")}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostbannerUrl")}
|
||||
<input value={hostbannerUrl} onChange={(e) => setHostbannerUrl(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostbannerGfxUrl")}
|
||||
<input value={bannerGfxUrl} onChange={(e) => setBannerGfxUrl(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostbannerGfxInterval")}
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
value={hostbannerGfxInterval}
|
||||
onChange={(e) => setHostbannerGfxInterval(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostbannerMode")}
|
||||
<select value={hostbannerMode} onChange={(e) => setHostbannerMode(e.target.value)}>
|
||||
<option value="">{t("serverEdit.unchanged")}</option>
|
||||
<option value="noadjust">{t("serverEdit.hostbannerMode.noadjust")}</option>
|
||||
<option value="adjustignoreaspect">{t("serverEdit.hostbannerMode.adjustignoreaspect")}</option>
|
||||
<option value="adjustkeepaspect">{t("serverEdit.hostbannerMode.adjustkeepaspect")}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostbuttonTooltip")}
|
||||
<input value={hostbuttonTooltip} onChange={(e) => setHostbuttonTooltip(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostbuttonUrl")}
|
||||
<input value={hostbuttonUrl} onChange={(e) => setHostbuttonUrl(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.hostbuttonGfxUrl")}
|
||||
<input value={hostbuttonGfxUrl} onChange={(e) => setHostbuttonGfxUrl(e.target.value)} />
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
{tab === "misc" && (
|
||||
<>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.maxClients")}
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
value={maxClients}
|
||||
onChange={(e) => setMaxClients(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.nickname")}
|
||||
<input value={nickname} onChange={(e) => setNickname(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.phoneticName")}
|
||||
<input value={phoneticName} onChange={(e) => setPhoneticName(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("serverEdit.codecEncryptionMode")}
|
||||
<select
|
||||
value={codecEncryptionMode}
|
||||
onChange={(e) => setCodecEncryptionMode(e.target.value)}
|
||||
>
|
||||
<option value="">{t("serverEdit.unchanged")}</option>
|
||||
<option value="perchannel">{t("serverEdit.codecEncryptionMode.perchannel")}</option>
|
||||
<option value="forcedoff">{t("serverEdit.codecEncryptionMode.forcedoff")}</option>
|
||||
<option value="forcedon">{t("serverEdit.codecEncryptionMode.forcedon")}</option>
|
||||
</select>
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
{(tab === "transmission" || tab === "antiflood" || tab === "security" || tab === "log") && (
|
||||
<>
|
||||
<h3>{t(`serverEdit.tab.${tab}`)}</h3>
|
||||
<p className="ts-options-placeholder">{t("options.notImplemented")}</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="ts-dialog-buttons">
|
||||
<div className="ts-dialog-buttons-right">
|
||||
<button onClick={handleSave}>{t("serverEdit.save")}</button>
|
||||
<button onClick={onClose}>{t("serverEdit.cancel")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AppInner() {
|
||||
const [host, setHost] = useState(() => localStorage.getItem(LAST_HOST_KEY) ?? (DEMO_MODE ? DEMO_HOST : "localhost"));
|
||||
const [nickname, setNickname] = useState(
|
||||
@@ -2375,6 +2616,8 @@ function AppInner() {
|
||||
const [serverVersion, setServerVersion] = useState("");
|
||||
const [serverLicense, setServerLicense] = useState("");
|
||||
const [serverBannerUrl, setServerBannerUrl] = useState("");
|
||||
const [serverWelcomeMessage, setServerWelcomeMessage] = useState("");
|
||||
const [serverEditOpen, setServerEditOpen] = useState(false);
|
||||
const [treeWidth, setTreeWidth] = useState(260);
|
||||
const [upperHeight, setUpperHeight] = useState(340);
|
||||
const [selected, setSelected] = useState<SelectedItem | null>(null);
|
||||
@@ -2768,6 +3011,7 @@ function AppInner() {
|
||||
setServerVersion(data.serverVersion);
|
||||
setServerLicense(data.serverLicense);
|
||||
setServerBannerUrl(data.serverBannerUrl);
|
||||
setServerWelcomeMessage(data.welcomeMessage);
|
||||
setSelected({ type: "server" });
|
||||
setServerChat((prev) => [...prev, { from: "Server", message: data.welcomeMessage }]);
|
||||
previousClientsRef.current = null;
|
||||
@@ -4204,6 +4448,19 @@ function AppInner() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{serverEditOpen && (
|
||||
<ServerEditDialog
|
||||
serverName={serverName}
|
||||
welcomeMessage={serverWelcomeMessage}
|
||||
hostbannerGfxUrl={serverBannerUrl}
|
||||
onSave={(payload) => {
|
||||
socketRef.current?.send(JSON.stringify({ type: "editServer", payload }));
|
||||
logClient("info", "Moderation", "Edited server settings");
|
||||
}}
|
||||
onClose={() => setServerEditOpen(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{contactsOpen && (
|
||||
<ContactsDialog
|
||||
contacts={contacts}
|
||||
@@ -4561,6 +4818,7 @@ function AppInner() {
|
||||
channels={channels}
|
||||
clients={clients}
|
||||
onShowServerConnectionInfo={handleShowServerConnectionInfo}
|
||||
onEditServer={() => setServerEditOpen(true)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -318,6 +318,44 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"ban.confirm": "Bannen",
|
||||
"ban.cancel": "Abbrechen",
|
||||
|
||||
"serverEdit.title": "Virtuellen Server editieren",
|
||||
"serverEdit.tab.host": "Host",
|
||||
"serverEdit.tab.misc": "Verschiedenes",
|
||||
"serverEdit.tab.transmission": "Übertragung",
|
||||
"serverEdit.tab.antiflood": "Anti-Flood",
|
||||
"serverEdit.tab.security": "Sicherheit",
|
||||
"serverEdit.tab.log": "Protokoll",
|
||||
"serverEdit.name": "Servername:",
|
||||
"serverEdit.welcomeMessage": "Willkommensnachricht:",
|
||||
"serverEdit.clearPassword": "Serverpasswort entfernen",
|
||||
"serverEdit.newPassword": "Neues Serverpasswort:",
|
||||
"serverEdit.hostmessage": "Hostnachricht:",
|
||||
"serverEdit.hostmessageMode": "Anzeigemodus:",
|
||||
"serverEdit.hostmessageMode.none": "Nicht anzeigen",
|
||||
"serverEdit.hostmessageMode.log": "Im Protokoll anzeigen",
|
||||
"serverEdit.hostmessageMode.modal": "Als Dialog anzeigen",
|
||||
"serverEdit.hostmessageMode.modalquit": "Als Dialog anzeigen und trennen",
|
||||
"serverEdit.hostbannerUrl": "Host-Banner URL:",
|
||||
"serverEdit.hostbannerGfxUrl": "Host-Banner Bild-URL:",
|
||||
"serverEdit.hostbannerGfxInterval": "Banner-Aktualisierung (Sekunden):",
|
||||
"serverEdit.hostbannerMode": "Banner-Anpassung:",
|
||||
"serverEdit.hostbannerMode.noadjust": "Nicht anpassen",
|
||||
"serverEdit.hostbannerMode.adjustignoreaspect": "Anpassen (Seitenverhältnis ignorieren)",
|
||||
"serverEdit.hostbannerMode.adjustkeepaspect": "Anpassen (Seitenverhältnis beibehalten)",
|
||||
"serverEdit.hostbuttonTooltip": "Host-Button Tooltip:",
|
||||
"serverEdit.hostbuttonUrl": "Host-Button URL:",
|
||||
"serverEdit.hostbuttonGfxUrl": "Host-Button Bild-URL:",
|
||||
"serverEdit.maxClients": "Maximale Clientanzahl:",
|
||||
"serverEdit.nickname": "Server-Nickname:",
|
||||
"serverEdit.phoneticName": "Phonetischer Name:",
|
||||
"serverEdit.codecEncryptionMode": "Sprachverschlüsselung:",
|
||||
"serverEdit.codecEncryptionMode.perchannel": "Pro Channel konfigurierbar",
|
||||
"serverEdit.codecEncryptionMode.forcedoff": "Global deaktiviert",
|
||||
"serverEdit.codecEncryptionMode.forcedon": "Global aktiviert",
|
||||
"serverEdit.unchanged": "Unverändert lassen",
|
||||
"serverEdit.save": "Speichern",
|
||||
"serverEdit.cancel": "Abbrechen",
|
||||
|
||||
"clientContext.privateChat": "Privater Chat",
|
||||
"clientContext.poke": "Anstupsen",
|
||||
"clientContext.copyName": "Namen kopieren",
|
||||
@@ -673,6 +711,44 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"ban.confirm": "Ban",
|
||||
"ban.cancel": "Cancel",
|
||||
|
||||
"serverEdit.title": "Edit Virtual Server",
|
||||
"serverEdit.tab.host": "Host",
|
||||
"serverEdit.tab.misc": "Misc",
|
||||
"serverEdit.tab.transmission": "Transmission",
|
||||
"serverEdit.tab.antiflood": "Anti-Flood",
|
||||
"serverEdit.tab.security": "Security",
|
||||
"serverEdit.tab.log": "Log",
|
||||
"serverEdit.name": "Server name:",
|
||||
"serverEdit.welcomeMessage": "Welcome message:",
|
||||
"serverEdit.clearPassword": "Remove server password",
|
||||
"serverEdit.newPassword": "New server password:",
|
||||
"serverEdit.hostmessage": "Host message:",
|
||||
"serverEdit.hostmessageMode": "Display mode:",
|
||||
"serverEdit.hostmessageMode.none": "Don't display",
|
||||
"serverEdit.hostmessageMode.log": "Display in log",
|
||||
"serverEdit.hostmessageMode.modal": "Display as dialog",
|
||||
"serverEdit.hostmessageMode.modalquit": "Display as dialog and disconnect",
|
||||
"serverEdit.hostbannerUrl": "Host banner URL:",
|
||||
"serverEdit.hostbannerGfxUrl": "Host banner image URL:",
|
||||
"serverEdit.hostbannerGfxInterval": "Banner refresh (seconds):",
|
||||
"serverEdit.hostbannerMode": "Banner scaling:",
|
||||
"serverEdit.hostbannerMode.noadjust": "Don't adjust",
|
||||
"serverEdit.hostbannerMode.adjustignoreaspect": "Adjust (ignore aspect ratio)",
|
||||
"serverEdit.hostbannerMode.adjustkeepaspect": "Adjust (keep aspect ratio)",
|
||||
"serverEdit.hostbuttonTooltip": "Host button tooltip:",
|
||||
"serverEdit.hostbuttonUrl": "Host button URL:",
|
||||
"serverEdit.hostbuttonGfxUrl": "Host button image URL:",
|
||||
"serverEdit.maxClients": "Max clients:",
|
||||
"serverEdit.nickname": "Server nickname:",
|
||||
"serverEdit.phoneticName": "Phonetic name:",
|
||||
"serverEdit.codecEncryptionMode": "Voice encryption:",
|
||||
"serverEdit.codecEncryptionMode.perchannel": "Configurable per channel",
|
||||
"serverEdit.codecEncryptionMode.forcedoff": "Globally disabled",
|
||||
"serverEdit.codecEncryptionMode.forcedon": "Globally enabled",
|
||||
"serverEdit.unchanged": "Leave unchanged",
|
||||
"serverEdit.save": "Save",
|
||||
"serverEdit.cancel": "Cancel",
|
||||
|
||||
"clientContext.privateChat": "Private chat",
|
||||
"clientContext.poke": "Poke",
|
||||
"clientContext.copyName": "Copy name",
|
||||
|
||||
Reference in new issue
Block a user