mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Removing get client address for now and using adapter node because vercel breaks.
This commit is contained in:
parent
4dbc93f819
commit
9b24a5c095
5 changed files with 11 additions and 15 deletions
|
|
@ -1 +1 @@
|
||||||
22.1.0
|
20
|
||||||
|
|
@ -22,9 +22,6 @@
|
||||||
"site:update": "pnpm update -i -L",
|
"site:update": "pnpm update -i -L",
|
||||||
"test:unit": "vitest"
|
"test:unit": "vitest"
|
||||||
},
|
},
|
||||||
"engines": {
|
|
||||||
"node": "22.x"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@melt-ui/pp": "^0.3.2",
|
"@melt-ui/pp": "^0.3.2",
|
||||||
"@melt-ui/svelte": "^0.83.0",
|
"@melt-ui/svelte": "^0.83.0",
|
||||||
|
|
|
||||||
|
|
@ -22,19 +22,18 @@ const apiClient: Handle = async ({ event, resolve }) => {
|
||||||
const { api } = hc<ApiRoutes>('/', {
|
const { api } = hc<ApiRoutes>('/', {
|
||||||
fetch: event.fetch,
|
fetch: event.fetch,
|
||||||
headers: {
|
headers: {
|
||||||
'x-forwarded-for': event.getClientAddress(),
|
|
||||||
host: event.request.headers.get('host') || ''
|
host: event.request.headers.get('host') || ''
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* ----------------------------- Auth functions ----------------------------- */
|
/* ----------------------------- Auth functions ----------------------------- */
|
||||||
async function getAuthedUser() {
|
async function getAuthedUser() {
|
||||||
const { data } = await api.iam.user.$get().then(parseApiResponse)
|
const { data } = await api.user.me.$get().then(parseApiResponse)
|
||||||
return data && data.user;
|
return data && data.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getAuthedUserOrThrow() {
|
async function getAuthedUserOrThrow() {
|
||||||
const { data } = await api.iam.user.$get().then(parseApiResponse);
|
const { data } = await api.user.me.$get().then(parseApiResponse);
|
||||||
if (!data || !data.user) throw redirect(StatusCodes.TEMPORARY_REDIRECT, '/');
|
if (!data || !data.user) throw redirect(StatusCodes.TEMPORARY_REDIRECT, '/');
|
||||||
return data?.user;
|
return data?.user;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
// import { dev } from '$app/environment';
|
import { dev } from '$app/environment';
|
||||||
|
|
||||||
// // we don't need any JS on this page, though we'll load
|
// we don't need any JS on this page, though we'll load
|
||||||
// // it in dev so that we get hot module replacement...
|
// it in dev so that we get hot module replacement...
|
||||||
// export const csr = dev;
|
export const csr = dev;
|
||||||
|
|
||||||
// // since there's no dynamic data here, we can prerender
|
// since there's no dynamic data here, we can prerender
|
||||||
// // it so that it gets served as a static asset in prod
|
// it so that it gets served as a static asset in prod
|
||||||
// export const prerender = true;
|
export const prerender = true;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
import adapter from '@sveltejs/adapter-vercel';
|
import adapter from '@sveltejs/adapter-node';
|
||||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||||
import { preprocessMeltUI } from '@melt-ui/pp';
|
import { preprocessMeltUI } from '@melt-ui/pp';
|
||||||
import sequence from 'svelte-sequential-preprocessor';
|
import sequence from 'svelte-sequential-preprocessor';
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue