mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-10-20 22:31:53 +02:00
GitHub and GitLab as mirror destinations, both beta. Neither has a usable pull mirror API, so the app keeps a bare clone of each source repository and pushes its branches and tags to the target with force and prune. Target adapters create, archive and delete repositories through each host's API. A dispatcher routes mirror, sync, retry, scheduler, recovery and cleanup by destination; Gitea and Forgejo are unchanged. Migration 0018 records each repository's destination host. Metadata, LFS, wiki and force push protection are disabled with a reason for push targets. Closes #377
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { SiForgejo, SiGitea, SiGithub, SiGitlab } from "react-icons/si";
|
|
import {
|
|
DESTINATION_PROVIDER_LABELS,
|
|
isPushDestinationKind,
|
|
normalizeDestinationProviderKind,
|
|
type DestinationProviderKind,
|
|
} from "@/lib/destination-kinds";
|
|
|
|
const icons: Record<DestinationProviderKind, React.ComponentType<{ className?: string }>> = {
|
|
gitea: SiGitea,
|
|
forgejo: SiForgejo,
|
|
github: SiGithub,
|
|
gitlab: SiGitlab,
|
|
};
|
|
|
|
/** Brand icon for the host mirrors are created on. */
|
|
export function DestinationIcon({
|
|
provider,
|
|
className,
|
|
}: {
|
|
provider: DestinationProviderKind | string | null | undefined;
|
|
className?: string;
|
|
}) {
|
|
const Icon = icons[normalizeDestinationProviderKind(provider)] ?? SiGitea;
|
|
return <Icon className={className} />;
|
|
}
|
|
|
|
/** Kind, label and transport for a configured destination. */
|
|
export function destinationInfo(config: { provider?: string | null } | null | undefined): {
|
|
provider: DestinationProviderKind;
|
|
label: string;
|
|
isPushTarget: boolean;
|
|
} {
|
|
const provider = normalizeDestinationProviderKind(config?.provider);
|
|
return { provider, label: DESTINATION_PROVIDER_LABELS[provider], isPushTarget: isPushDestinationKind(provider) };
|
|
}
|