feat: Next.js 后端 + SQLite + 暗门后台 /virtheart + 服务咨询页
后端(node:sqlite 零原生依赖,data/site.db,WAL + busy_timeout 抗并发): - works / service_items / site_config / inquiries / admin_users / admin_sessions / captcha_challenges - API:admin 登录登出/密码、作品与服务 CRUD、图片上传、留言箱、 验证码 challenge/verify、咨询提交(一次性滑块令牌防重放) 后台 /virtheart(仅手动访问,未登录一律 307 → /virtheart/login): - 服务端布局鉴权 + DB 会话(httpOnly cookie 7 天)+ CSRF 头校验 - 概览 / 作品(上传、网格预设、发布开关)/ 服务 / 留言箱 / 配置(全站文案) - 设计与主站同语言:暗底点阵、mono、lime 选中,非传统后台模板 公开站: - 路由组 (site) 隔离站点壳层;首页/服务页文案全部 DB 驱动即时生效 - /services 服务菜单 + 留言表单 + 全屏居中滑块拼图验证码(对齐缺口) - 提交入 inquiries 并 SMTP(飞书 notify@)邮件通知 chenchun@virtheart.com - Header 新增「服务」菜单;旧作品清理,空状态自动接管 - 根布局仅承载字体/全局样式,后台无站点壳层 验证:登录/CSRF/发布隔离/滑块容错/令牌单次消费/SMTP 真发全部通过; lint 与基线一致(119 errors 均为存量)。
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
import ScrambleReveal from "@/components/dom/ScrambleReveal";
|
||||
import AboutMedia from "@/components/dom/AboutMedia";
|
||||
import FooterSection from "@/components/dom/FooterSection";
|
||||
import WorkSection from "@/components/dom/WorkSection";
|
||||
import HyperSpaceSection from "@/components/dom/HyperSpaceSection";
|
||||
import PasscodeRevealText from "@/components/dom/PasscodeRevealText";
|
||||
import { getSiteConfig, listWorks } from "@/lib/siteConfig";
|
||||
import type { WorkItem } from "@/lib/workItems";
|
||||
|
||||
/**
|
||||
* 首页 — 结构复刻原站(haoqi_body.html),文案全部来自 site_config
|
||||
*(/virtheart 后台「配置」可改,保存即生效);作品来自 works 表。
|
||||
*/
|
||||
export default async function Home() {
|
||||
const config = getSiteConfig();
|
||||
const items: WorkItem[] = listWorks(true)
|
||||
.filter((w) => w.name && (w.image_url || w.href))
|
||||
.map((w) => ({
|
||||
name: w.name,
|
||||
imageUrl: w.image_url,
|
||||
hoverImageUrl: w.hover_image_url,
|
||||
href: w.href || `/work/${w.slug}`,
|
||||
year: w.year,
|
||||
type: w.type,
|
||||
gridClass: w.grid_class || "col-span-12 lg:col-span-6 xl:col-span-4",
|
||||
codingProject: w.coding_project === 1,
|
||||
passcodeProtected: w.passcode_protected === 1,
|
||||
}));
|
||||
return (
|
||||
// NOTE: the original scrolls INSIDE <main> (its Lenis wraps the main
|
||||
// container), which is what lets its position:sticky children pin. Our
|
||||
// Lenis is window-level, so main must NOT be a scroll container —
|
||||
// otherwise sticky (hyper-space section) never pins.
|
||||
<main className="w-full">
|
||||
<div>
|
||||
{/* Banner Section */}
|
||||
<div
|
||||
data-section="banner"
|
||||
className="grid grid-cols-12 grid-rows-[auto_1fr] px-4 lg:px-14 py-18 lg:py-24 w-full h-dvh lg:h-screen"
|
||||
>
|
||||
<div className="flex flex-col order-2 lg:order-1 lg:grid lg:grid-cols-12 col-span-12 font-mono text-base">
|
||||
<span className="hidden lg:block lg:col-span-3 xl:col-span-2 lg:col-start-1 xl:col-start-1 p-2 font-sans font-medium text-[4svw] sm:text-2xl lg:text-3xl leading-tight">
|
||||
<ScrambleReveal text={config.hero_line1} startDelayMs={300} letterDelayMs={10} />
|
||||
<br />
|
||||
<ScrambleReveal text={config.hero_line2} startDelayMs={300} letterDelayMs={10} />
|
||||
</span>
|
||||
<ScrambleReveal
|
||||
className="hidden lg:block lg:col-span-3 xl:col-span-2 lg:col-start-4 xl:col-start-5 p-2 text-balance"
|
||||
text={config.hero_tagline}
|
||||
startDelayMs={300}
|
||||
letterDelayMs={10}
|
||||
/>
|
||||
<PasscodeRevealText
|
||||
className="col-span-12 lg:col-span-6 xl:col-span-4 lg:col-start-7 xl:col-start-9 mt-auto lg:mt-0 p-2"
|
||||
prefix={config.intro_prefix}
|
||||
suffix={config.intro_suffix}
|
||||
brandName={config.brand_name}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="flex flex-col self-end order-1 lg:order-2 col-span-12 px-2 font-bold text-[7.2svw] lg:text-[6svw] 2xl:text-[5svw] xl:text-[5.6svw] uppercase leading-none"
|
||||
style={{ fontVariationSettings: '"wdth" 120' }}
|
||||
>
|
||||
<ScrambleReveal text={config.hero_big_1} startDelayMs={300} />
|
||||
<ScrambleReveal text={config.hero_big_2} startDelayMs={500} />
|
||||
<ScrambleReveal text={config.hero_big_3} startDelayMs={700} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Signature / About Section */}
|
||||
<div className="grid grid-cols-12 px-4 lg:px-14 py-18 lg:py-24 lg:pb-28 w-full">
|
||||
<AboutMedia />
|
||||
<div className="flex flex-col justify-start items-start gap-6 col-span-12 sm:col-span-7 lg:col-span-8 sm:col-start-6 lg:col-start-5 text-base lg:text-xl leading-none">
|
||||
<p
|
||||
className="p-2 w-full text-l1 md:text-[4.2svw] text-xl leading-[1.3] md:leading-none select-text"
|
||||
style={{
|
||||
fontFamily:
|
||||
'var(--font-tiktok), "MiSans", sans-serif',
|
||||
}}
|
||||
>
|
||||
<span className="select-text">{config.about_p1}</span>
|
||||
</p>
|
||||
<p
|
||||
className="p-2 w-full text-l2 md:text-[4.2svw] text-xl leading-[1.3] md:leading-none select-text"
|
||||
style={{
|
||||
fontFamily:
|
||||
'var(--font-tiktok), "MiSans", sans-serif',
|
||||
}}
|
||||
>
|
||||
<span className="select-text">
|
||||
{config.about_p2}
|
||||
<a
|
||||
href={config.about_p2_link_href || "#selected-work"}
|
||||
className="inline text-l1 underline underline-offset-[0.08em] decoration-solid decoration-(--label-3) transition-[text-decoration-color] duration-150 ease-out lg:[@media(hover:hover)]:hover:decoration-(--label-1)"
|
||||
>
|
||||
{config.about_p2_link_label}
|
||||
</a>
|
||||
{config.about_p2.endsWith(";") || config.about_p2.endsWith(",")
|
||||
? "里记录了这些探索的痕迹。"
|
||||
: ""}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Selected Work grid (id="selected-work", WebGL image layers) */}
|
||||
<WorkSection
|
||||
items={items}
|
||||
emptyText={{
|
||||
headline: config.work_empty_headline,
|
||||
note: config.work_empty_note,
|
||||
ctaPrefix: config.work_empty_cta_prefix,
|
||||
ctaSuffix: config.work_empty_cta_suffix,
|
||||
ctaAction: config.work_empty_cta_action,
|
||||
}}
|
||||
contactEmail={config.contact_email}
|
||||
/>
|
||||
|
||||
{/* Hyper-space scroll section (id="hyper-space"): the WebGL
|
||||
hyperspace arrow (cursor.glb stripes) tracks this section's
|
||||
screen rect and engulfs the viewport mid-scroll. */}
|
||||
<HyperSpaceSection />
|
||||
|
||||
{/* Contact / Footer Section (#contact, data-section="footer") */}
|
||||
<FooterSection contactEmail={config.contact_email} />
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user