export const SERVERS_TABLE = "openpds_servers"; export const METADATA_TABLE = "openpds_metadata"; export const STATE_JSON_URL = "https://raw.githubusercontent.com/mary-ext/atproto-scraping/trunk/state.json"; export const ENRICHMENT_BATCH_SIZE = 75; export const PDS_REQUEST_TIMEOUT_MS = 5000; export const DNS_CACHE_TTL_DAYS = 7; export const GEO_CACHE_TTL_DAYS = 30; /** Configuration for a known PDS software implementation */ export type PdsSoftwareConfig = { id: string; displayName: string; projectUrl: string; /** If set, enables version tracking via GitHub tags */ githubOwner?: string; githubRepo?: string; /** Extract a version string from a GitHub tag name, or null if not a valid tag */ parseVersion?: (tag: string) => string | null; }; /** Registry of known PDS software implementations */ export const PDS_SOFTWARE_REGISTRY: PdsSoftwareConfig[] = [ { id: "bluesky-pds", displayName: "Bluesky PDS", projectUrl: "https://github.com/bluesky-social/pds", githubOwner: "bluesky-social", githubRepo: "pds", parseVersion: (tag) => { const m = tag.match(/^v(\d+\.\d+\.\d+)$/); return m ? m[1] : null; }, }, { id: "millipds", displayName: "millipds", projectUrl: "https://github.com/DavidBuchanan314/millipds", githubOwner: "DavidBuchanan314", githubRepo: "millipds", parseVersion: (tag) => { const m = tag.match(/^v(\d+\.\d+\.\d+)$/); return m ? m[1] : null; }, }, { id: "cirrus", displayName: "Cirrus", projectUrl: "https://github.com/ascorbic/cirrus", githubOwner: "ascorbic", githubRepo: "cirrus", parseVersion: (tag) => { const m = tag.match(/^@getcirrus\/pds@(\d+\.\d+\.\d+)$/); return m ? m[1] : null; }, }, { id: "cocoon", displayName: "Cocoon", projectUrl: "https://github.com/haileyok/cocoon", githubOwner: "haileyok", githubRepo: "cocoon", parseVersion: (tag) => { const m = tag.match(/^v(\d+\.\d+\.\d+)$/); return m ? m[1] : null; }, }, // Link-only software (no version tracking) { id: "tranquil", displayName: "Tranquil", projectUrl: "https://tangled.org/tranquil.farm/tranquil-pds", }, { id: "hexpds", displayName: "hexpds", projectUrl: "https://github.com/ovnanova/hexpds", }, { id: "bluepds", displayName: "bluepds", projectUrl: "https://github.com/DrChat/bluepds", }, { id: "rsky", displayName: "rsky", projectUrl: "https://github.com/blacksky-algorithms/rsky", }, { id: "picopds", displayName: "picopds", projectUrl: "https://github.com/DavidBuchanan314/picopds", }, ]; /** Look up a software config by its ID */ export function getSoftwareConfig( id: string, ): PdsSoftwareConfig | undefined { return PDS_SOFTWARE_REGISTRY.find((s) => s.id === id); } /** Return only software entries that have GitHub version tracking */ export function getTrackedSoftware(): PdsSoftwareConfig[] { return PDS_SOFTWARE_REGISTRY.filter( (s) => s.githubOwner && s.githubRepo && s.parseVersion, ); } /** Country code to flag emoji */ export function countryFlag(code: string): string { return [...code.toUpperCase()] .map((c) => String.fromCodePoint(0x1f1e6 - 65 + c.charCodeAt(0))) .join(""); }