diff --git a/write-server/next.config.ts b/write-server/next.config.ts index a50daff4..20b6b6a0 100644 --- a/write-server/next.config.ts +++ b/write-server/next.config.ts @@ -11,6 +11,7 @@ const nextConfig: NextConfig = { serverActions: { bodySizeLimit: "10mb", }, + instrumentationHook: true, // 启用 instrumentation,用于自动启动 Bot }, // 压缩配置 diff --git a/write-server/src/lib/bot/notify.ts b/write-server/src/lib/bot/notify.ts index c5bc1fff..67921545 100644 --- a/write-server/src/lib/bot/notify.ts +++ b/write-server/src/lib/bot/notify.ts @@ -17,10 +17,15 @@ let notifierStarted = false; async function fetchLatestComments(): Promise { try { const url = `${ARTALK_SERVER}/api/v2/comments?site_name=${encodeURIComponent(ARTALK_SITE)}&limit=5&sort_by=created_at&sort_order=desc`; - const res = await fetch(url, { - headers: { "Authorization": "Bearer " }, - }); - if (!res.ok) return []; + const headers: Record = { + "Content-Type": "application/json", + }; + // Artalk 公开 API 不需要认证,但加上 token 以备后续需要 + const res = await fetch(url, { headers }); + if (!res.ok) { + console.error("[comment-notify] fetch failed:", res.status, res.statusText); + return []; + } const data = await res.json() as { comments?: ArtalkComment[] }; return data.comments || []; } catch (e) { diff --git a/write/start-silent.bat b/write/start-silent1.bat similarity index 100% rename from write/start-silent.bat rename to write/start-silent1.bat