add env variable to disable direct invitation links

This commit is contained in:
bytedream committed 2026-11-07 23:08:16 +01:00
1 parent b40665c2d7
commit 14fa022dd3
7 files changed
+55 -37

No files matched your search

+1
View File
@@ -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
+26 -25
View File
@@ -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` |
+2
View File
@@ -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' }),
+1
View File
@@ -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";
@@ -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)}
<button
class="cursor-pointer"
title={copiedCode === directInvitation.code ? 'Link kopiert' : 'Link kopieren'}
onclick={() => copyLink(directInvitation)}
>
{#if copiedCode === directInvitation.code}
<span class="iconify iconify-[heroicons--clipboard-document-check]"></span>
{:else}
<span class="iconify iconify-[heroicons--clipboard]"></span>
{/if}
</button>
{#if linksEnabled}
<button
class="cursor-pointer"
title={copiedCode === directInvitation.code ? 'Link kopiert' : 'Link kopieren'}
onclick={() => copyLink(directInvitation)}
>
{#if copiedCode === directInvitation.code}
<span class="iconify iconify-[heroicons--clipboard-document-check]"></span>
{:else}
<span class="iconify iconify-[heroicons--clipboard]"></span>
{/if}
</button>
{/if}
{/snippet}
</DataTable>
@@ -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'));
<AdminLayout title="Direkte Einladungen">
<SidebarActions slot="actions" client:load />
<DirectInvitations client:load />
<DirectInvitations linksEnabled={DIRECT_INVITATION_LINKS_ENABLED} client:load />
</AdminLayout>
+3
View File
@@ -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 });
---