mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 09:52:50 +08:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
169d32a292 | ||
|
|
de94859a16 | ||
|
|
810d922b09 | ||
|
|
5e76bd3bdf |
No files matched your search
@@ -397,6 +397,8 @@ The UI texts live in flat JSON files in [`web/src/locales/`](web/src/locales/),
|
||||
|
||||
The vast majority of this project's code was written by [Claude Code](https://claude.com/claude-code) (Anthropic's Claude), working iteratively with the repo owner one feature at a time.
|
||||
|
||||
Country flags use the [Twemoji Country Flags](https://github.com/talkjs/country-flag-emoji-polyfill) font, artwork from [Twemoji](https://github.com/twitter/twemoji) under [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
||||
|
||||
## 🌈 In Memory of Akimo
|
||||
|
||||
<!-- Permanent: never remove this section. -->
|
||||
|
||||
+22
-10
@@ -2322,6 +2322,25 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Flags from the Twemoji Country Flags font (CC-BY 4.0), because Chromium on
|
||||
Windows has no flag emoji and shows the two letters instead. unicode-range
|
||||
keeps the font to flag characters and loads it only when one is shown. */
|
||||
@font-face {
|
||||
font-family: "Twemoji Country Flags";
|
||||
src: url("./assets/fonts/TwemojiCountryFlags.woff2") format("woff2");
|
||||
unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
.ts-flag {
|
||||
font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
|
||||
}
|
||||
|
||||
.ts-talk-lamp-away {
|
||||
font-size: 11px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.ts-client-icons {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -2345,17 +2364,10 @@
|
||||
}
|
||||
|
||||
.ts-group-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
flex-shrink: 0;
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ts-poke-button {
|
||||
|
||||
+95
-43
@@ -1309,15 +1309,30 @@ function ChannelIcon() {
|
||||
}
|
||||
|
||||
/** GTS2-style talk lamp: blue idle / green talking / muted mic. */
|
||||
/** Red "off" badge in the lamp's bottom-right corner, shared by the mute icons. */
|
||||
const OFF_BADGE = (
|
||||
<>
|
||||
<circle cx="10.35" cy="10.35" r="2.55" fill="#e53935" stroke="#1a1a1a" strokeWidth="0.55" />
|
||||
<path d="M9.35 9.35l2 2M11.35 9.35l-2 2" stroke="#fff" strokeWidth="1.1" strokeLinecap="round" />
|
||||
</>
|
||||
);
|
||||
|
||||
/** The status slot in front of a client's name. Like the native client, away
|
||||
* and mute replace the talk dot instead of being listed after the name.
|
||||
* Order as in TeamSpeak: away, sound muted, mic muted, talking/idle. */
|
||||
function TalkLamp({
|
||||
talking,
|
||||
inputMuted,
|
||||
inputHardwareEnabled,
|
||||
outputMuted = false,
|
||||
away = false,
|
||||
commander = false,
|
||||
}: {
|
||||
talking: boolean;
|
||||
inputMuted: boolean;
|
||||
inputHardwareEnabled: boolean;
|
||||
outputMuted?: boolean;
|
||||
away?: boolean;
|
||||
/** Channel commander: drawn as its own lamp when the design option asks for it. */
|
||||
commander?: boolean;
|
||||
}) {
|
||||
@@ -1326,40 +1341,57 @@ function TalkLamp({
|
||||
const muted = inputMuted || !inputHardwareEnabled;
|
||||
const asCommander = commander && tree.commanderLamp;
|
||||
|
||||
if (muted) {
|
||||
const icon = (title: string, packIcon: string, paths: React.ReactNode) => (
|
||||
<span className="ts-talk-lamp ts-talk-lamp-muted" title={title} aria-hidden="true" data-pack-icon={packIcon}>
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" focusable="false">
|
||||
{paths}
|
||||
</svg>
|
||||
</span>
|
||||
);
|
||||
|
||||
if (away) {
|
||||
return (
|
||||
<span
|
||||
className="ts-talk-lamp ts-talk-lamp-muted"
|
||||
title={t("tree.micMuted")}
|
||||
aria-hidden="true"
|
||||
data-pack-icon={inputMuted ? "micMuted" : "hardwareMicMuted"}
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" focusable="false">
|
||||
<path
|
||||
d="M7 1.4c-1.15 0-2.05.9-2.05 2.05v3.1c0 1.15.9 2.05 2.05 2.05s2.05-.9 2.05-2.05v-3.1C9.05 2.3 8.15 1.4 7 1.4Z"
|
||||
fill="#9aa3ad"
|
||||
/>
|
||||
<path
|
||||
d="M3.2 6.4v.4c0 2 1.7 3.55 3.8 3.55s3.8-1.55 3.8-3.55v-.4"
|
||||
fill="none"
|
||||
stroke="#8a939c"
|
||||
strokeWidth="1.15"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
<path d="M7 10.35v2" stroke="#8a939c" strokeWidth="1.15" strokeLinecap="round" />
|
||||
<path d="M5.2 12.35h3.6" stroke="#8a939c" strokeWidth="1.15" strokeLinecap="round" />
|
||||
<circle cx="10.35" cy="10.35" r="2.55" fill="#e53935" stroke="#1a1a1a" strokeWidth="0.55" />
|
||||
<path
|
||||
d="M9.35 9.35l2 2M11.35 9.35l-2 2"
|
||||
stroke="#fff"
|
||||
strokeWidth="1.1"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
</svg>
|
||||
<span className="ts-talk-lamp ts-talk-lamp-muted ts-talk-lamp-away" title={t("tree.away")} aria-hidden="true" data-pack-icon="away">
|
||||
💤
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (outputMuted) {
|
||||
return icon(
|
||||
t("tree.soundMuted"),
|
||||
"soundMuted",
|
||||
<>
|
||||
<path d="M1.6 5h2.3l3.2-2.7v8.6L3.9 8.2H1.6Z" fill="#9aa3ad" stroke="#8a939c" strokeWidth="0.5" strokeLinejoin="round" />
|
||||
<path d="M8.6 4.6c.7.6 1 1.3 1 2s-.3 1.4-1 2" fill="none" stroke="#8a939c" strokeWidth="1.1" strokeLinecap="round" />
|
||||
{OFF_BADGE}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
if (muted) {
|
||||
return icon(
|
||||
t("tree.micMuted"),
|
||||
inputMuted ? "micMuted" : "hardwareMicMuted",
|
||||
<>
|
||||
<path
|
||||
d="M7 1.4c-1.15 0-2.05.9-2.05 2.05v3.1c0 1.15.9 2.05 2.05 2.05s2.05-.9 2.05-2.05v-3.1C9.05 2.3 8.15 1.4 7 1.4Z"
|
||||
fill="#9aa3ad"
|
||||
/>
|
||||
<path
|
||||
d="M3.2 6.4v.4c0 2 1.7 3.55 3.8 3.55s3.8-1.55 3.8-3.55v-.4"
|
||||
fill="none"
|
||||
stroke="#8a939c"
|
||||
strokeWidth="1.15"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
<path d="M7 10.35v2" stroke="#8a939c" strokeWidth="1.15" strokeLinecap="round" />
|
||||
<path d="M5.2 12.35h3.6" stroke="#8a939c" strokeWidth="1.15" strokeLinecap="round" />
|
||||
{OFF_BADGE}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
if (talking) {
|
||||
return (
|
||||
<span
|
||||
@@ -1383,15 +1415,13 @@ function TalkLamp({
|
||||
function ClientStatusIcons({ client }: { client: ClientInfo }) {
|
||||
const t = useT();
|
||||
const { tree } = useContext(DisplayPrefsContext);
|
||||
// Mute is shown on the TalkLamp; keep secondary flags here.
|
||||
// Away and mute are shown on the TalkLamp; keep secondary flags here.
|
||||
return (
|
||||
<span className="ts-status-icons">
|
||||
{client.isChannelCommander && !tree.commanderLamp && <span title={t("tree.channelCommander")}>⭐</span>}
|
||||
{client.away && <span title={t("tree.away")} data-pack-icon="away">💤</span>}
|
||||
{!client.inputMuted && client.inputHardwareEnabled && !client.hasTalkPower && (
|
||||
<span title={t("tree.noTalkPower")}>🔒</span>
|
||||
)}
|
||||
{client.outputMuted && <span title={t("tree.soundMuted")} data-pack-icon="soundMuted">🔕</span>}
|
||||
{client.isStreaming && <span title={t("tree.streaming")}>📺</span>}
|
||||
</span>
|
||||
);
|
||||
@@ -1413,9 +1443,15 @@ function GroupIcon({ group, images }: { group: GroupEntry; images: Record<string
|
||||
const base64 = group.iconId >= CUSTOM_ICON_ID_THRESHOLD ? images[`/icon_${group.iconId}`] : undefined;
|
||||
if (base64) return <img className="ts-group-icon" src={iconDataUrl(base64)} alt="" title={group.name} />;
|
||||
return (
|
||||
<span className="ts-group-badge" style={{ background: groupBadgeColor(group.iconId) }} title={group.name}>
|
||||
{group.name.trim().charAt(0).toUpperCase() || "?"}
|
||||
</span>
|
||||
<svg className="ts-group-badge" width="16" height="16" viewBox="0 0 16 16" role="img" aria-label={group.name}>
|
||||
<title>{group.name}</title>
|
||||
<circle cx="6.5" cy="4.6" r="2.9" fill="#8b95a1" />
|
||||
<path d="M1 14.6c0-3.3 2.4-5.6 5.5-5.6s5.5 2.3 5.5 5.6Z" fill="#8b95a1" />
|
||||
<circle cx="11.6" cy="11.4" r="4.1" fill={groupBadgeColor(group.iconId)} stroke="var(--bg, #fff)" strokeWidth="0.9" />
|
||||
<text x="11.6" y="13.95" textAnchor="middle" fontSize="7" fontWeight="700" fill="#fff" fontFamily="system-ui, sans-serif">
|
||||
{group.name.trim().charAt(0).toUpperCase() || "?"}
|
||||
</text>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1453,6 +1489,7 @@ function ChannelTree({
|
||||
ownClientId,
|
||||
talkers,
|
||||
serverGroups,
|
||||
channelGroups = null,
|
||||
groupIconImages,
|
||||
selected,
|
||||
sessionKey,
|
||||
@@ -1471,6 +1508,8 @@ function ChannelTree({
|
||||
ownClientId: number | null;
|
||||
talkers: Set<number>;
|
||||
serverGroups: GroupEntry[] | null;
|
||||
/** For the channel group icon, shown after the server group icons like in the native client. */
|
||||
channelGroups?: GroupEntry[] | null;
|
||||
groupIconImages: Record<string, string>;
|
||||
selected: SelectedItem | null;
|
||||
/** Identifies which multi-join tab this tree belongs to, so the manual
|
||||
@@ -1497,12 +1536,12 @@ function ChannelTree({
|
||||
const children = channels.filter((c) => c.parent === parent).sort((a, b) => a.order - b.order);
|
||||
if (children.length === 0) return null;
|
||||
|
||||
// Server group icons, then the channel group icon (the flag follows last).
|
||||
const clientGroupBadges = (client: ClientInfo): GroupEntry[] =>
|
||||
serverGroups
|
||||
? client.serverGroups
|
||||
.map((gid) => serverGroups.find((g) => g.id === gid))
|
||||
.filter((g): g is GroupEntry => !!g && g.iconId !== 0)
|
||||
: [];
|
||||
[
|
||||
...(serverGroups ? client.serverGroups.map((gid) => serverGroups.find((g) => g.id === gid)) : []),
|
||||
channelGroups?.find((g) => g.id === client.channelGroup),
|
||||
].filter((g): g is GroupEntry => !!g && g.iconId !== 0);
|
||||
|
||||
// "Own channel" mode keeps the own channel and the channels above it open.
|
||||
const ownPath = new Set<number>();
|
||||
@@ -1575,6 +1614,7 @@ function ChannelTree({
|
||||
ownClientId={ownClientId}
|
||||
talkers={talkers}
|
||||
serverGroups={serverGroups}
|
||||
channelGroups={channelGroups}
|
||||
groupIconImages={groupIconImages}
|
||||
selected={selected}
|
||||
sessionKey={sessionKey}
|
||||
@@ -1754,6 +1794,8 @@ function ChannelTree({
|
||||
}
|
||||
inputMuted={c.inputMuted}
|
||||
inputHardwareEnabled={c.inputHardwareEnabled}
|
||||
outputMuted={c.outputMuted}
|
||||
away={c.away}
|
||||
commander={c.isChannelCommander}
|
||||
/>
|
||||
<span className="ts-client-status-leading">
|
||||
@@ -1765,7 +1807,6 @@ function ChannelTree({
|
||||
className="ts-client-avatar"
|
||||
isSelf={c.id === ownClientId}
|
||||
/>
|
||||
{tree.flags && countryFlag(c.country) && <span title={c.country}>{countryFlag(c.country)}</span>}
|
||||
<span className="ts-tree-label">{c.name}</span>
|
||||
{tree.awayMessage && c.away && c.awayMessage && (
|
||||
<span className="ts-client-away-message">({c.awayMessage})</span>
|
||||
@@ -1774,6 +1815,9 @@ function ChannelTree({
|
||||
{clientGroupBadges(c).map((g) => (
|
||||
<GroupIcon key={g.id} group={g} images={groupIconImages} />
|
||||
))}
|
||||
{tree.flags && countryFlag(c.country) && (
|
||||
<span className="ts-flag" title={c.country}>{countryFlag(c.country)}</span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
@@ -1970,6 +2014,8 @@ function InfoPanel({
|
||||
talking={false}
|
||||
inputMuted={client.inputMuted}
|
||||
inputHardwareEnabled={client.inputHardwareEnabled}
|
||||
outputMuted={client.outputMuted}
|
||||
away={client.away}
|
||||
/>
|
||||
<span>{client.name}</span>
|
||||
</div>
|
||||
@@ -1980,7 +2026,7 @@ function InfoPanel({
|
||||
<div className="ts-info-row">
|
||||
<span>{t("info.country")}</span>{" "}
|
||||
<span>
|
||||
{countryFlag(client.country) ? `${countryFlag(client.country)} ` : ""}
|
||||
{countryFlag(client.country) && <span className="ts-flag">{countryFlag(client.country)} </span>}
|
||||
{client.country}
|
||||
</span>
|
||||
</div>
|
||||
@@ -11106,6 +11152,10 @@ function AppInner() {
|
||||
if (!connected || serverGroups) return;
|
||||
socketRef.current?.send(JSON.stringify({ type: "getServerGroupList" }));
|
||||
}, [connected, serverGroups]);
|
||||
useEffect(() => {
|
||||
if (!connected || channelGroups) return;
|
||||
socketRef.current?.send(JSON.stringify({ type: "getChannelGroupList" }));
|
||||
}, [connected, channelGroups]);
|
||||
|
||||
// Same icon-file cache as the server icons dialog (fileDownloadData for
|
||||
// cid 0 always lands in serverIconImages, regardless of who asked) - fetch
|
||||
@@ -11119,13 +11169,14 @@ function AppInner() {
|
||||
useEffect(() => {
|
||||
if (!serverGroups) return;
|
||||
const iconById = new Map(serverGroups.map((g) => [g.id, g.iconId]));
|
||||
const channelIconById = new Map((channelGroups ?? []).map((g) => [g.id, g.iconId]));
|
||||
// Plus every group listed in an open group menu, so unassigned ones show their icon too.
|
||||
const menuGroups = !groupAssignTarget
|
||||
? []
|
||||
: ((groupAssignTarget.kind === "channel" ? channelGroups : serverGroups) ?? []);
|
||||
const wantedIconIds = new Set(
|
||||
clients
|
||||
.flatMap((c) => c.serverGroups.map((gid) => iconById.get(gid) ?? 0))
|
||||
.flatMap((c) => [...c.serverGroups.map((gid) => iconById.get(gid) ?? 0), channelIconById.get(c.channelGroup) ?? 0])
|
||||
.concat(menuGroups.map((g) => g.iconId))
|
||||
.filter((id) => id >= CUSTOM_ICON_ID_THRESHOLD)
|
||||
);
|
||||
@@ -14572,6 +14623,7 @@ function AppInner() {
|
||||
ownClientId={ownClientId ?? ownClient?.id ?? null}
|
||||
talkers={displayTalkers}
|
||||
serverGroups={serverGroups}
|
||||
channelGroups={channelGroups}
|
||||
groupIconImages={serverIconImages}
|
||||
selected={selected}
|
||||
sessionKey={activeSessionId ?? ""}
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user