Files
svemagie e021e7f70b
Build & Deploy / build-and-deploy (push) Successful in 2m5s
fix: EleventyFetch undefined + NAT hairpin on build runner
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.
2026-05-03 13:12:02 +02:00

45 lines
1.3 KiB
JavaScript

/**
* GitHub Starred Repos Metadata
* Fetches the starred API response (cached 15min) to extract totalCount.
* Only totalCount is passed to Eleventy's data cascade — the full star
* list is discarded after parsing, keeping build memory low.
* The starred page fetches all data client-side via Alpine.js.
*/
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 urls = [
`${INDIEKIT_URL}/github/api/starred/all`,
`${INDIEKIT_URL}/githubapi/api/starred/all`,
];
for (const url of urls) {
try {
const response = await cachedFetch(url, {
duration: "15m",
type: "json",
});
return {
totalCount: response.totalCount || 0,
buildDate: new Date().toISOString(),
};
} catch (error) {
console.log(`[githubStarred] Could not fetch ${url}: ${error.message}`);
}
}
throw new Error("No GitHub starred endpoint responded");
} catch (error) {
console.log(`[githubStarred] Could not fetch starred count: ${error.message}`);
return {
totalCount: 0,
buildDate: new Date().toISOString(),
};
}
}