diff --git a/src/app.d.ts b/src/app.d.ts
index 8bdbf41..220f2a7 100644
--- a/src/app.d.ts
+++ b/src/app.d.ts
@@ -7,6 +7,7 @@ declare global {
// Locals must be an interface and not a type
interface Locals {
user: import("lucia").User | null;
+ isProxyUser: boolean;
session: import("lucia").Session | null;
}
}
diff --git a/src/hooks.server.ts b/src/hooks.server.ts
index 5561b08..69ccab1 100644
--- a/src/hooks.server.ts
+++ b/src/hooks.server.ts
@@ -1,3 +1,4 @@
+import { env } from "$env/dynamic/private";
import { auth } from "$lib/server/auth";
import type { Handle } from "@sveltejs/kit";
@@ -24,6 +25,11 @@ export const handle: Handle = async ({ event, resolve }) => {
...sessionCookie.attributes
});
}
+ const isProxyUser = (env.HEADER_AUTH_ENABLED ?? "false") == "true" &&
+ !!env.HEADER_USERNAME &&
+ !!event.request.headers.get(env.HEADER_USERNAME);
+
+ event.locals.isProxyUser = isProxyUser;
event.locals.user = user;
event.locals.session = session;
return resolve(event);
diff --git a/src/lib/components/navigation/NavBar.svelte b/src/lib/components/navigation/NavBar.svelte
index 23a0c27..a0cfe3a 100644
--- a/src/lib/components/navigation/NavBar.svelte
+++ b/src/lib/components/navigation/NavBar.svelte
@@ -10,9 +10,10 @@
interface Props {
navItems: NavItem[];
user: User | null;
+ isProxyUser: boolean;
}
- let { navItems, user }: Props = $props();
+ let { navItems, user, isProxyUser }: Props = $props();
const drawerStore = getDrawerStore();
const drawerSettings: DrawerSettings = {
@@ -61,6 +62,6 @@
{/if}
{#snippet trail()}
-
+
{/snippet}
diff --git a/src/lib/components/navigation/NavMenu/NavMenu.svelte b/src/lib/components/navigation/NavMenu/NavMenu.svelte
index f491569..9860709 100644
--- a/src/lib/components/navigation/NavMenu/NavMenu.svelte
+++ b/src/lib/components/navigation/NavMenu/NavMenu.svelte
@@ -8,9 +8,10 @@
interface Props {
user: User | null;
+ isProxyUser: boolean;
}
- let { user }: Props = $props();
+ let { user, isProxyUser }: Props = $props();
const menuSettings: PopupSettings = {
event: "click",
@@ -43,20 +44,21 @@
-
-
-
-
-
+ {#if !isProxyUser}
+
+
+
+
+ {/if}
diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts
index e9fbdb9..9903f7a 100644
--- a/src/routes/+layout.server.ts
+++ b/src/routes/+layout.server.ts
@@ -1,5 +1,5 @@
import type { LayoutServerLoad } from "./$types";
export const load = (async ({ locals }) => {
- return { user: locals.user };
+ return { user: locals.user, isProxyUser: locals.isProxyUser };
}) satisfies LayoutServerLoad;
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index bcb00cd..5f49eb6 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -98,7 +98,7 @@
{#if showNavigationLoadingBar}
{/if}
-
+
diff --git a/src/routes/account/+page.server.ts b/src/routes/account/+page.server.ts
index ff22700..75acba9 100644
--- a/src/routes/account/+page.server.ts
+++ b/src/routes/account/+page.server.ts
@@ -1,4 +1,3 @@
-import { env } from "$env/dynamic/private";
import { auth } from "$lib/server/auth";
import { client } from "$lib/server/prisma";
import { getResetPasswordSchema } from "$lib/validations";
@@ -9,20 +8,15 @@ import type { PrismaClientKnownRequestError } from "@prisma/client/runtime/libra
import { createImage, tryDeleteImage } from "$lib/server/image-util";
import { LegacyScrypt } from "lucia";
-export const load: PageServerLoad = async ({ locals, request }) => {
+export const load: PageServerLoad = async ({ locals }) => {
const user = locals.user;
if (!user) {
redirect(302, `/login?ref=/account`);
}
- const isProxyUser =
- (env.HEADER_AUTH_ENABLED ?? "false") == "true" &&
- !!env.HEADER_USERNAME &&
- !!request.headers.get(env.HEADER_USERNAME);
-
return {
user,
- isProxyUser
+ isProxyUser: locals.isProxyUser
};
};