chore: switch GitHub widget and changelog to Gitea

- Sidebar "GitHub" widget renamed to "Gitea", links point to gitea.giersig.eu/giersig.eu
- Runtime widget JS fetches commits/repos/PRs directly from Gitea API
- Build-time data files (githubActivity, githubRepos) switched from GitHub API to Gitea API
- changelog.njk fetches from Gitea API directly with client-side commit categorisation
- GITEA_URL / GITEA_ORG added to deploy.yml build env

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-03-31 12:45:36 +02:00
parent 0f250c4b8d
commit a6f87de59d
8 changed files with 222 additions and 396 deletions

View File

@@ -106,6 +106,20 @@ withSidebar: false
</div>
<script>
const GITEA_URL = '{{ site.gitea.url }}';
const GITEA_ORG = '{{ site.gitea.org }}';
const GITEA_REPOS = {{ site.gitea.repos | dump | safe }};
function categorizeCommit(message) {
const lower = (message || '').toLowerCase();
if (/^feat(\(.+\))?!?:/.test(lower)) return 'features';
if (/^fix(\(.+\))?!?:/.test(lower)) return 'fixes';
if (/^docs?(\(.+\))?!?:/.test(lower)) return 'documentation';
if (/^(chore|build|ci|style)(\(.+\))?!?:/.test(lower)) return 'chores';
if (/^(refactor|perf|test|a11y)(\(.+\))?!?:/.test(lower)) return 'refactor';
return 'chores';
}
function changelogApp() {
return {
activeTab: 'all',
@@ -152,12 +166,53 @@ function changelogApp() {
async fetchChangelog(days) {
try {
const response = await fetch('/github/api/changelog?days=' + days);
if (!response.ok) throw new Error('Failed to fetch');
const data = await response.json();
this.commits = data.commits || [];
this.categories = data.categories || {};
this.currentDays = data.days;
const since = days === 'all'
? null
: new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString();
const allCommits = [];
await Promise.all(GITEA_REPOS.map(async (repo) => {
let page = 1;
const limit = 50;
while (true) {
let url = `${GITEA_URL}/api/v1/repos/${GITEA_ORG}/${repo}/commits?limit=${limit}&page=${page}`;
if (since) url += `&since=${since}`;
const r = await fetch(url);
if (!r.ok) break;
const commits = await r.json();
if (!Array.isArray(commits) || commits.length === 0) break;
for (const c of commits) {
const lines = (c.commit?.message || '').split('\n');
const title = lines[0];
const body = lines.slice(1).join('\n').trim();
allCommits.push({
sha: c.sha.slice(0, 7),
fullSha: c.sha,
title,
body: body || null,
url: c.html_url,
repoUrl: `${GITEA_URL}/${GITEA_ORG}/${repo}`,
repoName: repo,
date: c.created || c.commit?.author?.date,
author: c.commit?.author?.name || '',
commitCategory: categorizeCommit(title),
});
}
if (commits.length < limit) break;
page++;
}
}));
allCommits.sort((a, b) => new Date(b.date) - new Date(a.date));
const categories = {};
for (const c of allCommits) {
categories[c.commitCategory] = (categories[c.commitCategory] || 0) + 1;
}
this.commits = allCommits;
this.categories = categories;
this.currentDays = days;
} catch (err) {
console.error('Changelog error:', err);
} finally {