fix: use env object from \$env/dynamic/public instead of named imports
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 5m13s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-04 17:19:26 +01:00
parent 1e69d0b158
commit de16b64255
3 changed files with 27 additions and 24 deletions

View File

@@ -1,24 +1,27 @@
<script lang="ts"> <script lang="ts">
import { _ } from "svelte-i18n"; import { _ } from "svelte-i18n";
import { PUBLIC_URL } from "$env/dynamic/public"; import { env } from "$env/dynamic/public";
interface Props { interface Props {
title: string; title: string;
description: string; description: string;
image?: string; image?: string;
} }
let { let {
title, title,
description, description,
image = `${PUBLIC_URL || "http://localhost:3000"}/img/kamasutra.jpg`, image = `${env.PUBLIC_URL || "http://localhost:3000"}/img/kamasutra.jpg`,
}: Props = $props(); }: Props = $props();
</script> </script>
<svelte:head> <svelte:head>
<title>{$_("head.title", { values: { title } })}</title> <title>{$_("head.title", { values: { title } })}</title>
<meta name="description" content={description} /> <meta name="description" content={description} />
<meta property="og:title" content={$_("head.title", { values: { title } })} /> <meta
<meta property="og:description" content={description} /> property="og:title"
<meta property="og:image" content={image} /> content={$_("head.title", { values: { title } })}
/>
<meta property="og:description" content={description} />
<meta property="og:image" content={image} />
</svelte:head> </svelte:head>

View File

@@ -1,8 +1,8 @@
import { authentication, createDirectus, rest } from "@directus/sdk"; import { authentication, createDirectus, rest } from "@directus/sdk";
import { PUBLIC_API_URL } from "$env/dynamic/public"; import { env } from "$env/dynamic/public";
import type { CurrentUser } from "./types"; import type { CurrentUser } from "./types";
export const directusApiUrl = PUBLIC_API_URL || "http://localhost:3000/api"; export const directusApiUrl = env.PUBLIC_API_URL || "http://localhost:3000/api";
export const getDirectusInstance = (fetch?: typeof globalThis.fetch) => { export const getDirectusInstance = (fetch?: typeof globalThis.fetch) => {
const options: { globals?: { fetch: typeof globalThis.fetch } } = fetch const options: { globals?: { fetch: typeof globalThis.fetch } } = fetch

View File

@@ -16,7 +16,7 @@ import {
aggregate, aggregate,
} from "@directus/sdk"; } from "@directus/sdk";
import type { Analytics, Article, Model, Recording, Stats, User, Video, VideoLikeStatus, VideoLikeResponse, VideoPlayResponse } from "$lib/types"; import type { Analytics, Article, Model, Recording, Stats, User, Video, VideoLikeStatus, VideoLikeResponse, VideoPlayResponse } from "$lib/types";
import { PUBLIC_URL } from "$env/dynamic/public"; import { env } from "$env/dynamic/public";
import { logger } from "$lib/logger"; import { logger } from "$lib/logger";
// Helper to log API calls // Helper to log API calls
@@ -86,7 +86,7 @@ export async function register(
const directus = getDirectusInstance(fetch); const directus = getDirectusInstance(fetch);
return directus.request( return directus.request(
registerUser(email, password, { registerUser(email, password, {
verification_url: `${PUBLIC_URL || "http://localhost:3000"}/signup/verify`, verification_url: `${env.PUBLIC_URL || "http://localhost:3000"}/signup/verify`,
first_name: firstName, first_name: firstName,
last_name: lastName, last_name: lastName,
}), }),
@@ -133,7 +133,7 @@ export async function requestPassword(email: string) {
async () => { async () => {
const directus = getDirectusInstance(fetch); const directus = getDirectusInstance(fetch);
return directus.request( return directus.request(
passwordRequest(email, `${PUBLIC_URL || "http://localhost:3000"}/password/reset`), passwordRequest(email, `${env.PUBLIC_URL || "http://localhost:3000"}/password/reset`),
); );
}, },
{ email }, { email },
@@ -224,7 +224,7 @@ export async function getFeaturedVideos(
return loggedApiCall( return loggedApiCall(
"getFeaturedVideos", "getFeaturedVideos",
async () => { async () => {
const url = `${PUBLIC_URL}/api/sexy/videos?featured=true&limit=${limit}`; const url = `${env.PUBLIC_URL}/api/sexy/videos?featured=true&limit=${limit}`;
const response = await fetchFn(url); const response = await fetchFn(url);
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to fetch featured videos: ${response.statusText}`); throw new Error(`Failed to fetch featured videos: ${response.statusText}`);
@@ -273,7 +273,7 @@ export async function getFeaturedModels(
return loggedApiCall( return loggedApiCall(
"getFeaturedModels", "getFeaturedModels",
async () => { async () => {
const url = `${PUBLIC_URL}/api/sexy/models?featured=true&limit=${limit}`; const url = `${env.PUBLIC_URL}/api/sexy/models?featured=true&limit=${limit}`;
const response = await fetchFn(url); const response = await fetchFn(url);
if (!response.ok) { if (!response.ok) {
throw new Error(`Failed to fetch featured models: ${response.statusText}`); throw new Error(`Failed to fetch featured models: ${response.statusText}`);