Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

perf(docs): optimize landing page rendering

t8y2f3ffdcc27d46
diff --git a/docs/app/(root)/layout.tsx b/docs/app/(root)/layout.tsx
index b21ae05a41..edb8161a54 100644
--- a/docs/app/(root)/layout.tsx
+++ b/docs/app/(root)/layout.tsx
@@ -8,8 +8,8 @@ export const metadata: Metadata = {
description: DEFAULT_DESCRIPTION,
metadataBase: new URL(SITE_URL),
icons: {
- icon: "/favicon.png",
- shortcut: "/favicon.png",
+ icon: "/favicon-64.png",
+ shortcut: "/favicon-64.png",
apple: "/logo.png",
},
openGraph: {
diff --git a/docs/app/[lang]/databases/page.tsx b/docs/app/[lang]/databases/page.tsx
index f43ec426c5..16155f34c0 100644
--- a/docs/app/[lang]/databases/page.tsx
+++ b/docs/app/[lang]/databases/page.tsx
@@ -66,6 +66,11 @@ export default async function DatabasesPage({ params }: { params: Promise<{ lang
<ExpandableDatabaseGrid lang={l}>
{databaseSupport.map((db) => {
const isCta = "href" in db && db.href;
+ const nameSizeClass = db.name.length >= 14
+ ? "text-[11px] tracking-[-0.035em] max-[760px]:text-[9px]"
+ : db.name.length >= 11
+ ? "text-xs tracking-[-0.015em] max-[760px]:text-[10px]"
+ : "text-sm max-[760px]:text-[11px]";
const CardTag = isCta ? "a" : "div";
return (
<CardTag
@@ -82,7 +87,7 @@ export default async function DatabasesPage({ params }: { params: Promise<{ lang
<img src={db.icon} alt="" width={38} height={38} loading="lazy" decoding="async" className="block w-[38px] h-[38px] object-contain max-[760px]:size-7" />
)}
</div>
- <strong className={`text-sm font-[650] leading-[1.2] text-center max-[760px]:text-[11px] ${isCta ? "text-landing-blue" : "text-[color-mix(in_srgb,var(--color-landing-ink)_92%,var(--color-landing-muted))]"}`}>{db.name}</strong>
+ <strong className={`block w-full min-w-0 px-1 font-[650] leading-[1.2] text-center [overflow-wrap:anywhere] min-[761px]:whitespace-nowrap ${nameSizeClass} ${isCta ? "text-landing-blue" : "text-[color-mix(in_srgb,var(--color-landing-ink)_92%,var(--color-landing-muted))]"}`}>{db.name}</strong>
</CardTag>
);
})}
diff --git a/docs/app/[lang]/docs/layout.tsx b/docs/app/[lang]/docs/layout.tsx
index 9ff935331e..0ab67c5fff 100644
--- a/docs/app/[lang]/docs/layout.tsx
+++ b/docs/app/[lang]/docs/layout.tsx
@@ -1,31 +1,43 @@
import type { ReactNode } from "react";
import { DocsLayout } from "fumadocs-ui/layouts/docs";
+import { RootProvider } from "fumadocs-ui/provider/next";
import { DocsSidebarFooter, DocsSidebarLanguageButton } from "@/components/DocsSidebarFooter";
+import { StaticSearchDialog } from "@/components/StaticSearchDialog";
+import { i18nUI } from "@/lib/i18n";
import { source } from "@/lib/source";
export default async function Layout({ params, children }: { params: Promise<{ lang: string }>; children: ReactNode }) {
const { lang } = await params;
+ const locale = lang === "cn" ? "cn" : "en";
return (
- <DocsLayout
- tree={source.getPageTree(lang)}
- nav={{
- title: (
- <div className="flex items-center gap-2">
- <img src="/logo.png" alt="" aria-hidden="true" width={24} height={24} />
- <span className="font-semibold">DBX</span>
- </div>
- ),
- children: <DocsSidebarLanguageButton />,
- }}
- i18n={false}
- themeSwitch={{ enabled: false }}
- sidebar={{
- defaultOpenLevel: 1,
- footer: <DocsSidebarFooter key="docs-sidebar-footer" />,
+ <RootProvider
+ i18n={i18nUI.provider(locale)}
+ search={{
+ SearchDialog: StaticSearchDialog,
}}
+ theme={{ defaultTheme: "system", enableSystem: true }}
>
- {children}
- </DocsLayout>
+ <DocsLayout
+ tree={source.getPageTree(locale)}
+ nav={{
+ title: (
+ <div className="flex items-center gap-2">
+ <img src="/logo-64.png" alt="" aria-hidden="true" width={24} height={24} />
+ <span className="font-semibold">DBX</span>
+ </div>
+ ),
+ children: <DocsSidebarLanguageButton />,
+ }}
+ i18n={false}
+ themeSwitch={{ enabled: false }}
+ sidebar={{
+ defaultOpenLevel: 1,
+ footer: <DocsSidebarFooter key="docs-sidebar-footer" />,
+ }}
+ >
+ {children}
+ </DocsLayout>
+ </RootProvider>
);
}
diff --git a/docs/app/[lang]/layout.tsx b/docs/app/[lang]/layout.tsx
index f05724e22c..a9e0fe0de7 100644
--- a/docs/app/[lang]/layout.tsx
+++ b/docs/app/[lang]/layout.tsx
@@ -1,9 +1,6 @@
import "../global.css";
import type { ReactNode } from "react";
import type { Metadata, Viewport } from "next";
-import { RootProvider } from "fumadocs-ui/provider/next";
-import { StaticSearchDialog } from "@/components/StaticSearchDialog";
-import { i18nUI } from "@/lib/i18n";
import { buildMetadata, DEFAULT_DESCRIPTION, getHtmlLang, SITE_NAME, SITE_URL } from "@/lib/metadata";
import { buildSiteStructuredData } from "@/lib/structuredData";
@@ -40,8 +37,8 @@ export async function generateMetadata({ params }: { params: Promise<{ lang: str
},
metadataBase: new URL(SITE_URL),
icons: {
- icon: "/favicon.png",
- shortcut: "/favicon.png",
+ icon: "/favicon-64.png",
+ shortcut: "/favicon-64.png",
apple: "/logo.png",
},
robots: { index: true, follow: true },
@@ -75,17 +72,7 @@ export default async function LangLayout({ params, children }: { params: Promise
<script key={structuredData["@id"]} type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }} />
))}
</head>
- <body className="flex min-h-screen flex-col">
- <RootProvider
- i18n={i18nUI.provider(locale)}
- search={{
- SearchDialog: StaticSearchDialog,
- }}
- theme={{ defaultTheme: "system", enableSystem: true }}
- >
- {children}
- </RootProvider>
- </body>
+ <body className="flex min-h-screen flex-col">{children}</body>
</html>
);
}
diff --git a/docs/app/[lang]/page.tsx b/docs/app/[lang]/page.tsx
index b6652172db..e674abb508 100644
--- a/docs/app/[lang]/page.tsx
+++ b/docs/app/[lang]/page.tsx
@@ -465,7 +465,7 @@ export default async function LandingPage({ params }: { params: Promise<{ lang:
<h2 className="m-0 text-[25px] font-[720] text-landing-ink">{t.docsStart}</h2>
<p className="mt-2 text-landing-muted text-sm leading-[1.65]">{t.docsStartDesc}</p>
</div>
- <Link href={`/${l}/docs/getting-started`} className="landing-inline-link flex shrink-0 items-center gap-[7px] text-sm font-[650] max-[760px]:mt-4" target="_blank">
+ <Link href={`/${l}/docs/getting-started`} prefetch={false} className="landing-inline-link flex shrink-0 items-center gap-[7px] text-sm font-[650] max-[760px]:mt-4" target="_blank">
{t.readDocs}
<ArrowRight size={15} />
</Link>
@@ -479,7 +479,7 @@ export default async function LandingPage({ params }: { params: Promise<{ lang:
</div>
<div className="landing-workflow-grid grid grid-cols-4 rounded-[10px] overflow-hidden max-[1040px]:grid-cols-2 max-[760px]:grid-cols-2 max-[360px]:grid-cols-1">
{workflowItems.map((item, i) => (
- <Link key={item.title} href={item.href} className={`landing-workflow-card min-h-[250px] p-6 border-r border-r-landing-line max-[760px]:min-h-0 max-[760px]:p-[18px] ${i === workflowItems.length - 1 ? "border-r-0" : ""}`} target="_blank" data-stagger>
+ <Link key={item.title} href={item.href} prefetch={false} className={`landing-workflow-card min-h-[250px] p-6 border-r border-r-landing-line max-[760px]:min-h-0 max-[760px]:p-[18px] ${i === workflowItems.length - 1 ? "border-r-0" : ""}`} target="_blank" data-stagger>
<item.icon size={20} className="text-landing-blue" />
<h3 className="mt-[18px] text-base font-bold">{item.title}</h3>
<p className="mt-2.5 text-landing-muted text-[13px] leading-[1.62]">{item.desc}</p>
@@ -498,7 +498,7 @@ export default async function LandingPage({ params }: { params: Promise<{ lang:
<h2 className="m-0 text-[25px] font-[720] text-landing-ink">{t.supportTitle}</h2>
<div className="flex items-center justify-end gap-5 justify-self-end max-w-[760px] text-right max-[760px]:block max-[760px]:max-w-none max-[760px]:text-left">
<p className="m-0 text-landing-muted text-sm leading-[1.65]">{t.supportDesc}</p>
- <Link href={`/${l}/databases`} className="landing-inline-link inline-flex shrink-0 items-center gap-[7px] text-sm font-[650] max-[760px]:mt-3">
+ <Link href={`/${l}/databases`} prefetch={false} className="landing-inline-link inline-flex shrink-0 items-center gap-[7px] text-sm font-[650] max-[760px]:mt-3">
{t.supportLink}
<ArrowRight size={15} />
</Link>
@@ -507,6 +507,11 @@ export default async function LandingPage({ params }: { params: Promise<{ lang:
<ExpandableDatabaseGrid lang={l}>
{databaseSupport.map((db) => {
const isCta = "href" in db && db.href;
+ const nameSizeClass = db.name.length >= 14
+ ? "text-[11px] tracking-[-0.035em] max-[760px]:text-[9px]"
+ : db.name.length >= 11
+ ? "text-xs tracking-[-0.015em] max-[760px]:text-[10px]"
+ : "text-sm max-[760px]:text-[11px]";
const CardTag = isCta ? "a" : "div";
return (
<CardTag
@@ -523,7 +528,7 @@ export default async function LandingPage({ params }: { params: Promise<{ lang:
<img src={db.icon} alt="" width={38} height={38} loading="lazy" decoding="async" className="block w-[38px] h-[38px] object-contain max-[760px]:size-7" />
)}
</div>
- <strong className={`text-sm font-[650] leading-[1.2] text-center max-[760px]:text-[11px] ${isCta ? "text-landing-blue" : "text-[color-mix(in_srgb,var(--color-landing-ink)_92%,var(--color-landing-muted))]"}`}>{db.name}</strong>
+ <strong className={`block w-full min-w-0 px-1 font-[650] leading-[1.2] text-center [overflow-wrap:anywhere] min-[761px]:whitespace-nowrap ${nameSizeClass} ${isCta ? "text-landing-blue" : "text-[color-mix(in_srgb,var(--color-landing-ink)_92%,var(--color-landing-muted))]"}`}>{db.name}</strong>
</CardTag>
);
})}
@@ -597,7 +602,7 @@ export default async function LandingPage({ params }: { params: Promise<{ lang:
<Link href="https://github.com/t8y2/dbx/releases/latest" target="_blank" className="landing-final-link inline-flex items-center justify-center min-h-[42px] rounded-[7px] px-[15px] text-sm font-[650]">
{t.release}
</Link>
- <Link href={`/${l}/docs/getting-started#docker`} target="_blank" className="landing-final-link inline-flex items-center justify-center min-h-[42px] rounded-[7px] px-[15px] text-sm font-[650]">
+ <Link href={`/${l}/docs/getting-started#docker`} prefetch={false} target="_blank" className="landing-final-link inline-flex items-center justify-center min-h-[42px] rounded-[7px] px-[15px] text-sm font-[650]">
{t.docker}
</Link>
</div>
diff --git a/docs/app/global.css b/docs/app/global.css
index 59c9662f81..7d22b994b3 100644
--- a/docs/app/global.css
+++ b/docs/app/global.css
@@ -82,6 +82,12 @@ body {
text-rendering: optimizeLegibility;
}
+.landing,
+.landing :where(h1, h2, h3, h4, p, li, span, strong, em, code) {
+ -webkit-user-select: text;
+ user-select: text;
+}
+
a,
button {
-webkit-tap-highlight-color: transparent;
@@ -591,6 +597,7 @@ a {
mix-blend-mode: screen;
pointer-events: none;
transform: translateX(-50%);
+ animation: landing-spotlight-enter 1.1s cubic-bezier(0.16, 1, 0.3, 1) both;
z-index: -1;
}
@@ -742,6 +749,7 @@ a {
0 38px 110px rgba(0, 0, 0, 0.5),
0 0 80px rgba(82, 213, 255, 0.1),
0 0 0 1px rgba(255, 255, 255, 0.03) inset;
+ animation: landing-product-enter 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.18s both;
transform-style: preserve-3d;
transition:
box-shadow 0.24s ease,
@@ -782,12 +790,7 @@ a {
}
.landing-product-slide {
- opacity: 0;
- transition: opacity 0.45s ease;
-}
-
-.landing-product-slide[data-active="true"] {
- opacity: 1;
+ animation: landing-product-slide-enter 0.45s ease both;
}
.landing-product-dots {
@@ -988,6 +991,24 @@ a {
margin-top: 3px;
}
+.landing-contributor-row {
+ display: contents;
+}
+
+@media (min-width: 1180px) {
+ .landing-contributor-grid {
+ flex-direction: column;
+ flex-wrap: nowrap;
+ align-items: center;
+ }
+
+ .landing-contributor-row {
+ display: flex;
+ gap: 10px;
+ justify-content: center;
+ }
+}
+
.landing-contributor-avatar {
display: block;
position: relative;
@@ -1043,7 +1064,8 @@ a {
transform 0.18s ease;
}
-.landing-contributor-tooltip.is-visible {
+.landing-contributor-avatar:hover .landing-contributor-tooltip,
+.landing-contributor-avatar:focus-visible .landing-contributor-tooltip {
opacity: 1;
transform: translateX(-50%) translateY(0);
}
@@ -1831,6 +1853,33 @@ a {
}
}
+@keyframes landing-spotlight-enter {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+@keyframes landing-product-enter {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+@keyframes landing-product-slide-enter {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
@keyframes landing-grid-drift {
from {
background-position: 0 0;
diff --git a/docs/components/aceternity/HeroProductStage.tsx b/docs/components/aceternity/HeroProductStage.tsx
index bac4a043d0..c0a2105c5c 100644
--- a/docs/components/aceternity/HeroProductStage.tsx
+++ b/docs/components/aceternity/HeroProductStage.tsx
@@ -1,26 +1,35 @@
"use client";
-import { motion } from "motion/react";
-import { useEffect, useState } from "react";
+import { useState } from "react";
+
+const productImageSizes = "(max-width: 760px) calc(100vw - 36px), (max-width: 1040px) calc(100vw - 56px), 1180px";
const productSlides = [
{
src: "/screenshot-light.png",
+ webpSrc: "/screenshots/dbx-light-1280.webp",
+ webpSrcSet: "/screenshots/dbx-light-768.webp 768w, /screenshots/dbx-light-1280.webp 1280w, /screenshots/dbx-light-2560.webp 2560w",
alt: "DBX main window light theme",
label: "Light",
},
{
src: "/screenshot-dark.png",
+ webpSrc: "/screenshots/dbx-dark-1280.webp",
+ webpSrcSet: "/screenshots/dbx-dark-768.webp 768w, /screenshots/dbx-dark-1280.webp 1280w, /screenshots/dbx-dark-2560.webp 2560w",
alt: "DBX main window dark theme",
label: "Dark",
},
{
src: "/screenshot-er.png",
+ webpSrc: "/screenshots/dbx-er-1280.webp",
+ webpSrcSet: "/screenshots/dbx-er-768.webp 768w, /screenshots/dbx-er-1280.webp 1280w, /screenshots/dbx-er-2560.webp 2560w",
alt: "DBX ER diagram",
label: "ER Diagram",
},
{
src: "/screenshot-grid.png",
+ webpSrc: "/screenshots/dbx-grid-1280.webp",
+ webpSrcSet: "/screenshots/dbx-grid-768.webp 768w, /screenshots/dbx-grid-1280.webp 1280w, /screenshots/dbx-grid-2560.webp 2560w",
alt: "DBX data grid",
label: "Data Grid",
},
@@ -29,44 +38,41 @@ const productSlides = [
export function HeroProductStage() {
const [activeSlide, setActiveSlide] = useState(0);
- useEffect(() => {
- const timer = window.setInterval(() => {
- setActiveSlide((current) => (current + 1) % productSlides.length);
- }, 4200);
+ const preloadSlide = (index: number) => {
+ if (index === activeSlide) return;
+ const image = new Image();
+ image.srcset = productSlides[index].webpSrcSet;
+ image.sizes = productImageSizes;
+ image.src = productSlides[index].webpSrc;
+ };
- return () => window.clearInterval(timer);
- }, []);
+ const slide = productSlides[activeSlide];
return (
- <motion.div
+ <div
className="landing-product relative w-full mt-16 mb-12 overflow-hidden rounded-2xl max-[1040px]:max-w-[900px] max-[1040px]:mt-14 max-[760px]:mt-10 max-[760px]:mb-7 max-[760px]:rounded-xl"
- initial={{ opacity: 0, y: 36, scale: 0.985 }}
- animate={{ opacity: 1, y: 0, scale: 1 }}
- transition={{ duration: 0.9, delay: 0.18, ease: [0.16, 1, 0.3, 1] }}
>
<div className="relative aspect-[16/10] overflow-hidden">
- {productSlides.map((slide, index) => (
+ <picture key={slide.src}>
+ <source type="image/webp" srcSet={slide.webpSrcSet} sizes={productImageSizes} />
<img
alt={slide.alt}
- aria-hidden={index !== activeSlide}
className="landing-product-slide absolute inset-0 z-[1] w-full h-full object-cover object-left-top"
- data-active={index === activeSlide}
decoding="async"
- fetchPriority={index === 0 ? "high" : "auto"}
- key={slide.src}
- loading={index === 0 ? "eager" : "lazy"}
- sizes="(max-width: 760px) calc(100vw - 36px), (max-width: 1040px) calc(100vw - 56px), 1180px"
+ fetchPriority={activeSlide === 0 ? "high" : "auto"}
+ loading={activeSlide === 0 ? "eager" : "lazy"}
+ sizes={productImageSizes}
src={slide.src}
/>
- ))}
+ </picture>
</div>
<div className="landing-product-dots absolute right-[18px] bottom-4 z-[5] flex items-center rounded-full p-1 max-[760px]:right-2 max-[760px]:bottom-2" aria-label="DBX product screenshots">
{productSlides.map((slide, index) => (
- <button aria-current={index === activeSlide} aria-label={`Show ${slide.label} screenshot`} key={slide.src} onClick={() => setActiveSlide(index)} title={slide.label} type="button" className="landing-product-dot block size-8 border-0 rounded-full p-0 cursor-pointer">
+ <button aria-current={index === activeSlide} aria-label={`Show ${slide.label} screenshot`} key={slide.src} onClick={() => setActiveSlide(index)} onFocus={() => preloadSlide(index)} onPointerEnter={() => preloadSlide(index)} title={slide.label} type="button" className="landing-product-dot block size-8 border-0 rounded-full p-0 cursor-pointer">
<span>{slide.label}</span>
</button>
))}
</div>
- </motion.div>
+ </div>
);
}
diff --git a/docs/components/aceternity/InfiniteMovingCards.tsx b/docs/components/aceternity/InfiniteMovingCards.tsx
index 21178049c7..451d8faba2 100644
--- a/docs/components/aceternity/InfiniteMovingCards.tsx
+++ b/docs/components/aceternity/InfiniteMovingCards.tsx
@@ -1,5 +1,3 @@
-"use client";
-
type Testimonial = {
name: string;
role: string;
@@ -17,7 +15,7 @@ export function InfiniteMovingCards({ items, direction = "left", speed = "normal
const repeatedItems = [...items, ...items];
return (
- <div className="landing-testimonial-marquee flex overflow-hidden select-none" data-direction={direction} data-speed={speed} aria-label="Testimonials" tabIndex={0}>
+ <div className="landing-testimonial-marquee flex overflow-hidden" data-direction={direction} data-speed={speed} aria-label="Testimonials" tabIndex={0}>
<div className="landing-testimonial-track flex w-max min-w-full gap-3.5 px-[7px]">
{repeatedItems.map((item, index) => (
<figure aria-hidden={index >= items.length} className="landing-testimonial-card flex-[0_0_340px] min-h-[188px] rounded-[9px] m-0 p-[22px] max-[760px]:flex-[0_0_286px] max-[760px]:min-h-[210px] max-[760px]:p-[18px]" key={`${item.name}-${index}`}>
diff --git a/docs/components/aceternity/Spotlight.tsx b/docs/components/aceternity/Spotlight.tsx
index 4eb1f3c343..d148752e38 100644
--- a/docs/components/aceternity/Spotlight.tsx
+++ b/docs/components/aceternity/Spotlight.tsx
@@ -1,11 +1,7 @@
-"use client";
-
-import { motion } from "motion/react";
-
type SpotlightProps = {
className?: string;
};
export function Spotlight({ className = "" }: SpotlightProps) {
- return <motion.div aria-hidden="true" className={`aceternity-spotlight ${className}`} initial={{ opacity: 0, scale: 0.96 }} animate={{ opacity: 1, scale: 1 }} transition={{ duration: 1.1, ease: [0.16, 1, 0.3, 1] }} />;
+ return <div aria-hidden="true" className={`aceternity-spotlight ${className}`} />;
}
diff --git a/docs/components/contributors/ContributorsExperience.tsx b/docs/components/contributors/ContributorsExperience.tsx
index bc1f969d9d..f79360bbf4 100644
--- a/docs/components/contributors/ContributorsExperience.tsx
+++ b/docs/components/contributors/ContributorsExperience.tsx
@@ -253,7 +253,7 @@ export function ContributorsExperience({ data, lang }: { data: ContributorActivi
<div className={styles.heroCertificate}>
<div className={styles.certificatePreview}>
- <div className={styles.previewTop}><span><img src="/logo.png" alt="" aria-hidden="true" width={28} height={28} />DBX</span><ShieldCheck size={18} /></div>
+ <div className={styles.previewTop}><span><img src="/logo-64.png" alt="" aria-hidden="true" width={28} height={28} />DBX</span><ShieldCheck size={18} /></div>
<small>{text.certificate}</small>
<strong>@{verifiedContributor?.login ?? "YOUR_NAME"}</strong>
<p>{text.certificateBody}</p>
@@ -297,7 +297,7 @@ export function ContributorsExperience({ data, lang }: { data: ContributorActivi
<div className={styles.modalBackdrop} role="presentation" onMouseDown={(event) => { if (event.target === event.currentTarget) setCertificateOpen(false); }}>
<section className={styles.modal} role="dialog" aria-modal="true" aria-label={text.certificate}>
<div className={styles.fullCertificate}>
- <div className={styles.previewTop}><span><img src="/logo.png" alt="" aria-hidden="true" width={30} height={30} />DBX · OPEN SOURCE DATABASE TOOL</span><ShieldCheck size={20} /></div>
+ <div className={styles.previewTop}><span><img src="/logo-64.png" alt="" aria-hidden="true" width={30} height={30} />DBX · OPEN SOURCE DATABASE TOOL</span><ShieldCheck size={20} /></div>
<span className={styles.verifiedText}>{text.verified}</span>
<small>{text.certificate}</small>
<em>{text.awardedTo}</em>
diff --git a/docs/components/landing/ContributorsWall.tsx b/docs/components/landing/ContributorsWall.tsx
index c8a3ff0a62..fc2d0d3fe6 100644
--- a/docs/components/landing/ContributorsWall.tsx
+++ b/docs/components/landing/ContributorsWall.tsx
@@ -1,12 +1,10 @@
-"use client";
-
-import { useState } from "react";
import Link from "next/link";
-import { dedupeContributors, type Contributor } from "@/lib/contributors";
+import { contributorAvatarUrl, dedupeContributors, type Contributor } from "@/lib/contributors";
-function ContributorAvatar({ c }: { c: Contributor }) {
- const [hovered, setHovered] = useState(false);
+const landingContributorLimit = 72;
+const landingContributorRowSizes = [12, 16, 16, 16, 12] as const;
+function ContributorAvatar({ c }: { c: Contributor }) {
return (
<a
href={c.html_url}
@@ -14,18 +12,17 @@ function ContributorAvatar({ c }: { c: Contributor }) {
rel="noopener noreferrer"
className="landing-contributor-avatar"
data-stagger
- onMouseEnter={() => setHovered(true)}
- onMouseLeave={() => setHovered(false)}
>
<img
- src={c.avatar_url}
+ src={contributorAvatarUrl(c.avatar_url)}
alt={c.login}
width={64}
height={64}
loading="lazy"
+ decoding="async"
className="block w-full h-full object-cover"
/>
- <span className={`landing-contributor-tooltip${hovered ? " is-visible" : ""}`}>
+ <span className="landing-contributor-tooltip">
<span className="landing-contributor-tooltip-name">{c.login}</span>
<span className="landing-contributor-tooltip-count">{c.contributions} contributions</span>
</span>
@@ -35,6 +32,13 @@ function ContributorAvatar({ c }: { c: Contributor }) {
export function ContributorsWallContent({ contributors, title, desc, lang }: { contributors: Contributor[]; title: string; desc: string; lang: "en" | "cn" }) {
const uniqueContributors = dedupeContributors(contributors);
+ const visibleContributors = uniqueContributors.slice(0, landingContributorLimit);
+ let contributorOffset = 0;
+ const contributorRows = landingContributorRowSizes.map((rowSize) => {
+ const row = visibleContributors.slice(contributorOffset, contributorOffset + rowSize);
+ contributorOffset += rowSize;
+ return row;
+ });
if (uniqueContributors.length === 0) return null;
return (
@@ -43,18 +47,22 @@ export function ContributorsWallContent({ contributors, title, desc, lang }: { c
<h2 className="m-0 text-[25px] font-[720] text-landing-ink">{title}</h2>
<p className="mt-2 max-w-[650px] text-landing-muted text-sm leading-[1.65] justify-self-end text-right max-[760px]:max-w-none max-[760px]:text-left">
{desc}{" "}
- <Link href={`/${lang}/contributors`} className="landing-inline-link inline-flex items-center gap-[5px]">
+ <Link href={`/${lang}/contributors`} prefetch={false} className="landing-inline-link inline-flex items-center gap-[5px]">
{lang === "cn" ? `查看 ${uniqueContributors.length}+ 位贡献者` : `Explore ${uniqueContributors.length}+ contributors`}
</Link>
<span className="mx-1.5 text-landing-muted" aria-hidden="true">·</span>
- <Link href={`/${lang}/contributors`} className="landing-inline-link inline-flex items-center gap-[5px]">
+ <Link href={`/${lang}/contributors`} prefetch={false} className="landing-inline-link inline-flex items-center gap-[5px]">
{lang === "cn" ? "下载贡献者证书" : "Download contributor certificate"}
</Link>
</p>
</div>
<div className="landing-contributor-grid">
- {uniqueContributors.map((c) => (
- <ContributorAvatar key={c.login.toLowerCase()} c={c} />
+ {contributorRows.map((row, rowIndex) => (
+ <div className="landing-contributor-row" key={rowIndex}>
+ {row.map((c) => (
+ <ContributorAvatar key={c.login.toLowerCase()} c={c} />
+ ))}
+ </div>
))}
</div>
</>
diff --git a/docs/components/landing/LandingFooter.tsx b/docs/components/landing/LandingFooter.tsx
index 0c3e4fec85..65cb41e6c2 100644
--- a/docs/components/landing/LandingFooter.tsx
+++ b/docs/components/landing/LandingFooter.tsx
@@ -27,8 +27,8 @@ export function LandingFooter({ lang }: { lang: "en" | "cn" }) {
<div className="max-w-[1180px] mx-auto px-7 py-7 max-[760px]:px-[18px]">
<div className="flex items-center justify-between gap-4 max-[760px]:flex-col max-[760px]:gap-3 max-[760px]:text-center">
{/* Logo */}
- <Link href={`/${lang}`} className="flex min-h-11 items-center gap-2.5 text-[var(--color-landing-ink)] text-lg font-[820] shrink-0">
- <img src="/logo.png" alt="" aria-hidden="true" width={22} height={22} />
+ <Link href={`/${lang}`} prefetch={false} className="flex min-h-11 items-center gap-2.5 text-[var(--color-landing-ink)] text-lg font-[820] shrink-0">
+ <img src="/logo-64.png" alt="" aria-hidden="true" width={22} height={22} />
<span>DBX</span>
</Link>
diff --git a/docs/components/landing/LandingLatestUpdates.tsx b/docs/components/landing/LandingLatestUpdates.tsx
index 8a4300d337..213165de5b 100644
--- a/docs/components/landing/LandingLatestUpdates.tsx
+++ b/docs/components/landing/LandingLatestUpdates.tsx
@@ -1,5 +1,3 @@
-"use client";
-
import Link from "next/link";
import { ArrowRight, CheckCircle2 } from "lucide-react";
import { RevealSection } from "@/components/landing/RevealSection";
@@ -32,7 +30,7 @@ export function LandingLatestUpdates({ lang, fallbackVersion, initialRelease, in
</li>
))}
</ul>
- <Link href={`/${lang}/changelog`} className="landing-inline-link flex shrink-0 items-center gap-[7px] text-sm font-[650] max-[760px]:mt-4">
+ <Link href={`/${lang}/changelog`} prefetch={false} className="landing-inline-link flex shrink-0 items-center gap-[7px] text-sm font-[650] max-[760px]:mt-4">
{latest.link}
<ArrowRight size={15} />
</Link>
diff --git a/docs/components/landing/LandingNav.tsx b/docs/components/landing/LandingNav.tsx
index 31f86618ff..449b15946b 100644
--- a/docs/components/landing/LandingNav.tsx
+++ b/docs/components/landing/LandingNav.tsx
@@ -94,8 +94,8 @@ export function LandingNav({ lang, active }: { lang: "en" | "cn"; active?: "home
return (
<nav ref={ref} className={`landing-nav${menuOpen ? " is-menu-open" : ""}`} aria-label={lang === "cn" ? "主导航" : "Primary navigation"}>
<div className="landing-nav-inner flex items-center justify-between max-w-[1180px] h-16 mx-auto px-7 max-[760px]:min-h-[60px] max-[760px]:h-auto max-[760px]:px-[18px] max-[760px]:py-2">
- <Link href={`/${lang}`} className="landing-nav-brand flex min-h-11 items-center gap-2.5 text-landing-ink text-2xl font-[820]" onClick={() => setMenuOpen(false)}>
- <img src="/logo.png" alt="" aria-hidden="true" width={28} height={28} />
+ <Link href={`/${lang}`} prefetch={false} className="landing-nav-brand flex min-h-11 items-center gap-2.5 text-landing-ink text-2xl font-[820]" onClick={() => setMenuOpen(false)}>
+ <img src="/logo-64.png" alt="" aria-hidden="true" width={28} height={28} />
<span>DBX</span>
</Link>
<div className="flex items-center gap-1">
@@ -103,6 +103,7 @@ export function LandingNav({ lang, active }: { lang: "en" | "cn"; active?: "home
<Link
key={item.id}
href={item.href}
+ prefetch={false}
aria-current={active === item.id ? "page" : undefined}
className={`landing-nav-link inline-flex h-9 items-center rounded-[7px] px-[10px] text-[13px] font-medium max-[760px]:hidden ${item.tabletHidden ? "max-[900px]:hidden" : ""} ${active === item.id ? "text-landing-ink" : "text-landing-muted"}`}
>
@@ -112,7 +113,7 @@ export function LandingNav({ lang, active }: { lang: "en" | "cn"; active?: "home
<Link href="https://github.com/t8y2/dbx" target="_blank" rel="noopener noreferrer" aria-label="GitHub" title="GitHub" className="landing-nav-link inline-flex size-9 items-center justify-center rounded-[7px] text-landing-muted max-[760px]:hidden">
<Github size={18} strokeWidth={2} />
</Link>
- <Link href={langHref} aria-label={t.langLabel} title={t.langLabel} className="landing-nav-link ml-1.5 inline-flex h-9 items-center justify-center rounded-[7px] border border-landing-line px-3 text-[12px] font-[650] tracking-tight text-landing-muted" onClick={() => setMenuOpen(false)}>
+ <Link href={langHref} prefetch={false} aria-label={t.langLabel} title={t.langLabel} className="landing-nav-link ml-1.5 inline-flex h-9 items-center justify-center rounded-[7px] border border-landing-line px-3 text-[12px] font-[650] tracking-tight text-landing-muted" onClick={() => setMenuOpen(false)}>
文/A
</Link>
<button
@@ -134,6 +135,7 @@ export function LandingNav({ lang, active }: { lang: "en" | "cn"; active?: "home
<Link
key={item.id}
href={item.href}
+ prefetch={false}
aria-current={active === item.id ? "page" : undefined}
className="landing-mobile-menu-link"
onClick={() => setMenuOpen(false)}
diff --git a/docs/components/landing/RevealSection.tsx b/docs/components/landing/RevealSection.tsx
index 137a983d58..eceaf918ec 100644
--- a/docs/components/landing/RevealSection.tsx
+++ b/docs/components/landing/RevealSection.tsx
@@ -1,7 +1,4 @@
-"use client";
-
import type { ComponentPropsWithoutRef, CSSProperties, ReactNode } from "react";
-import { useEffect, useRef, useState } from "react";
type RevealSectionProps = Omit<ComponentPropsWithoutRef<"section">, "children" | "className"> & {
children: ReactNode;
@@ -10,29 +7,8 @@ type RevealSectionProps = Omit<ComponentPropsWithoutRef<"section">, "children" |
};
export function RevealSection({ children, className = "", delay = 0, ...sectionProps }: RevealSectionProps) {
- const ref = useRef<HTMLElement | null>(null);
- const [visible, setVisible] = useState(false);
-
- useEffect(() => {
- const node = ref.current;
- if (!node) return;
-
- const observer = new IntersectionObserver(
- ([entry]) => {
- if (entry.isIntersecting) {
- setVisible(true);
- observer.unobserve(entry.target);
- }
- },
- { rootMargin: "0px 0px -14% 0px", threshold: 0.18 },
- );
-
- observer.observe(node);
- return () => observer.disconnect();
- }, []);
-
return (
- <section {...sectionProps} ref={ref} className={`${className} landing-reveal${visible ? " is-visible" : ""}`} style={{ ...sectionProps.style, "--reveal-delay": `${delay}ms` } as CSSProperties}>
+ <section {...sectionProps} className={`${className} landing-reveal is-visible`} style={{ ...sectionProps.style, "--reveal-delay": `${delay}ms` } as CSSProperties}>
{children}
</section>
);
diff --git a/docs/data/databaseSupport.ts b/docs/data/databaseSupport.ts
index 79e7efb71d..8f9030427f 100644
--- a/docs/data/databaseSupport.ts
+++ b/docs/data/databaseSupport.ts
@@ -17,14 +17,14 @@ export const databaseSupport: DatabaseSupportItem[] = [
{ id: "clickhouse", name: "ClickHouse", icon: "/icons/database/clickhouse.svg", tone: "#ffcc01" },
{ id: "sqlserver", name: "SQL Server", icon: "/icons/database/sqlserver.svg", tone: "#9ca3af" },
{ id: "mongodb", name: "MongoDB", icon: "/icons/database/mongodb.svg", tone: "#47a248" },
- { id: "dynamodb", name: "Amazon DynamoDB", icon: "/icons/database/dynamodb.svg", tone: "#527fff" },
+ { id: "dynamodb", name: "DynamoDB", icon: "/icons/database/dynamodb.svg", tone: "#527fff" },
{ id: "oracle", name: "Oracle", icon: "/icons/database/oracle.svg", tone: "#f80000" },
{ id: "elasticsearch", name: "Elasticsearch", icon: "/icons/database/elasticsearch.svg", tone: "#00bfb3" },
{ id: "easysearch", name: "Easysearch", icon: "/icons/database/easysearch.svg", tone: "#836eff" },
{ id: "meilisearch", name: "Meilisearch", icon: "/icons/database/meilisearch.svg", tone: "#ff5caa" },
{ id: "qdrant", name: "Qdrant", icon: "/icons/database/qdrant.svg", tone: "#dc244c" },
- { id: "milvus", name: "Milvus", icon: "/icons/database/milvus.png", tone: "#00a1ea" },
- { id: "weaviate", name: "Weaviate", icon: "/icons/database/weaviate.svg", tone: "#00b894" },
+ { id: "milvus", name: "Milvus", icon: "/icons/database/milvus.webp", tone: "#00a1ea" },
+ { id: "weaviate", name: "Weaviate", icon: "/icons/database/weaviate.webp", tone: "#00b894" },
{ id: "chromadb", name: "ChromaDB", icon: "/icons/database/chromadb.svg", tone: "#ff7a59" },
{ id: "cloudflare-d1", name: "Cloudflare D1", icon: "/icons/database/cloudflare-d1.svg", tone: "#f6821f" },
{ id: "mariadb", name: "MariaDB", icon: "/icons/database/mariadb.svg", tone: "#003545" },
@@ -56,10 +56,10 @@ export const databaseSupport: DatabaseSupportItem[] = [
{ id: "trino", name: "Trino", icon: "/icons/database/trino.svg", tone: "#dd00a1" },
{ id: "prestosql", name: "PrestoSQL", icon: "/icons/database/presto.svg", tone: "#5890ff" },
{ id: "hive", name: "Hive", icon: "/icons/database/hive.svg", tone: "#fdcb00" },
- { id: "kyuubi", name: "Apache Kyuubi", icon: "/icons/database/kyuubi.svg", tone: "#f51b21" },
- { id: "impala", name: "Apache Impala", icon: "/icons/database/impala.svg", tone: "#2c6791" },
+ { id: "kyuubi", name: "Kyuubi", icon: "/icons/database/kyuubi.svg", tone: "#f51b21" },
+ { id: "impala", name: "Impala", icon: "/icons/database/impala.svg", tone: "#2c6791" },
{ id: "hbase", name: "HBase", icon: "/icons/database/hbase.svg", tone: "#ba160c" },
- { id: "phoenix", name: "Apache Phoenix", icon: "/icons/database/phoenix.svg", tone: "#f97316" },
+ { id: "phoenix", name: "Phoenix", icon: "/icons/database/phoenix.svg", tone: "#f97316" },
{ id: "spark", name: "Spark", icon: "/icons/database/spark-logo.png", tone: "#e25a1c" },
{ id: "db2", name: "DB2", icon: "/icons/database/db2.svg", tone: "#054ada" },
{ id: "saphana", name: "SAP HANA", icon: "/icons/database/saphana.svg", tone: "#008fd3" },
diff --git a/docs/lib/contributors.test.ts b/docs/lib/contributors.test.ts
index 5f01cc2cd9..b8096711e8 100644
--- a/docs/lib/contributors.test.ts
+++ b/docs/lib/contributors.test.ts
@@ -1,6 +1,6 @@
import assert from "node:assert/strict";
import { test } from "vitest";
-import { contributorsFromActivity, dedupeContributors, type Contributor } from "./contributors";
+import { contributorAvatarUrl, contributorsFromActivity, dedupeContributors, type Contributor } from "./contributors";
const contributor = (login: string): Contributor => ({
login,
@@ -44,3 +44,8 @@ test("contributorsFromActivity strips snapshot-only fields from landing data", (
],
);
});
+
+test("contributorAvatarUrl requests small GitHub avatars and preserves local images", () => {
+ assert.equal(contributorAvatarUrl("https://avatars.githubusercontent.com/u/1?v=4"), "https://avatars.githubusercontent.com/u/1?v=4&s=64");
+ assert.equal(contributorAvatarUrl("/avatars/contributor.png"), "/avatars/contributor.png");
+});
diff --git a/docs/lib/contributors.ts b/docs/lib/contributors.ts
index b62e63a689..ee3e183985 100644
--- a/docs/lib/contributors.ts
+++ b/docs/lib/contributors.ts
@@ -8,6 +8,17 @@ export type Contributor = {
type?: string;
};
+export function contributorAvatarUrl(avatarUrl: string, size = 64): string {
+ try {
+ const url = new URL(avatarUrl);
+ if (url.hostname !== "avatars.githubusercontent.com") return avatarUrl;
+ url.searchParams.set("s", String(size));
+ return url.toString();
+ } catch {
+ return avatarUrl;
+ }
+}
+
export function dedupeContributors(contributors: Contributor[]): Contributor[] {
const seenLogins = new Set<string>();
diff --git a/docs/lib/worker.test.ts b/docs/lib/worker.test.ts
index fb73e50fdf..4789136d0d 100644
--- a/docs/lib/worker.test.ts
+++ b/docs/lib/worker.test.ts
@@ -1,6 +1,6 @@
import assert from "node:assert/strict";
import { test } from "vitest";
-import { issueRedirectPath, sanitizeReturnTo, signPayload, verifySignedPayload } from "../worker";
+import { issueRedirectPath, sanitizeReturnTo, signPayload, staticAssetCacheControl, verifySignedPayload } from "../worker";
test("signed OAuth payloads round-trip and reject tampering", async () => {
const signed = await signPayload({ login: "dbx-user" }, "test-secret");
@@ -20,3 +20,10 @@ test("anonymous Issue aliases redirect to one localized route", () => {
assert.equal(issueRedirectPath("/cn/issues", "en"), "/cn/issue");
assert.equal(issueRedirectPath("/cn/issue", "cn"), null);
});
+
+test("static assets receive browser cache headers without caching HTML", () => {
+ assert.equal(staticAssetCacheControl("/_next/static/chunks/app-123.js"), "public, max-age=31536000, immutable");
+ assert.equal(staticAssetCacheControl("/screenshots/dbx-light-1280.webp"), "public, max-age=86400, stale-while-revalidate=604800");
+ assert.equal(staticAssetCacheControl("/cn"), null);
+ assert.equal(staticAssetCacheControl("/cn/changelog.txt"), null);
+});
diff --git a/docs/package.json b/docs/package.json
index 059224c420..2fbe17483a 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -22,7 +22,6 @@
"fumadocs-mdx": "^14.3.2",
"fumadocs-ui": "^16.8.7",
"lucide-react": "^0.515.0",
- "motion": "^12.38.0",
"next": "^16.3.0",
"postcss": "^8.5.26",
"react": "^19.2.5",
diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml
index 43cb9e638e..f6733e7804 100644
--- a/docs/pnpm-lock.yaml
+++ b/docs/pnpm-lock.yaml
@@ -40,9 +40,6 @@ importers:
lucide-react:
specifier: ^0.515.0
version: 0.515.0([email protected])
- motion:
- specifier: ^12.38.0
next:
specifier: ^16.3.0
diff --git a/docs/public/favicon-64.png b/docs/public/favicon-64.png
new file mode 100644
index 0000000000..d64fd103c7
Binary files /dev/null and b/docs/public/favicon-64.png differ
diff --git a/docs/public/icons/database/milvus.webp b/docs/public/icons/database/milvus.webp
new file mode 100644
index 0000000000..0de2227ec5
Binary files /dev/null and b/docs/public/icons/database/milvus.webp differ
diff --git a/docs/public/icons/database/weaviate.webp b/docs/public/icons/database/weaviate.webp
new file mode 100644
index 0000000000..e763687aba
Binary files /dev/null and b/docs/public/icons/database/weaviate.webp differ
diff --git a/docs/public/logo-64.png b/docs/public/logo-64.png
new file mode 100644
index 0000000000..d64fd103c7
Binary files /dev/null and b/docs/public/logo-64.png differ
diff --git a/docs/public/screenshots/dbx-dark-1280.webp b/docs/public/screenshots/dbx-dark-1280.webp
new file mode 100644
index 0000000000..06fea142f4
Binary files /dev/null and b/docs/public/screenshots/dbx-dark-1280.webp differ
diff --git a/docs/public/screenshots/dbx-dark-2560.webp b/docs/public/screenshots/dbx-dark-2560.webp
new file mode 100644
index 0000000000..a18edee96a
Binary files /dev/null and b/docs/public/screenshots/dbx-dark-2560.webp differ
diff --git a/docs/public/screenshots/dbx-dark-768.webp b/docs/public/screenshots/dbx-dark-768.webp
new file mode 100644
index 0000000000..134474f298
Binary files /dev/null and b/docs/public/screenshots/dbx-dark-768.webp differ
diff --git a/docs/public/screenshots/dbx-er-1280.webp b/docs/public/screenshots/dbx-er-1280.webp
new file mode 100644
index 0000000000..3c80af83f8
Binary files /dev/null and b/docs/public/screenshots/dbx-er-1280.webp differ
diff --git a/docs/public/screenshots/dbx-er-2560.webp b/docs/public/screenshots/dbx-er-2560.webp
new file mode 100644
index 0000000000..59e2e1e8f2
Binary files /dev/null and b/docs/public/screenshots/dbx-er-2560.webp differ
diff --git a/docs/public/screenshots/dbx-er-768.webp b/docs/public/screenshots/dbx-er-768.webp
new file mode 100644
index 0000000000..7bcc6e38bc
Binary files /dev/null and b/docs/public/screenshots/dbx-er-768.webp differ
diff --git a/docs/public/screenshots/dbx-grid-1280.webp b/docs/public/screenshots/dbx-grid-1280.webp
new file mode 100644
index 0000000000..802ca4141b
Binary files /dev/null and b/docs/public/screenshots/dbx-grid-1280.webp differ
diff --git a/docs/public/screenshots/dbx-grid-2560.webp b/docs/public/screenshots/dbx-grid-2560.webp
new file mode 100644
index 0000000000..c570d7f13d
Binary files /dev/null and b/docs/public/screenshots/dbx-grid-2560.webp differ
diff --git a/docs/public/screenshots/dbx-grid-768.webp b/docs/public/screenshots/dbx-grid-768.webp
new file mode 100644
index 0000000000..07353e950c
Binary files /dev/null and b/docs/public/screenshots/dbx-grid-768.webp differ
diff --git a/docs/public/screenshots/dbx-light-1280.webp b/docs/public/screenshots/dbx-light-1280.webp
new file mode 100644
index 0000000000..02fc0d18db
Binary files /dev/null and b/docs/public/screenshots/dbx-light-1280.webp differ
diff --git a/docs/public/screenshots/dbx-light-2560.webp b/docs/public/screenshots/dbx-light-2560.webp
new file mode 100644
index 0000000000..534d0db1a4
Binary files /dev/null and b/docs/public/screenshots/dbx-light-2560.webp differ
diff --git a/docs/public/screenshots/dbx-light-768.webp b/docs/public/screenshots/dbx-light-768.webp
new file mode 100644
index 0000000000..f7f64c39a9
Binary files /dev/null and b/docs/public/screenshots/dbx-light-768.webp differ
diff --git a/docs/worker.ts b/docs/worker.ts
index 6e4211ba07..7efb984728 100644
--- a/docs/worker.ts
+++ b/docs/worker.ts
@@ -99,6 +99,14 @@ const STATE_COOKIE = "dbx_oauth_state";
const SESSION_COOKIE = "dbx_contributor_session";
const ISSUE_SESSION_COOKIE = "dbx_issue_session";
const ISSUE_SESSION_TTL_MS = 24 * 60 * 60 * 1000;
+const IMMUTABLE_ASSET_CACHE_CONTROL = "public, max-age=31536000, immutable";
+const IMAGE_ASSET_CACHE_CONTROL = "public, max-age=86400, stale-while-revalidate=604800";
+
+export function staticAssetCacheControl(pathname: string): string | null {
+ if (pathname.startsWith("/_next/static/")) return IMMUTABLE_ASSET_CACHE_CONTROL;
+ if (/\.(?:avif|gif|ico|jpe?g|png|svg|webp)$/i.test(pathname)) return IMAGE_ASSET_CACHE_CONTROL;
+ return null;
+}
function base64UrlEncode(bytes: Uint8Array): string {
let binary = "";
@@ -623,6 +631,16 @@ export default {
if (url.pathname === "/api/auth/me" && request.method === "GET") return currentUser(request, env);
if (url.pathname === "/api/auth/logout" && request.method === "POST") return logout();
if (url.pathname === "/api/contributor-avatar" && request.method === "GET") return contributorAvatar(request);
- return env.ASSETS.fetch(request);
+ const response = await env.ASSETS.fetch(request);
+ const cacheControl = staticAssetCacheControl(url.pathname);
+ if (!cacheControl || response.status < 200 || response.status >= 400) return response;
+
+ const headers = new Headers(response.headers);
+ headers.set("Cache-Control", cacheControl);
+ return new Response(response.body, {
+ status: response.status,
+ statusText: response.statusText,
+ headers,
+ });
},
};