This commit is contained in:
Vaica committed 2026-06-24 13:42:36 +08:00
1 parent c8316a7f98
commit 8701d4478f
3 files changed
+10 -4

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ const nextConfig: NextConfig = {
serverActions: { serverActions: {
bodySizeLimit: "10mb", bodySizeLimit: "10mb",
}, },
instrumentationHook: true, // 启用 instrumentation,用于自动启动 Bot
}, },
// 压缩配置 // 压缩配置
+9 -4
View File
@@ -17,10 +17,15 @@ let notifierStarted = false;
async function fetchLatestComments(): Promise<ArtalkComment[]> { async function fetchLatestComments(): Promise<ArtalkComment[]> {
try { try {
const url = `${ARTALK_SERVER}/api/v2/comments?site_name=${encodeURIComponent(ARTALK_SITE)}&limit=5&sort_by=created_at&sort_order=desc`; 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, { const headers: Record<string, string> = {
headers: { "Authorization": "Bearer " }, "Content-Type": "application/json",
}); };
if (!res.ok) return []; // 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[] }; const data = await res.json() as { comments?: ArtalkComment[] };
return data.comments || []; return data.comments || [];
} catch (e) { } catch (e) {
File renamed without changes.