import path from "node:path"; import config from "./config.ts"; // Auth / identity export const WEBAUTHN_RP_NAME = `${config.OWNER_DISPLAY_NAME}'s Hearthforge`; export const ADMIN_USERNAME = "admin"; export const VALID_USERNAME_RE = /^[a-zA-Z0-9_-]+$/; export const VALID_REPO_NAME_RE = /^[a-zA-Z0-9._-]+$/; export const ALLOWED_REACTIONS = new Set([ "👍", "👎", "❤️", "🎉", "😕", "👀", "🚀", ]); export const VALID_KEY_TYPES = new Set([ "ssh-rsa", "ssh-ed25519", "ecdsa-sha2-nistp256", "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521", "sk-ssh-ed25519@openssh.com", "sk-ecdsa-sha2-nistp256@openssh.com", ]); export const CHALLENGE_TTL_MS = 5 * 60 * 1000; // Pagination export const REPOS_PER_PAGE = 20; export const COMMITS_PER_PAGE = 20; export const ISSUES_PER_PAGE = 20; export const PATCHES_PER_PAGE = 20; export const RELEASES_PER_PAGE = 20; // Cache sizes export const MAX_MD_CACHE = 50; export const MAX_FILE_CACHE = 500; export const MAX_DIFF_CACHE = 500; export const MAX_PATCH_CACHE = 100; // Paths — derived from config.DATA_DIR via getters so they reflect overrides. export const paths = { get DB_PATH() { return path.join(config.DATA_DIR, "hearthforge.db"); }, get REPOS_DIR() { return path.join(config.DATA_DIR, "repos"); }, get AVATARS_DIR() { return path.join(config.DATA_DIR, "avatars"); }, get RELEASES_DIR() { return path.join(config.DATA_DIR, "releases"); }, get SSH_HOST_KEY_PATH() { return ( process.env.SSH_HOST_KEY_PATH ?? path.join(config.DATA_DIR, "ssh_host_key") ); }, get ALLOWED_SIGNERS_PATH() { return path.join(config.DATA_DIR, "allowed_signers"); }, };