--- import { metaData, API_URL } from "../config"; import { Icon } from "astro-icon/components"; import { requireAuthHook } from "@/hooks/requireAuthHook"; import { padlockIconSvg, userIconSvg, externalLinkIconSvg } from "@/utils/navAssets"; import "@/assets/styles/nav.css"; const user = await requireAuthHook(Astro); const hostHeader = Astro.request?.headers?.get('host') || ''; const host = hostHeader.split(':')[0]; import { getSubsiteByHost } from '../utils/subsites.js'; import { getSubsiteByPath } from '../utils/subsites.js'; const isReq = getSubsiteByHost(host)?.short === 'req' || getSubsiteByPath(Astro.url.pathname)?.short === 'req'; // Nav is the standard site navigation — whitelabel logic belongs in SubNav const isLoggedIn = Boolean(user); const userDisplayName = user?.user ?? null; const isAdmin = user?.roles?.includes('admin') ?? false; const navItems = [ { label: "Home", href: "/" }, { label: "Radio", href: "/radio" }, { label: "Memes", href: "/memes" }, { label: "TRip", href: "/TRip", auth: true, icon: "pirate" }, { label: "Discord Logs", href: "/discord-logs", auth: true }, { label: "Lighting", href: "/lighting", auth: true, adminOnly: true }, { label: "Git", href: "https://kode.boatson.boats", icon: "external" }, { label: "Glances", href: "https://_gl.codey.horse", auth: true, icon: "external", adminOnly: true }, { label: "PSQL", href: "https://_pg.codey.horse", auth: true, icon: "external", adminOnly: true }, { label: "qBitTorrent", href: "https://_qb.codey.horse", auth: true, icon: "external", adminOnly: true }, { label: "RQ", href: "https://_rq.codey.horse", auth: true, icon: "external", adminOnly: true }, { label: "RI", href: "https://_r0.codey.horse", auth: true, icon: "external", adminOnly: true }, // { label: "Status", href: "https://status.boatson.boats", icon: "external" }, { label: "Login", href: "/login", guestOnly: true }, ...(isLoggedIn ? [{ label: "Logout", href: "#logout", onclick: "handleLogout()" }] : []), ]; const visibleNavItems = navItems.filter((item) => { if (item.auth && !isLoggedIn) { return false; } if (item.adminOnly && !isAdmin) { return false; } if (item.guestOnly && isLoggedIn) { return false; } return true; }); const currentPath = Astro.url.pathname; ---