mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
faeb269fdd | ||
|
|
f44327aabc |
No files matched your search
+8
-2
@@ -29,10 +29,16 @@ COPY web/ ./
|
|||||||
# exists because an unset build arg and an empty one are indistinguishable
|
# exists because an unset build arg and an empty one are indistinguishable
|
||||||
# inside RUN - without it, "not passed" would silently mean "remove".
|
# inside RUN - without it, "not passed" would silently mean "remove".
|
||||||
ARG DONATE_URL=keep
|
ARG DONATE_URL=keep
|
||||||
|
# A self-hosted build can bake in a server to auto-connect to with zero user
|
||||||
|
# input (see web/src/App.tsx's AUTO_CONNECT_FROM_URL/DEFAULT_SERVER, GitHub
|
||||||
|
# issue #10). Unlike DONATE_URL, unset already means "no default" - no "keep"
|
||||||
|
# sentinel needed.
|
||||||
|
ARG DEFAULT_SERVER=
|
||||||
|
ARG DEFAULT_CHANNEL=
|
||||||
# tsc -b currently fails on pre-existing type errors unrelated to this build;
|
# tsc -b currently fails on pre-existing type errors unrelated to this build;
|
||||||
# vite build alone is enough to produce the production bundle.
|
# vite build alone is enough to produce the production bundle.
|
||||||
RUN if [ "$DONATE_URL" = "keep" ]; then npx vite build; \
|
RUN if [ "$DONATE_URL" = "keep" ]; then DONATE_URL_ENV=; else DONATE_URL_ENV="VITE_DONATE_URL=$DONATE_URL"; fi; \
|
||||||
else VITE_DONATE_URL="$DONATE_URL" npx vite build; fi
|
env $DONATE_URL_ENV VITE_DEFAULT_SERVER="$DEFAULT_SERVER" VITE_DEFAULT_CHANNEL="$DEFAULT_CHANNEL" npx vite build
|
||||||
|
|
||||||
# --- Gateway ----------------------------------------------------------------
|
# --- Gateway ----------------------------------------------------------------
|
||||||
FROM node:22-bookworm-slim AS gateway-builder
|
FROM node:22-bookworm-slim AS gateway-builder
|
||||||
|
|||||||
@@ -180,6 +180,13 @@ docker run -d -p 8080:8080 --name webspeak3 moepchi/webspeak3:latest
|
|||||||
|
|
||||||
The UI shows a small **Ko-fi donation button** in the bottom right corner. Building it yourself and would rather not carry someone else's donation link? `docker compose build --build-arg DONATE_URL=` removes it (any other value points it somewhere else). Outside Docker the same thing is a build-time variable: `VITE_DONATE_URL= npm run build` in `web/`.
|
The UI shows a small **Ko-fi donation button** in the bottom right corner. Building it yourself and would rather not carry someone else's donation link? `docker compose build --build-arg DONATE_URL=` removes it (any other value points it somewhere else). Outside Docker the same thing is a build-time variable: `VITE_DONATE_URL= npm run build` in `web/`.
|
||||||
|
|
||||||
|
Want your instance to auto-connect visitors to a specific TeamSpeak server? Two ways, and either works with no user input at all:
|
||||||
|
|
||||||
|
- **Share link**: send anyone `https://your-instance/?connect=your.ts.server&nickname=Guest&channel=Lobby&token=...` - `connect` is the only required part, the rest are optional. Works on any deployment, no rebuild needed.
|
||||||
|
- **Baked-in default**: `docker compose build --build-arg DEFAULT_SERVER=your.ts.server --build-arg DEFAULT_CHANNEL=Lobby` (or `VITE_DEFAULT_SERVER=your.ts.server npm run build` in `web/`) makes every visitor auto-connect there by default. A share link still overrides it when present.
|
||||||
|
|
||||||
|
Visitors with no nickname of their own get an auto-generated `Guest-XXXX` one.
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary><b>🛠️ Manual installation (without Docker)</b></summary>
|
<summary><b>🛠️ Manual installation (without Docker)</b></summary>
|
||||||
|
|
||||||
|
|||||||
+18
-1
@@ -46,9 +46,26 @@ This roadmap is intentionally outcome-focused. It does not promise fixed dates.
|
|||||||
|
|
||||||
- Expand real-browser audio testing, especially Safari
|
- Expand real-browser audio testing, especially Safari
|
||||||
- Improve reconnect and recovery behavior under unstable networks
|
- Improve reconnect and recovery behavior under unstable networks
|
||||||
- Continue accessibility, keyboard-navigation, and mobile usability work
|
|
||||||
- Turn recurring deployment and compatibility reports into documentation
|
- Turn recurring deployment and compatibility reports into documentation
|
||||||
|
|
||||||
|
### Accessibility
|
||||||
|
|
||||||
|
The interface currently assumes a mouse and sighted use; a real pass is
|
||||||
|
still needed:
|
||||||
|
|
||||||
|
- Replace clickable `<div>`s that aren't real `<button>`s with actual
|
||||||
|
buttons, so they're reachable and operable by keyboard
|
||||||
|
- Add keyboard handlers next to the many click-only interactions (channel
|
||||||
|
tree, context menus, client list)
|
||||||
|
- Label icon-only toggle controls (mute, away, streaming, recording, ...)
|
||||||
|
with `aria-label`/`aria-pressed` so their state is announced, not just shown
|
||||||
|
as a color/icon change
|
||||||
|
- Fix the document's `lang` attribute to follow the active UI language
|
||||||
|
instead of staying fixed
|
||||||
|
- Manage focus in modals and dialogs: move it in on open, return it on close
|
||||||
|
- Do a full screen-reader pass (NVDA/VoiceOver) through a real connect
|
||||||
|
session to find what else is missing beyond the above
|
||||||
|
|
||||||
### Deployment experience
|
### Deployment experience
|
||||||
|
|
||||||
- Keep the one-command Docker path reliable
|
- Keep the one-command Docker path reliable
|
||||||
|
|||||||
@@ -115,6 +115,34 @@ const DONATE_URL = import.meta.env.VITE_DONATE_URL ?? "https://ko-fi.com/moepchi
|
|||||||
const OWN_HOSTED_HOSTNAMES = new Set(["client.webspeak3.de"]);
|
const OWN_HOSTED_HOSTNAMES = new Set(["client.webspeak3.de"]);
|
||||||
const IS_OWN_HOSTED_INSTANCE = !DEMO_MODE && OWN_HOSTED_HOSTNAMES.has(window.location.hostname);
|
const IS_OWN_HOSTED_INSTANCE = !DEMO_MODE && OWN_HOSTED_HOSTNAMES.has(window.location.hostname);
|
||||||
|
|
||||||
|
// Auto-connect from a share link (?connect=host[:port]&nickname=&channel=&token=,
|
||||||
|
// see GitHub issue #10). Parsed once at module load and immediately stripped
|
||||||
|
// from the URL via replaceState so a reload/refresh doesn't silently
|
||||||
|
// reconnect off a stale link sitting in the address bar or browser history.
|
||||||
|
const AUTO_CONNECT_FROM_URL = (() => {
|
||||||
|
const params = new URLSearchParams(window.location.search);
|
||||||
|
const connectHost = params.get("connect");
|
||||||
|
if (!connectHost) return null;
|
||||||
|
const target = {
|
||||||
|
host: connectHost,
|
||||||
|
nickname: params.get("nickname") || undefined,
|
||||||
|
defaultChannel: params.get("channel") || undefined,
|
||||||
|
privilegeKey: params.get("token") || undefined,
|
||||||
|
};
|
||||||
|
for (const key of ["connect", "nickname", "channel", "token"]) params.delete(key);
|
||||||
|
const rest = params.toString();
|
||||||
|
window.history.replaceState(null, "", window.location.pathname + (rest ? `?${rest}` : "") + window.location.hash);
|
||||||
|
return target;
|
||||||
|
})();
|
||||||
|
|
||||||
|
// A self-hosted build can also bake in a default server so the page
|
||||||
|
// auto-connects with zero URL params at all - set via `docker compose build
|
||||||
|
// --build-arg DEFAULT_SERVER=...` (see Dockerfile/README) or plain
|
||||||
|
// VITE_DEFAULT_SERVER= at build time. AUTO_CONNECT_FROM_URL above always wins
|
||||||
|
// when a share link is present.
|
||||||
|
const DEFAULT_SERVER = import.meta.env.VITE_DEFAULT_SERVER || null;
|
||||||
|
const DEFAULT_CHANNEL = import.meta.env.VITE_DEFAULT_CHANNEL || "";
|
||||||
|
|
||||||
// Terms of use, own-hosted instance only (see TODO.md #2/#7.1). Versioned so
|
// Terms of use, own-hosted instance only (see TODO.md #2/#7.1). Versioned so
|
||||||
// a rule change can re-surface the modal: bump TOS_VERSION and everyone who
|
// a rule change can re-surface the modal: bump TOS_VERSION and everyone who
|
||||||
// accepted an older version is asked again.
|
// accepted an older version is asked again.
|
||||||
@@ -7191,6 +7219,43 @@ function AppInner() {
|
|||||||
wireSocket(sessionId, socket, params);
|
wireSocket(sessionId, socket, params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Auto-connect from a ?connect=... share link or a build-time default
|
||||||
|
// server (issue #10). Fires once, after the mandatory first-visit ToS gate
|
||||||
|
// (if any) is out of the way, so it never races the gate or connects
|
||||||
|
// before the user has had a chance to accept it.
|
||||||
|
const autoConnectedRef = useRef(false);
|
||||||
|
const autoConnectPendingRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (autoConnectedRef.current) return;
|
||||||
|
if (tosMandatory && tosOpen) return;
|
||||||
|
const target = AUTO_CONNECT_FROM_URL ??
|
||||||
|
(DEFAULT_SERVER
|
||||||
|
? { host: DEFAULT_SERVER, nickname: undefined, defaultChannel: DEFAULT_CHANNEL, privilegeKey: undefined }
|
||||||
|
: null);
|
||||||
|
if (!target) return;
|
||||||
|
autoConnectedRef.current = true;
|
||||||
|
autoConnectPendingRef.current = true;
|
||||||
|
handleConnect({
|
||||||
|
host: target.host,
|
||||||
|
nickname: target.nickname || nickname || `Guest-${Math.floor(1000 + Math.random() * 9000)}`,
|
||||||
|
defaultChannel: target.defaultChannel,
|
||||||
|
privilegeKey: target.privilegeKey,
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [tosMandatory, tosOpen]);
|
||||||
|
|
||||||
|
// A manual connect attempt leaves its error as a dismissable banner with the
|
||||||
|
// dialog already closed - fine, since the user just closed it themselves.
|
||||||
|
// An auto-connect attempt has no dialog open at all, so on failure reopen it
|
||||||
|
// prefilled with the attempted host, letting the user fix and retry by hand.
|
||||||
|
useEffect(() => {
|
||||||
|
if (!autoConnectPendingRef.current || !connectError) return;
|
||||||
|
autoConnectPendingRef.current = false;
|
||||||
|
setHost(AUTO_CONNECT_FROM_URL?.host ?? DEFAULT_SERVER ?? host);
|
||||||
|
setConnectDialogOpen(true);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [connectError]);
|
||||||
|
|
||||||
// Opens a fresh socket for a session that already exists (active or
|
// Opens a fresh socket for a session that already exists (active or
|
||||||
// parked) and re-runs the same connect handshake, reusing the params
|
// parked) and re-runs the same connect handshake, reusing the params
|
||||||
// stored at connect time. Used to recover from an unexpected drop —
|
// stored at connect time. Used to recover from an unexpected drop —
|
||||||
|
|||||||
Reference in new issue
Block a user