diff --git a/src/routes/(auth)/signin/+page.server.ts b/src/routes/(auth)/signin/+page.server.ts index cba15ba..f1ae936 100644 --- a/src/routes/(auth)/signin/+page.server.ts +++ b/src/routes/(auth)/signin/+page.server.ts @@ -5,8 +5,8 @@ import type { Actions } from './$types'; import { adjectives, animals, colors, uniqueNamesGenerator } from 'unique-names-generator'; import { error, redirect } from '@sveltejs/kit'; import type { PageServerLoad } from './$types'; -import { SECRET_PLUNK_API_KEY } from '$env/static/private'; -import { PUBLIC_APP_URL } from '$env/static/public'; +import { env as envPrivate } from '$env/dynamic/private'; +import { env as envPublic } from '$env/dynamic/public'; const ensureUser = async ({ email }: { email: string }) => { const existingUser = await db.query.user.findFirst({ where: eq(user.email, email) }); @@ -49,12 +49,12 @@ export const actions: Actions = { method: 'POST', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${SECRET_PLUNK_API_KEY}` + Authorization: `Bearer ${envPrivate.SECRET_PLUNK_API_KEY}` }, body: JSON.stringify({ to: email, subject: 'Sign in to Supso', - body: `Sign in: ${PUBLIC_APP_URL}/verify?token=${code.id}` + body: `Sign in: ${envPublic.PUBLIC_APP_URL}/verify?token=${code.id}` }) }); console.log(emailRequest); diff --git a/src/routes/(dashboard)/playground/+page.svelte b/src/routes/(dashboard)/playground/+page.svelte index 3cec525..dd275ac 100644 --- a/src/routes/(dashboard)/playground/+page.svelte +++ b/src/routes/(dashboard)/playground/+page.svelte @@ -10,7 +10,7 @@ import { codeToHtml } from 'shiki'; import dedent from 'dedent'; import { derived, writable } from 'svelte/store'; - import { PUBLIC_APP_URL } from '$env/static/public'; + import { env as envPublic } from '$env/dynamic/public'; import { CopyIcon, InfoIcon, ArrowUpRightIcon } from 'lucide-svelte'; export let data; @@ -50,7 +50,7 @@ ); export const execute = async () => { - await fetch(PUBLIC_APP_URL + '/api/log', { + await fetch(envPublic.PUBLICA_APP_URL + '/api/log', { method: 'POST', body: JSON.stringify({ projectId: $projectId, diff --git a/src/routes/api/log/+server.ts b/src/routes/api/log/+server.ts index 40f771f..b94d2b5 100644 --- a/src/routes/api/log/+server.ts +++ b/src/routes/api/log/+server.ts @@ -5,7 +5,7 @@ import { insertEventSchema, usersToProjects, event as eventScheme } from '$lib/d import { error } from '@sveltejs/kit'; import { UAParser } from 'ua-parser-js'; import { z } from 'zod'; -import { PUBLIC_APP_URL } from '$env/static/public'; +import { env as envPublic } from '$env/dynamic/public'; import { formatDate } from '$lib/format/date'; /** @@ -57,17 +57,20 @@ export const POST: RequestHandler = async ({ request, locals }) => { embeds: [ { title: `${result.emoji ? result.emoji + ' ' : ''}${result.event}`, - url: PUBLIC_APP_URL + `/events/${result.id}`, + url: envPublic.PUBLIC_APP_URL + `/events/${result.id}`, color: null, fields: [ { name: 'Project', - value: `[${project.name}](${PUBLIC_APP_URL + `/projects/${project.id}`})` + value: `[${project.name}](${ + envPublic.PUBLIC_APP_URL + `/projects/${project.id}` + })` }, { name: 'Channel', value: `[#${result.channel}](${ - PUBLIC_APP_URL + `/projects/${project.id}/events?channel=${result.channel}` + envPublic.PUBLIC_APP_URL + + `/projects/${project.id}/events?channel=${result.channel}` })` }, { diff --git a/src/routes/api/projects/[projectId]/rss/+server.ts b/src/routes/api/projects/[projectId]/rss/+server.ts index 5da1e93..1537755 100644 --- a/src/routes/api/projects/[projectId]/rss/+server.ts +++ b/src/routes/api/projects/[projectId]/rss/+server.ts @@ -4,7 +4,7 @@ import { db } from '$lib/db'; import { and, eq } from 'drizzle-orm'; import { usersToProjects } from '$lib/db/schema'; import { Feed } from 'feed'; -import { PUBLIC_APP_URL } from '$env/static/public'; +import { env as envPublic } from '$env/dynamic/public'; export const GET: RequestHandler = async ({ locals, params }) => { const { projectId } = params; @@ -38,7 +38,7 @@ export const GET: RequestHandler = async ({ locals, params }) => { description: `${project.name}: ${event.event} in ${event.channel}`, content: event.content ?? '', date: new Date(parseInt(event.createdAt ?? '')), - link: PUBLIC_APP_URL + '/events/' + event.id + link: envPublic.PUBLIC_APP_URL + '/events/' + event.id }); }); return new Response(feed.rss2(), { headers: { 'Content-Type': 'text/xml' } });