// glossary-ignore-file: superadmin-only page about the platform's git server — «репозиторий» is the literal object here
import Link from "@/components/Link";
import { notFound } from "next/navigation";
import { ExternalLink, GitBranch, Lock } from "lucide-react";
import { giteaServerOverview, isSuperadmin, type GiteaServerRepo } from "@peppa/core";
import { ago, Empty, Flash, Notice, PageHeader, Section } from "@/components/common";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Workspace } from "@/components/Workspace";
import { requireUser } from "@/lib/auth";
import { makeRepoPrivateAction } from "./actions";
import { db } from "@/lib/db";
import { getT } from "@/lib/i18n";
import type { Translator } from "@peppa/shared/i18n";
export async function generateMetadata() {
const t = await getT();
return { title: t("Gitea — FORGE") };
}
type Params = { q?: string; show?: string; closed?: string; error?: string; page?: string; fresh?: string };
type Show = "all" | "linked" | "unlinked" | "public";
/** Rows per page (PEP-273: the whole list made the page over 1 MB). */
const PAGE_SIZE = 50;
function RepoRow({ r, t, q, show }: { r: GiteaServerRepo; t: Translator; q: string; show: Show }) {
return (
{t("Бот")}: {o.bot?.login ?? "—"}
{o.bot && (o.bot.admin ? {t("админ сервера — видит все репозитории")} : {t("не админ — видит публичные и свои репозитории")})}
{open > 0 ? (
{t("Публичных: {n} — их видит любой, у кого есть доступ к Gitea", { n: open })}
) : (
{t("Публичных нет")}
)}
)}
{q.closed && {t("{repo} теперь закрытый: его видят только владелец, участники и бот", { repo: q.closed })}}
{o.error && {t("Gitea не ответила: {error}", { error: o.error })}}
{o.loading && (
// PEP-317: the page does not wait for the Git server — the list is loaded in the background.
{t("Список репозиториев загружается — это может занять несколько секунд.")} {t("Обновить")}
)}
{o.loading ? null : repos.length === 0 ? (
{t("Репозиториев не найдено.")}
) : (