Move Gitea feed from frontend to backend with cached GraphQL proxy
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 4m39s

Replaces direct browser-to-Gitea API calls with a backend service that
proxies and caches the feed (1-min TTL), served via the existing GraphQL
HomeData query. Commit message parsing now happens server-side.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-17 00:14:59 +00:00
parent 5999eccc21
commit 7381cda7b8
11 changed files with 520 additions and 47 deletions

View File

@@ -1,59 +1,36 @@
<script setup>
import axios from "axios";
import { ref, onMounted } from "vue";
import { useHomeDataStore } from "@/stores/homeData";
import { storeToRefs } from "pinia";
import Header from "@/components/text/Header.vue";
const url = "/gitea/api/v1/users/adamf/activities/feeds?limit=1";
const feed = ref(null);
const isLoading = ref(true);
const hasError = ref(false);
async function checkFeed() {
try {
const res = await axios.get(url);
feed.value = res.data[0] || null;
hasError.value = false;
} catch (err) {
hasError.value = true;
} finally {
isLoading.value = false;
}
}
onMounted(() => {
checkFeed();
});
const homeData = useHomeDataStore();
const { gitFeed: feed, loaded } = storeToRefs(homeData);
</script>
<template>
<div class="flex flex-col text-center h-full">
<Header class="text-left">Commits</Header>
<div v-if="isLoading" class="flex-1 overflow-y-auto">
<div v-if="!loaded" class="flex-1 overflow-y-auto">
<p>Loading latest activity...</p>
</div>
<div v-else-if="hasError" class="flex-1 overflow-y-auto">
<p>Could not fetch feed. Please try again later.</p>
</div>
<div
v-else-if="feed"
class="flex-1 flex flex-col justify-center overflow-y-auto"
>
<h3>Last git activity</h3>
<img
:src="feed.act_user.avatar_url"
:src="feed.avatarUrl"
alt="User avatar"
class="avatar"
/>
<a :href="feed.repo.html_url">
<h3>repo: {{ feed.repo.full_name }}</h3>
<a :href="feed.repoUrl">
<h3>repo: {{ feed.repoName }}</h3>
</a>
<p>Action: {{ feed.op_type }}</p>
<p>Message: {{ JSON.parse(feed.content).Commits[0].Message }}</p>
<small> {{ new Date(feed.created).toLocaleString() }}</small>
<p>Action: {{ feed.opType }}</p>
<p>Message: {{ feed.commitMessage }}</p>
<small> {{ new Date(feed.createdAt).toLocaleString() }}</small>
</div>
<div v-else class="flex-1 overflow-y-auto">