diff --git a/src/app/api/git-activity/route.ts b/src/app/api/git-activity/route.ts index 5b1ad84..59baf84 100644 --- a/src/app/api/git-activity/route.ts +++ b/src/app/api/git-activity/route.ts @@ -6,21 +6,15 @@ const GITEA_TOKEN = "f7a12c4f58e0799ac119243d0d95f4551c5be8b1"; export async function GET() { try { - // Получить репозитории const reposRes = await fetch( - `${GITEA_URL}/api/v1/repos/search?limit=20&sort=updated&token=${GITEA_TOKEN}`, + `${GITEA_URL}/api/v1/repos/search?limit=50&sort=updated&token=${GITEA_TOKEN}`, { signal: AbortSignal.timeout(8000) } ); const reposData = await reposRes.json(); - const repos = reposData.data || []; - - // Получить последние коммиты из топ-5 активных репо - const topRepos = repos - .filter((r: any) => !r.archived && !r.empty) - .slice(0, 8); + const repos = (reposData.data || []).filter((r: any) => !r.archived && !r.empty); const commits = await Promise.allSettled( - topRepos.map(async (repo: any) => { + repos.map(async (repo: any) => { const res = await fetch( `${GITEA_URL}/api/v1/repos/${repo.full_name}/commits?limit=3&token=${GITEA_TOKEN}`, { signal: AbortSignal.timeout(5000) } @@ -43,8 +37,7 @@ export async function GET() { const result = commits .filter(r => r.status === "fulfilled" && (r.value as any).commits.length > 0) .map(r => (r as any).value) - .sort((a: any, b: any) => new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime()) - .slice(0, 6); + .sort((a: any, b: any) => new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime()); return NextResponse.json({ repos: result }); } catch (e) {