From 2297cb3b692797fbaaf924782404cde201540cc4 Mon Sep 17 00:00:00 2001 From: lethdat Date: Mon, 5 Jan 2026 01:15:01 +0700 Subject: [PATCH] Refactor style handling and add head management for overview route --- src/index.tsx | 5 ++++- src/routes/index.ts | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 261cfe3..5e68d99 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -39,7 +39,7 @@ app.get("*", async (c) => { await auth.init(); await router.push(url.pathname); await router.isReady(); - let usedStyles = new Set(defaultNames); + let usedStyles = new Set(); Base.setLoadedStyleName = async (name: string) => usedStyles.add(name) return streamText(c, async (stream) => { c.header("Content-Type", "text/html; charset=utf-8"); @@ -53,6 +53,9 @@ app.get("*", async (c) => { await stream.write(``); await stream.write(''); await stream.write(buildBootstrapScript()); + if (usedStyles.size > 0) { + defaultNames.forEach(name => usedStyles.add(name)); + } await Promise.all(styleTags.filter(tag => usedStyles.has(tag.name.replace(/-(variables|style)$/, ""))).map(tag => stream.write(``))); await stream.write(``); await stream.pipe(appStream); diff --git a/src/routes/index.ts b/src/routes/index.ts index bc351b8..8d7e0e2 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -1,4 +1,5 @@ import { type ReactiveHead, type ResolvableValue } from "@unhead/vue"; +import { headSymbol } from '@unhead/vue' import { createMemoryHistory, createRouter, @@ -58,6 +59,13 @@ const routes: RouteData[] = [ path: "", name: "overview", component: () => import("./add/Add.vue"), + beforeEnter: (to, from, next) => { + const head = inject(headSymbol); + (head as any).push({ + title: 'Overview - Holistream', + }); + next(); + } }, { path: "video",