fix: pull env vars from dynamic
All checks were successful
create archive with lfs / tag (push) Successful in 8s
All checks were successful
create archive with lfs / tag (push) Successful in 8s
This commit is contained in:
parent
75dc37835c
commit
5d466eb196
@ -1,5 +1,5 @@
|
|||||||
import type { Cookies } from '@sveltejs/kit'
|
import type { Cookies } from '@sveltejs/kit'
|
||||||
import { WEBSITE_DATA_DIR } from '$env/static/private'
|
import { env } from '$env/dynamic/private'
|
||||||
import { existsSync, readFileSync } from 'fs'
|
import { existsSync, readFileSync } from 'fs'
|
||||||
import { writable } from 'svelte/store'
|
import { writable } from 'svelte/store'
|
||||||
|
|
||||||
@ -17,5 +17,5 @@ export const scopeCookies = (cookies: Cookies, path: string) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const visitCountFile = `${WEBSITE_DATA_DIR}/visitcount`
|
export const visitCountFile = `${env.WEBSITE_DATA_DIR}/visitcount`
|
||||||
export const visitCount = writable(parseInt(existsSync(visitCountFile) ? readFileSync(visitCountFile).toString() : '0'));
|
export const visitCount = writable(parseInt(existsSync(visitCountFile) ? readFileSync(visitCountFile).toString() : '0'));
|
@ -1,4 +1,4 @@
|
|||||||
import { GUESTBOOK_BASE_URL } from '$env/static/private'
|
import { env } from '$env/dynamic/private'
|
||||||
import { redirect, type Cookies } from '@sveltejs/kit'
|
import { redirect, type Cookies } from '@sveltejs/kit'
|
||||||
import auth from '$lib/guestbookAuth'
|
import auth from '$lib/guestbookAuth'
|
||||||
import { scopeCookies as _scopeCookies } from '$lib';
|
import { scopeCookies as _scopeCookies } from '$lib';
|
||||||
@ -90,7 +90,7 @@ export async function load({ url, fetch, cookies }) {
|
|||||||
}
|
}
|
||||||
// set content, make sure to trim it
|
// set content, make sure to trim it
|
||||||
postData.set('content', content.substring(0, 512).trim())
|
postData.set('content', content.substring(0, 512).trim())
|
||||||
respRaw = await fetch(GUESTBOOK_BASE_URL, { method: 'POST', body: postData })
|
respRaw = await fetch(env.GUESTBOOK_BASE_URL, { method: 'POST', body: postData })
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
scopedCookies.set("sendError", `${err.toString()} (is guestbook server running?)`)
|
scopedCookies.set("sendError", `${err.toString()} (is guestbook server running?)`)
|
||||||
redirect(303, auth.callbackUrl)
|
redirect(303, auth.callbackUrl)
|
||||||
@ -111,7 +111,7 @@ export async function load({ url, fetch, cookies }) {
|
|||||||
try {
|
try {
|
||||||
const count = 5
|
const count = 5
|
||||||
const offset = (data.page - 1) * count
|
const offset = (data.page - 1) * count
|
||||||
respRaw = await fetch(`${GUESTBOOK_BASE_URL}?offset=${offset}&count=${count}`)
|
respRaw = await fetch(`${env.GUESTBOOK_BASE_URL}?offset=${offset}&count=${count}`)
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
data.getError = `${err.toString()} (is guestbook server running?)`
|
data.getError = `${err.toString()} (is guestbook server running?)`
|
||||||
return data
|
return data
|
||||||
|
Loading…
Reference in New Issue
Block a user