diff --git a/.env.example b/.env.example index 7079bd0..10db79c 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,7 @@ ADMIN_COOKIE=muelleel UPLOAD_PATH=/tmp/uploads VIDEO_PATH=/tmp/videos +HOMEPAGE_TRAILER_URL=http://localhost:4321/craftattack/video/trailer/embed TEAMSPEAK_LINK=http://example.com DISCORD_LINK=http://example.com diff --git a/README.md b/README.md index 21d19d7..d964514 100644 --- a/README.md +++ b/README.md @@ -306,27 +306,28 @@ 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 | -| `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 | +| `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 6a9326c..27a5fdc 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -55,6 +55,8 @@ export default defineConfig({ PAYPAL_LINK: envField.string({ context: 'server', access: 'secret', default: 'http://example.com' }), SERVER_IP: envField.string({ context: 'server', access: 'secret', default: 'http://example.com' }), + HOMEPAGE_TRAILER_URL: envField.string({ context: 'server', access: 'secret', optional: true }), + DATABASE_URI: envField.string({ context: 'server', access: 'secret' }), ROOT_URL: envField.string({ context: 'server', access: 'secret', default: 'http://localhost:4321' }), diff --git a/flake.nix b/flake.nix index bd7d211..87aac01 100644 --- a/flake.nix +++ b/flake.nix @@ -44,6 +44,7 @@ UPLOAD_PATH = "./.data/uploads"; VIDEO_PATH = "./.data/videos"; + HOMEPAGE_TRAILER_URL = "http://localhost:4321/craftattack/video/out-final-final/embed"; TEAMSPEAK_LINK = "http://example.com"; DISCORD_LINK = "http://example.com"; diff --git a/src/actions/report.ts b/src/actions/report.ts index 0b3f002..5c370cd 100644 --- a/src/actions/report.ts +++ b/src/actions/report.ts @@ -55,7 +55,7 @@ export const report = { } let totalFilesSize = 0; - for (const file of (input.files ?? [])) { + for (const file of input.files ?? []) { const realType = mime.getType(file.name); if (realType != file.type) { throw new ActionError({ diff --git a/src/pages/index.astro b/src/pages/index.astro index 7eb9eb7..2a7b76e 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -4,8 +4,9 @@ import Countdown from '@app/website/index/Countdown.svelte'; import LiveStats from '@app/website/index/LiveStats.svelte'; import Craftattack from '@assets/img/craftattack.webp'; import Background from '@assets/img/background.webp'; -import { START_DATE } from 'astro:env/server'; +import { HOMEPAGE_TRAILER_URL, START_DATE } from 'astro:env/server'; import { getSetting, SettingKey } from '@util/settings'; +import { siteUrl } from '@util/url.ts'; import { db } from '@db/database.ts'; const signupEnabled = await getSetting(db, SettingKey.SignupEnabled, false); @@ -72,6 +73,39 @@ const information = [ + {HOMEPAGE_TRAILER_URL && ( +
+
+ + + + +
+

+ CraftAttack geht in die neunte Runde - und du kannst dabei sein! +

+

+ Die Teilnahme ist kostenlos. Am 27. Dezember 2026 startet CraftAttack 9 – die Anmeldung ist ab dem 1. + Dezember 2026 möglich. +

+

+ Alle Informationen zum Projekt und zur Teilnahme findest du unter hier. +

+
+
+
+ )} +
diff --git a/src/pages/video/[name]/embed.astro b/src/pages/video/[name]/embed.astro new file mode 100644 index 0000000..eecf5f9 --- /dev/null +++ b/src/pages/video/[name]/embed.astro @@ -0,0 +1,25 @@ +--- +import '@styles/websiteLayout.css'; +import BaseLayout from '@layouts/BaseLayout.astro'; +import VideoPlayer from '@app/website/video/VideoPlayer.svelte'; +import { getVideoMetadata, resolveVideo } from '@util/video.ts'; +import { siteUrl } from '@util/url.ts'; + +const { name } = Astro.params; + +const video = name ? await resolveVideo(name) : null; +if (!video) return new Response(null, { status: 404 }); + +const metadata = await getVideoMetadata(video); +const title = metadata?.title ?? video.name; +const streamUrl = siteUrl(`video/${encodeURIComponent(video.name)}/stream`); +const thumbnailUrl = siteUrl(`video/${encodeURIComponent(video.name)}/thumbnail.jpg`); +--- + + +
+
+ +
+
+