v3: added opengraph support to the app, wrote README instructions incl. a Docker image

This commit is contained in:
khannurien
2026-03-26 19:55:48 +00:00
parent 0cb5a798c7
commit ca70bdc14b
26 changed files with 551 additions and 120 deletions

View File

@@ -2,12 +2,25 @@
// include type declarations from the package vite/client
/// <reference types="vite/client" />
const apiProtocol = import.meta.env.VITE_API_PROTOCOL || "http";
const serverHost = import.meta.env.VITE_SERVER_HOST || "localhost";
const serverPort = import.meta.env.VITE_SERVER_PORT || "8000";
// In dev (Vite dev server), the frontend and API run on different ports, so we
// need an absolute URL. VITE_API_* vars can override the defaults.
//
// In prod (same container), the frontend is served by the API server itself, so
// both share the same origin. We use relative URLs ("") so no build-time
// configuration is needed and the image works on any domain.
const apiHostname = import.meta.env.VITE_API_HOSTNAME;
export const API_URL = `${apiProtocol}://${serverHost}:${serverPort}`;
export const WS_URL = API_URL.replace(/^http/, "ws");
export const API_URL: string = apiHostname
? `${import.meta.env.VITE_API_PROTOCOL || "http"}://${apiHostname}:${
import.meta.env.VITE_API_PORT || "8000"
}`
: import.meta.env.DEV
? "http://localhost:8000"
: "";
export const WS_URL: string = API_URL
? API_URL.replace(/^http/, "ws")
: `${location.protocol.replace("http", "ws")}//${location.host}`;
export const DEFAULT_PAGE_SIZE = 20;
export const NOTIFICATIONS_PAGE_SIZE = 30;