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: {
|
serverActions: {
|
||||||
bodySizeLimit: "10mb",
|
bodySizeLimit: "10mb",
|
||||||
},
|
},
|
||||||
|
instrumentationHook: true, // 启用 instrumentation,用于自动启动 Bot
|
||||||
},
|
},
|
||||||
|
|
||||||
// 压缩配置
|
// 压缩配置
|
||||||
|
|||||||
@@ -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.
Reference in new issue
Block a user