Add URL-based and build-time auto-connect (closes #10)

Landing pages can now send visitors straight into a TeamSpeak server:
a ?connect=host&nickname=&channel=&token= share link auto-connects on
any deployment, or a self-hoster can bake in a default server at build
time (VITE_DEFAULT_SERVER/VITE_DEFAULT_CHANNEL, mirroring the existing
DONATE_URL Docker ARG pattern) so every visitor auto-joins with zero
params. A share link always overrides the build-time default. Waits
for the mandatory first-visit ToS gate where applicable, falls back to
a prefilled reopened connect dialog on failure, and generates a
Guest-XXXX nickname when none is available.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Sonnet 5 committed 2026-09-16 12:34:14 +00:00
1 parent f44327aabc
commit faeb269fdd
3 files changed
+80 -2

No files matched your search

+8 -2
View File
@@ -29,10 +29,16 @@ COPY web/ ./
# exists because an unset build arg and an empty one are indistinguishable
# inside RUN - without it, "not passed" would silently mean "remove".
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;
# vite build alone is enough to produce the production bundle.
RUN if [ "$DONATE_URL" = "keep" ]; then npx vite build; \
else VITE_DONATE_URL="$DONATE_URL" npx vite build; fi
RUN if [ "$DONATE_URL" = "keep" ]; then DONATE_URL_ENV=; else DONATE_URL_ENV="VITE_DONATE_URL=$DONATE_URL"; fi; \
env $DONATE_URL_ENV VITE_DEFAULT_SERVER="$DEFAULT_SERVER" VITE_DEFAULT_CHANNEL="$DEFAULT_CHANNEL" npx vite build
# --- Gateway ----------------------------------------------------------------
FROM node:22-bookworm-slim AS gateway-builder