1342
This commit is contained in:
1 parent
44cda1ece1
commit
0104bdcd89
3 files changed
+10
-4
No files matched your search
@@ -11,6 +11,7 @@ const nextConfig: NextConfig = {
|
||||
serverActions: {
|
||||
bodySizeLimit: "10mb",
|
||||
},
|
||||
instrumentationHook: true, // 启用 instrumentation,用于自动启动 Bot
|
||||
},
|
||||
|
||||
// 压缩配置
|
||||
|
||||
@@ -17,10 +17,15 @@ let notifierStarted = false;
|
||||
async function fetchLatestComments(): Promise<ArtalkComment[]> {
|
||||
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<string, string> = {
|
||||
"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) {
|
||||
|
||||
Reference in new issue
Block a user