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
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:
@@ -1,24 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { _ } from "svelte-i18n";
|
||||
import { PUBLIC_URL } from "$env/dynamic/public";
|
||||
import { _ } from "svelte-i18n";
|
||||
import { env } from "$env/dynamic/public";
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
description: string;
|
||||
image?: string;
|
||||
}
|
||||
interface Props {
|
||||
title: string;
|
||||
description: string;
|
||||
image?: string;
|
||||
}
|
||||
|
||||
let {
|
||||
title,
|
||||
description,
|
||||
image = `${PUBLIC_URL || "http://localhost:3000"}/img/kamasutra.jpg`,
|
||||
}: Props = $props();
|
||||
let {
|
||||
title,
|
||||
description,
|
||||
image = `${env.PUBLIC_URL || "http://localhost:3000"}/img/kamasutra.jpg`,
|
||||
}: Props = $props();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>{$_("head.title", { values: { title } })}</title>
|
||||
<meta name="description" content={description} />
|
||||
<meta property="og:title" content={$_("head.title", { values: { title } })} />
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:image" content={image} />
|
||||
<title>{$_("head.title", { values: { title } })}</title>
|
||||
<meta name="description" content={description} />
|
||||
<meta
|
||||
property="og:title"
|
||||
content={$_("head.title", { values: { title } })}
|
||||
/>
|
||||
<meta property="og:description" content={description} />
|
||||
<meta property="og:image" content={image} />
|
||||
</svelte:head>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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";
|
||||
|
||||
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) => {
|
||||
const options: { globals?: { fetch: typeof globalThis.fetch } } = fetch
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
aggregate,
|
||||
} from "@directus/sdk";
|
||||
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";
|
||||
|
||||
// Helper to log API calls
|
||||
@@ -86,7 +86,7 @@ export async function register(
|
||||
const directus = getDirectusInstance(fetch);
|
||||
return directus.request(
|
||||
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,
|
||||
last_name: lastName,
|
||||
}),
|
||||
@@ -133,7 +133,7 @@ export async function requestPassword(email: string) {
|
||||
async () => {
|
||||
const directus = getDirectusInstance(fetch);
|
||||
return directus.request(
|
||||
passwordRequest(email, `${PUBLIC_URL || "http://localhost:3000"}/password/reset`),
|
||||
passwordRequest(email, `${env.PUBLIC_URL || "http://localhost:3000"}/password/reset`),
|
||||
);
|
||||
},
|
||||
{ email },
|
||||
@@ -224,7 +224,7 @@ export async function getFeaturedVideos(
|
||||
return loggedApiCall(
|
||||
"getFeaturedVideos",
|
||||
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);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch featured videos: ${response.statusText}`);
|
||||
@@ -273,7 +273,7 @@ export async function getFeaturedModels(
|
||||
return loggedApiCall(
|
||||
"getFeaturedModels",
|
||||
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);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch featured models: ${response.statusText}`);
|
||||
|
||||
Reference in New Issue
Block a user