diff --git a/connector/src/main.rs b/connector/src/main.rs
index 095a0dc..621d90f 100644
--- a/connector/src/main.rs
+++ b/connector/src/main.rs
@@ -68,6 +68,7 @@ struct ClientInfo {
away: bool,
away_message: String,
is_channel_commander: bool,
+ country: String,
}
/// Human-facing entries for the Server tab's log-style notifications
@@ -308,6 +309,7 @@ fn snapshot(con: &data::Connection) -> Event {
away: c.away_message.is_some(),
away_message: c.away_message.clone().unwrap_or_default(),
is_channel_commander: c.is_channel_commander,
+ country: c.country_code.clone(),
})
.collect();
Event::Channels { channels, clients }
diff --git a/gateway/src/ts3/connection.ts b/gateway/src/ts3/connection.ts
index 70d58f9..a13084e 100644
--- a/gateway/src/ts3/connection.ts
+++ b/gateway/src/ts3/connection.ts
@@ -31,6 +31,7 @@ export interface ClientInfo {
away: boolean;
awayMessage: string;
isChannelCommander: boolean;
+ country: string;
}
export type ServerLogEntry =
@@ -115,6 +116,7 @@ export class Ts3Connection {
away: boolean;
away_message: string;
is_channel_commander: boolean;
+ country: string;
}
interface RawChannelInfo {
@@ -182,6 +184,7 @@ export class Ts3Connection {
away: c.away,
awayMessage: c.away_message,
isChannelCommander: c.is_channel_commander,
+ country: c.country,
})),
});
} else if (event.type === "privateMessage") {
diff --git a/web/src/App.tsx b/web/src/App.tsx
index c90472b..71615e5 100644
--- a/web/src/App.tsx
+++ b/web/src/App.tsx
@@ -159,6 +159,16 @@ interface ClientInfo {
away: boolean;
awayMessage: string;
isChannelCommander: boolean;
+ country: string;
+}
+
+/** Converts an ISO 3166-1 alpha-2 country code (e.g. "DE") to its flag emoji
+ * via Unicode regional indicator symbols. Returns null for codes the server
+ * doesn't report (empty string - common when geo-IP isn't configured). */
+function countryFlag(code: string): string | null {
+ if (!/^[A-Za-z]{2}$/.test(code)) return null;
+ const codePoints = [...code.toUpperCase()].map((c) => 0x1f1e6 + c.charCodeAt(0) - 65);
+ return String.fromCodePoint(...codePoints);
}
function ChannelIcon() {
@@ -266,6 +276,7 @@ function ChannelTree({
title={c.id === ownClientId ? undefined : `${t("tree.privateChatWith")} ${c.name}`}
>
+ {countryFlag(c.country) && {countryFlag(c.country)}}
{c.name}
{c.away && c.awayMessage && (
({c.awayMessage})
diff --git a/web/src/demoMode.ts b/web/src/demoMode.ts
index 50ed9bb..2053b20 100644
--- a/web/src/demoMode.ts
+++ b/web/src/demoMode.ts
@@ -28,6 +28,7 @@ interface DemoClient {
away: boolean;
awayMessage: string;
isChannelCommander: boolean;
+ country: string;
}
const DEMO_CHANNELS: DemoChannel[] = [
@@ -37,10 +38,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 },
- { id: 103, channel: 2, name: "Sam", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false },
- { id: 104, channel: 2, name: "Jordan", inputMuted: true, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false },
- { id: 105, channel: 3, name: "Riley", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: true, awayMessage: "brb, grabbing coffee", isChannelCommander: false },
+ { 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" },
];
const SELF_ID = 101;
@@ -218,6 +219,7 @@ export class DemoSocket {
away: false,
awayMessage: "",
isChannelCommander: false,
+ country: "",
};
this.emit({ type: "channels", channels: DEMO_CHANNELS, clients: [self, ...DEMO_NPCS] });
}