forked from wu529778790/panhub.shenzjd.com
-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathnuxt.config.ts
More file actions
70 lines (69 loc) · 2.63 KB
/
Copy pathnuxt.config.ts
File metadata and controls
70 lines (69 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// https://nuxt.com/docs/api/configuration/nuxt-config
import channelsConfig from "./config/channels.json";
export default defineNuxtConfig({
compatibilityDate: "2025-07-15",
devtools: { enabled: false },
app: {
head: {
htmlAttrs: { lang: "zh-CN" },
title: "PanHub · 全网最全的网盘搜索",
titleTemplate: "%s · PanHub",
meta: [
{
name: "viewport",
content:
"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover",
},
{
name: "description",
content:
"PanHub:聚合阿里云盘、夸克、百度网盘、115、迅雷等平台的全网最全网盘搜索工具,实时检索分享资源,免费、快速、无广告。",
},
{
name: "keywords",
content:
"网盘搜索, 阿里云盘, 夸克, 百度网盘, 115, 迅雷, 资源搜索, 盘搜, panhub, 网盘聚合搜索",
},
{ name: "theme-color", content: "#111111" },
{ property: "og:type", content: "website" },
{ property: "og:site_name", content: "PanHub" },
],
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
},
},
nitro: {
// 根据环境变量动态选择部署预设
preset: process.env.VERCEL
? "vercel"
: process.env.NITRO_PRESET || "cloudflare-module",
},
routeRules: {
// 热搜接口不缓存,否则 POST 写入后 GET 仍返回旧数据
"/api/hot-searches": { swr: false, cache: false },
// 豆瓣热搜允许短时缓存(服务端已有 60 分钟 cache)
"/api/douban-hot": { swr: false, cache: false },
// 密码门接口不缓存,确保 POST body 正常处理
"/api/auth/**": { swr: false, cache: false },
// 搜索接口依赖 Cookie 鉴权,禁止缓存避免 401 被缓存
"/api/search": { swr: false, cache: false },
// 图片代理依赖豆瓣,禁止 SWR 缓存避免错误响应被缓存
"/api/img": { swr: false, cache: false },
"/**": { swr: 3600 },
},
runtimeConfig: {
// server-only 配置
searchPassword: process.env.SEARCH_PASSWORD || "",
priorityChannels: channelsConfig.priorityChannels,
defaultChannels: channelsConfig.defaultChannels,
defaultConcurrency: channelsConfig.defaultConcurrency,
pluginTimeoutMs: channelsConfig.pluginTimeoutMs,
cacheEnabled: true,
cacheTtlMinutes: channelsConfig.cacheTtlMinutes,
public: {
apiBase: "/api",
siteUrl: "https://panhub.shenzjd.com",
// 向前端暴露默认频道清单
tgDefaultChannels: channelsConfig.defaultChannels,
},
},
});