Files
fristydev/lib/gitea.ts
T
fristy bcc5662a44
Build & Push / Lint & Build (push) Successful in 1m19s
Build & Push / Build & Push Image (push) Successful in 31s
Discord presence overhaul: game profiles, Spotify bar, Lanyard WS
- Spotify: drop album line, normalize ";" separators to ",", add open-in-Spotify link and live progress bar
- Games: resolve missing artwork via public Discord RPC app icons with placeholder fallback; add in-site game profile modal (IGDB + Steam + ITAD: artwork, details, reviews, prices)
- Proxy game data through same-origin /api/game and /api/discord-app routes, CORS-locked to https://fristy.net
- Lanyard: SSR REST first paint, then live WebSocket with heartbeat, reconnect backoff and polling fallback
- Localize presence UI (tr/en/de): elapsed times, dates, numbers, currency, review labels, game descriptions
- Sort projects by last update, descending
- Slim dark scrollbars, compact Spotify progress bar
2026-09-10 14:36:14 +03:00

63 lines
1.8 KiB
TypeScript

const GITEA_API = "https://git.fristy.net/api/v1";
const GITEA_USER = "fristy";
const EXCLUDED_REPOS = new Set([".profile"]);
export interface GiteaRepo {
id: number;
name: string;
fullName: string;
description: string | null;
language: string | null;
htmlUrl: string;
website: string | null;
stars: number;
forks: number;
updatedAt: string;
}
interface GiteaApiRepo {
id: number;
name: string;
full_name: string;
description: string | null;
language: string | null;
html_url: string;
website: string;
stars_count: number;
forks_count: number;
updated_at: string;
}
export async function getRepos(): Promise<GiteaRepo[]> {
try {
const response = await fetch(
`${GITEA_API}/users/${GITEA_USER}/repos?limit=50&sort=updated&order=desc`,
{ next: { revalidate: 3600 } },
);
if (!response.ok) {
console.error(`cannot fetch gitea repos: ${response.status}`);
return [];
}
const data = (await response.json()) as GiteaApiRepo[];
return data
.filter((repo) => !EXCLUDED_REPOS.has(repo.name))
.map((repo) => ({
id: repo.id,
name: repo.name,
fullName: repo.full_name,
description: repo.description,
language: repo.language,
htmlUrl: repo.html_url,
website: repo.website || null,
stars: repo.stars_count,
forks: repo.forks_count,
updatedAt: repo.updated_at,
}))
.sort((a, b) => +new Date(b.updatedAt) - +new Date(a.updatedAt));
} catch (error) {
console.error("cannot fetch gitea repos:", error);
return [];
}
}