Skip to content

Commit 4c76f16

Browse files
perf(vercel): optimize resource limits (active CPU, function invocations, data cache reads)
1 parent eca1c5f commit 4c76f16

8 files changed

Lines changed: 15 additions & 1 deletion

File tree

‎app/[locale]/docs/[...slug]/page.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async function resolveDocPath(
4646
{
4747
redirect: "manual",
4848
signal: controller.signal,
49-
cache: "no-store",
49+
next: { revalidate: 300 }, // 缓存 5 分钟,防止 bot 扫描频繁触发冷启动与后端查询
5050
// 显式 UA:Vercel SSR 默认出口 UA 可能被 CF bot filter 拦(对齐 feed/page fetchLinks)
5151
headers: {
5252
accept: "application/json",

‎app/[locale]/feed/page.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,15 @@ export default async function FeedPage({ searchParams }: FeedPageProps) {
245245
{tab === "links" ? (
246246
<Link
247247
href="/feed/submit"
248+
prefetch={false}
248249
className="shrink-0 inline-block px-6 py-2.5 border border-[var(--foreground)] font-sans text-xs uppercase tracking-widest font-bold text-[var(--foreground)] hover:bg-[var(--foreground)] hover:text-[var(--background)] transition-all duration-200"
249250
>
250251
+ 丢个链接
251252
</Link>
252253
) : (
253254
<Link
254255
href="/editor"
256+
prefetch={false}
255257
className="shrink-0 inline-block px-6 py-2.5 border border-[var(--foreground)] font-sans text-xs uppercase tracking-widest font-bold text-[var(--foreground)] hover:bg-[var(--foreground)] hover:text-[var(--background)] transition-all duration-200"
256258
>
257259
+ 写篇文章
@@ -292,6 +294,7 @@ export default async function FeedPage({ searchParams }: FeedPageProps) {
292294
</p>
293295
<Link
294296
href="/editor"
297+
prefetch={false}
295298
className="mt-4 inline-block font-mono text-xs uppercase tracking-widest text-[var(--foreground)] hover:text-[#CC0000] transition-colors"
296299
>
297300
开始写 →

‎app/[locale]/share/page.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ function ShareInner() {
147147
</Button>
148148
<Link
149149
href="/feed"
150+
prefetch={false}
150151
className="inline-flex items-center justify-center px-6 py-2 rounded-none border border-[var(--foreground)] font-mono uppercase tracking-widest text-xs hover:bg-[var(--foreground)] hover:text-[var(--background)] transition-colors"
151152
>
152153
去看看大家分享了啥 →
@@ -226,6 +227,7 @@ function ShareInner() {
226227
<div className="text-center">
227228
<Link
228229
href="/feed"
230+
prefetch={false}
229231
className="font-mono text-[10px] uppercase tracking-widest text-neutral-500 hover:text-[var(--foreground)]"
230232
>
231233
跳过,去看看大家分享了啥 →

‎app/[locale]/u/[username]/posts/page.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export default function UserPostsPage({ params }: PageProps) {
102102
<p>还没有发布过文章,写第一篇让大家看到你。</p>
103103
<Link
104104
href="/editor"
105+
prefetch={false}
105106
className="mt-4 inline-block font-mono text-xs uppercase tracking-widest text-[var(--foreground)] hover:text-[#CC0000] transition-colors"
106107
>
107108
去写 →

‎app/[locale]/u/[username]/shares/page.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ export default function SharesPage({ params }: PageProps) {
103103
<p>这是 {username} 的私有分享列表,只有本人登录后可见。</p>
104104
<Link
105105
href="/feed"
106+
prefetch={false}
106107
className="mt-4 inline-block text-primary underline underline-offset-4"
107108
>
108109
浏览公共分享墙 →

‎app/components/Footer.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export async function Footer() {
6464
<li>
6565
<Link
6666
href="/docs/learn/ai"
67+
prefetch={false}
6768
className="hover:text-[#CC0000] transition-colors"
6869
data-umami-event="navigation_click"
6970
data-umami-event-region="footer"
@@ -75,6 +76,7 @@ export async function Footer() {
7576
<li>
7677
<Link
7778
href="/docs/learn/cs"
79+
prefetch={false}
7880
className="hover:text-[#CC0000] transition-colors"
7981
data-umami-event="navigation_click"
8082
data-umami-event-region="footer"
@@ -86,6 +88,7 @@ export async function Footer() {
8688
<li>
8789
<Link
8890
href="/docs/community"
91+
prefetch={false}
8992
className="hover:text-[#CC0000] transition-colors"
9093
data-umami-event="navigation_click"
9194
data-umami-event-region="footer"
@@ -97,6 +100,7 @@ export async function Footer() {
97100
<li>
98101
<Link
99102
href="/docs/career"
103+
prefetch={false}
100104
className="hover:text-[#CC0000] transition-colors"
101105
data-umami-event="navigation_click"
102106
data-umami-event-region="footer"

‎app/components/Header.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export async function Header() {
5353
</Link>
5454
<Link
5555
href="/feed"
56+
prefetch={false}
5657
className="hover:text-[#CC0000] transition-colors"
5758
data-umami-event="navigation_click"
5859
data-umami-event-region="header"

‎proxy.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const BOT_PATH_PATTERNS = [
5454
// 常见 admin / debug panels 探测路径(本站 admin 在 /[locale]/admin,
5555
// 这些是其他平台特有路径,扫到必是 bot)
5656
/\/(phpmyadmin|adminer|pma|dbadmin|mysqladmin)(?:$|[/?#])/i,
57+
// Tomcat/Spring/Java/Nacos 常见框架扫描与探测路径(无点路径)
58+
/\/(actuator|druid|nacos|tomcat|manager\/html|web-inf|solr|invoker)(?:$|[/?#])/i,
5759
];
5860

5961
function isBotScanPath(pathname: string): boolean {

0 commit comments

Comments
 (0)