e021e7f70b
Build & Deploy / build-and-deploy (push) Successful in 2m5s
githubActivity.js: replace bare EleventyFetch() calls with cachedFetch() (imported wrapper) — EleventyFetch was never imported directly. recentComments, githubStarred, youtubeChannel: use INDIEKIT_URL env var (http://10.100.0.20:3000) instead of SITE_URL (public IP 46.225.0.216). Build runner on Gitea jail cannot reach its own public IP via NAT. INDIEKIT_URL is already set in deploy.yml; SITE_URL fallback preserved.
25 lines
736 B
JavaScript
25 lines
736 B
JavaScript
/**
|
|
* Recent Comments Data
|
|
* Fetches the 5 most recent comments at build time for the sidebar widget.
|
|
*/
|
|
|
|
import { cachedFetch } from "../lib/data-fetch.js";
|
|
|
|
const INDIEKIT_URL = process.env.INDIEKIT_URL || process.env.SITE_URL || "https://example.com";
|
|
|
|
export default async function () {
|
|
try {
|
|
const url = `${INDIEKIT_URL}/comments/api/comments?limit=5`;
|
|
console.log(`[recentComments] Fetching: ${url}`);
|
|
const data = await cachedFetch(url, {
|
|
duration: "15m",
|
|
type: "json",
|
|
});
|
|
console.log(`[recentComments] Got ${(data.children || []).length} comments`);
|
|
return data.children || [];
|
|
} catch (error) {
|
|
console.log(`[recentComments] Unavailable: ${error.message}`);
|
|
return [];
|
|
}
|
|
}
|