diff --git a/src/lib/components/admin/AdminSegmentedController.svelte b/src/lib/components/admin/AdminSegmentedController.svelte
index 90c74bf..698cc0e 100644
--- a/src/lib/components/admin/AdminSegmentedController.svelte
+++ b/src/lib/components/admin/AdminSegmentedController.svelte
@@ -14,7 +14,7 @@
const navItems: NavItem[] = [
{ value: 'dashboard', label: 'Dashboard', href: '/admin', icon: '📊' },
{ value: 'projects', label: 'Projects', href: '/admin/projects', icon: '💼' },
- { value: 'universe', label: 'Universe', href: '/admin/posts', icon: '🌟' },
+ { value: 'universe', label: 'Universe', href: '/admin/universe', icon: '🌟' },
{ value: 'media', label: 'Media', href: '/admin/media', icon: '🖼️' }
]
@@ -27,9 +27,9 @@
? 'dashboard'
: currentPath.startsWith('/admin/projects')
? 'projects'
- : currentPath.startsWith('/admin/posts')
- ? 'universe'
- : currentPath.startsWith('/admin/media')
+ : currentPath.startsWith('/admin/posts') || currentPath.startsWith('/admin/universe')
+ ? 'universe'
+ : currentPath.startsWith('/admin/media')
? 'media'
: ''
)
diff --git a/src/lib/server/admin/session.ts b/src/lib/server/admin/session.ts
index fd1f1a4..90230f6 100644
--- a/src/lib/server/admin/session.ts
+++ b/src/lib/server/admin/session.ts
@@ -112,7 +112,7 @@ export function readSessionToken(token: string | undefined): SessionUser | null
export function setSessionCookie(cookies: Cookies, user: SessionUser) {
const token = createSessionToken(user)
cookies.set(SESSION_COOKIE_NAME, token, {
- path: '/admin',
+ path: '/',
httpOnly: true,
secure: !dev,
sameSite: 'lax',
@@ -122,7 +122,7 @@ export function setSessionCookie(cookies: Cookies, user: SessionUser) {
export function clearSessionCookie(cookies: Cookies) {
cookies.delete(SESSION_COOKIE_NAME, {
- path: '/admin'
+ path: '/'
})
}
diff --git a/src/routes/admin/+layout.server.ts b/src/routes/admin/+layout.server.ts
index cb2aa05..9dd4686 100644
--- a/src/routes/admin/+layout.server.ts
+++ b/src/routes/admin/+layout.server.ts
@@ -1,6 +1,6 @@
import { redirect } from '@sveltejs/kit'
import type { LayoutServerLoad } from './$types'
-import { getSessionUser } from '$lib/server/admin/session'
+import { getSessionUser, setSessionCookie } from '$lib/server/admin/session'
const LOGIN_PATH = '/admin/login'
const DASHBOARD_PATH = '/admin'
@@ -13,6 +13,11 @@ export const load = (async (event) => {
const user = getSessionUser(event.cookies)
const pathname = event.url.pathname
+ if (user) {
+ // Refresh cookie with updated attributes (e.g., widened path)
+ setSessionCookie(event.cookies, user)
+ }
+
if (!user && !isLoginRoute(pathname)) {
throw redirect(303, LOGIN_PATH)
}
diff --git a/src/routes/admin/universe/+page.server.ts b/src/routes/admin/universe/+page.server.ts
new file mode 100644
index 0000000..ca9e962
--- /dev/null
+++ b/src/routes/admin/universe/+page.server.ts
@@ -0,0 +1 @@
+export { load } from '../posts/+page.server'
diff --git a/src/routes/admin/universe/+page.svelte b/src/routes/admin/universe/+page.svelte
new file mode 100644
index 0000000..86fccbd
--- /dev/null
+++ b/src/routes/admin/universe/+page.svelte
@@ -0,0 +1,9 @@
+
+
+