diff --git a/.env.example b/.env.example index 10db79c..40162ad 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,7 @@ ADMIN_COOKIE=muelleel UPLOAD_PATH=/tmp/uploads VIDEO_PATH=/tmp/videos +DIRECT_INVITATION_LINKS_ENABLED=true HOMEPAGE_TRAILER_URL=http://localhost:4321/craftattack/video/trailer/embed TEAMSPEAK_LINK=http://example.com diff --git a/README.md b/README.md index d21d2ca..4d0ae4b 100644 --- a/README.md +++ b/README.md @@ -327,28 +327,29 @@ Alle Webhooks: ## Environment Variables -| Name | Default | Beschreibung | -| ---------------------- | -------------------------- | -------------------------------------------------------------------------------------------------- | -| `HOST` | `0.0.0.0` | Bind-Adresse des Webservers | -| `PORT` | `8080` | Port des Webservers | -| `ROOT_URL` | `http://localhost:4321` | Vollständige öffentliche URL inklusive Subpath | -| `DATABASE_URI` | - | MariaDB URI. Muss gesetzt sein. | -| `API_SECRET` | - | Basic-Auth-Passwort für externe API-Endpunkte. Ohne Wert ist die API-Authentifizierung deaktiviert | -| `ADMIN_USER` | - | Benutzername für den default Admin User. Ohne Wert ist der Admin User deaktiviert | -| `ADMIN_PASSWORD` | - | Passwort für den default Admin User. Ohne Wert ist der Admin User deaktiviert | -| `ADMIN_COOKIE` | `muelleel` | Name des Admin-Session-Cookies | -| `UPLOAD_PATH` | - | Verzeichnis für Report-Anhänge. Ohne Wert sind Uploads deaktiviert | -| `VIDEO_PATH` | - | Verzeichnis für Videos. Ohne Wert sind die Video-Routen deaktiviert | -| `HOMEPAGE_TRAILER_URL` | - | URL des Trailers, der auf der Startseite per Iframe eingebettet wird | -| `CACHE_PATH` | OS-Temp-Verzeichnis | Verzeichnis für generierte Caches, z.B. Video Thumbnails | -| `MAX_UPLOAD_BYTES` | `20971520` | Maximale Gesamtgröße aller Report-Anhänge eines Reports in Bytes | -| `START_DATE` | `1970-01-01` | Startdatum/Startzeit für Countdown und Anmeldung | -| `WEBHOOK_ENDPOINT` | - | Kommaseparierte Liste von Webhook-URLs | -| `STATISTICS_ENDPOINT` | - | Endpoint für Live-Statistiken. Ohne Wert werden keine Statistiken geladen | -| `STATISTICS_INTERVAL` | `1800` | Abfrageintervall für Live-Statistiken in Sekunden | -| `TEAMSPEAK_LINK` | `http://example.com` | Link zum TeamSpeak-Server | -| `DISCORD_LINK` | `http://example.com` | Link zum Discord-Server | -| `PAYPAL_LINK` | `http://example.com` | Link für PayPal Spenden | -| `SERVER_IP` | `http://example.com` | Öffentliche Minecraft-Server-Adresse | -| `OPENXBL_API_KEY` | - | API-Key für die Xbox-/Bedrock-UUID-Suche. Ohne Key schlägt die Bedrock-UUID-Ermittlung fehl | -| `LOG_LEVEL` | Dev: `debug`, Prod: `warn` | Log-Level, als `trace`, `debug`, `info`, `warn` oder `error` | +| Name | Default | Beschreibung | +| --------------------------------- | -------------------------- | -------------------------------------------------------------------------------------------------- | +| `HOST` | `0.0.0.0` | Bind-Adresse des Webservers | +| `PORT` | `8080` | Port des Webservers | +| `ROOT_URL` | `http://localhost:4321` | Vollständige öffentliche URL inklusive Subpath | +| `DATABASE_URI` | - | MariaDB URI. Muss gesetzt sein. | +| `API_SECRET` | - | Basic-Auth-Passwort für externe API-Endpunkte. Ohne Wert ist die API-Authentifizierung deaktiviert | +| `ADMIN_USER` | - | Benutzername für den default Admin User. Ohne Wert ist der Admin User deaktiviert | +| `ADMIN_PASSWORD` | - | Passwort für den default Admin User. Ohne Wert ist der Admin User deaktiviert | +| `ADMIN_COOKIE` | `muelleel` | Name des Admin-Session-Cookies | +| `UPLOAD_PATH` | - | Verzeichnis für Report-Anhänge. Ohne Wert sind Uploads deaktiviert | +| `VIDEO_PATH` | - | Verzeichnis für Videos. Ohne Wert sind die Video-Routen deaktiviert | +| `DIRECT_INVITATION_LINKS_ENABLED` | `true` | Ob direkte Einladungslinks unter `/signup/{code}` erreichbar sind | +| `HOMEPAGE_TRAILER_URL` | - | URL des Trailers, der auf der Startseite per Iframe eingebettet wird | +| `CACHE_PATH` | OS-Temp-Verzeichnis | Verzeichnis für generierte Caches, z.B. Video Thumbnails | +| `MAX_UPLOAD_BYTES` | `20971520` | Maximale Gesamtgröße aller Report-Anhänge eines Reports in Bytes | +| `START_DATE` | `1970-01-01` | Startdatum/Startzeit für Countdown und Anmeldung | +| `WEBHOOK_ENDPOINT` | - | Kommaseparierte Liste von Webhook-URLs | +| `STATISTICS_ENDPOINT` | - | Endpoint für Live-Statistiken. Ohne Wert werden keine Statistiken geladen | +| `STATISTICS_INTERVAL` | `1800` | Abfrageintervall für Live-Statistiken in Sekunden | +| `TEAMSPEAK_LINK` | `http://example.com` | Link zum TeamSpeak-Server | +| `DISCORD_LINK` | `http://example.com` | Link zum Discord-Server | +| `PAYPAL_LINK` | `http://example.com` | Link für PayPal Spenden | +| `SERVER_IP` | `http://example.com` | Öffentliche Minecraft-Server-Adresse | +| `OPENXBL_API_KEY` | - | API-Key für die Xbox-/Bedrock-UUID-Suche. Ohne Key schlägt die Bedrock-UUID-Ermittlung fehl | +| `LOG_LEVEL` | Dev: `debug`, Prod: `warn` | Log-Level, als `trace`, `debug`, `info`, `warn` oder `error` | diff --git a/astro.config.mjs b/astro.config.mjs index 27a5fdc..f35c9e0 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -41,6 +41,8 @@ export default defineConfig({ UPLOAD_PATH: envField.string({ context: 'server', access: 'secret', optional: true }), VIDEO_PATH: envField.string({ context: 'server', access: 'secret', optional: true }), + DIRECT_INVITATION_LINKS_ENABLED: envField.boolean({ context: 'server', access: 'secret', default: true }), + MAX_UPLOAD_BYTES: envField.number({ context: 'server', access: 'secret', default: 20 * 1024 * 1024 }), START_DATE: envField.string({ context: 'server', access: 'secret', default: '1970-01-01' }), diff --git a/flake.nix b/flake.nix index 87aac01..917c203 100644 --- a/flake.nix +++ b/flake.nix @@ -44,6 +44,7 @@ UPLOAD_PATH = "./.data/uploads"; VIDEO_PATH = "./.data/videos"; + DIRECT_INVITATION_LINKS_ENABLED = "true"; HOMEPAGE_TRAILER_URL = "http://localhost:4321/craftattack/video/out-final-final/embed"; TEAMSPEAK_LINK = "http://example.com"; diff --git a/src/app/admin/directInvitations/DirectInvitations.svelte b/src/app/admin/directInvitations/DirectInvitations.svelte index 69793e5..4e9a7a0 100644 --- a/src/app/admin/directInvitations/DirectInvitations.svelte +++ b/src/app/admin/directInvitations/DirectInvitations.svelte @@ -9,6 +9,13 @@ directInvitations } from '@app/admin/directInvitations/directInvitations.ts'; + // props + interface Props { + linksEnabled: boolean; + } + + let { linksEnabled }: Props = $props(); + // state let directInvitationEditPopupDirectInvitation = $state(null); let directInvitationEditPopupOpen = $derived(!!directInvitationEditPopupDirectInvitation); @@ -59,17 +66,19 @@ {/snippet} {#snippet extraActions(directInvitation)} - + {#if linksEnabled} + + {/if} {/snippet} diff --git a/src/pages/admin/users/direct_invitations.astro b/src/pages/admin/users/direct_invitations.astro index d979c3b..8dee7aa 100644 --- a/src/pages/admin/users/direct_invitations.astro +++ b/src/pages/admin/users/direct_invitations.astro @@ -1,4 +1,5 @@ --- +import { DIRECT_INVITATION_LINKS_ENABLED } from 'astro:env/server'; import { Session } from '@util/session.ts'; import { Permissions } from '@util/permissions.ts'; import { siteUrl } from '@util/url.ts'; @@ -12,5 +13,5 @@ if (!session) return Astro.redirect(siteUrl('admin')); - + diff --git a/src/pages/signup/[...code].astro b/src/pages/signup/[...code].astro index d22a460..ecb4b21 100644 --- a/src/pages/signup/[...code].astro +++ b/src/pages/signup/[...code].astro @@ -1,9 +1,12 @@ --- +import { DIRECT_INVITATION_LINKS_ENABLED } from 'astro:env/server'; import { db } from '@db/database.ts'; import Signup from '@app/website/signup/Signup.astro'; const { code } = Astro.params; +if (!DIRECT_INVITATION_LINKS_ENABLED) return new Response(null, { status: 404 }); + const directSignup = await db.getDirectSignupByCode({ code: code! }); if (!directSignup) return new Response(null, { status: 404 }); ---