constants.ts
| 1 | import path from "node:path"; |
| 2 | import { DATA_DIR, OWNER_DISPLAY_NAME } from "./config.ts"; |
| 3 | |
| 4 | // Auth / identity |
| 5 | export const WEBAUTHN_RP_NAME = `${OWNER_DISPLAY_NAME}'s Hearthforge`; |
| 6 | export const ADMIN_USERNAME = "admin"; |
| 7 | export const VALID_USERNAME_RE = /^[a-zA-Z0-9_-]+$/; |
| 8 | export const VALID_REPO_NAME_RE = /^[a-zA-Z0-9._-]+$/; |
| 9 | export const ALLOWED_REACTIONS = new Set([ |
| 10 | "👍", |
| 11 | "👎", |
| 12 | "❤️", |
| 13 | "🎉", |
| 14 | "😕", |
| 15 | "👀", |
| 16 | "🚀", |
| 17 | ]); |
| 18 | export const VALID_KEY_TYPES = new Set([ |
| 19 | "ssh-rsa", |
| 20 | "ssh-ed25519", |
| 21 | "ecdsa-sha2-nistp256", |
| 22 | "ecdsa-sha2-nistp384", |
| 23 | "ecdsa-sha2-nistp521", |
| 24 | "sk-ssh-ed25519@openssh.com", |
| 25 | "sk-ecdsa-sha2-nistp256@openssh.com", |
| 26 | ]); |
| 27 | export const CHALLENGE_TTL_MS = 5 * 60 * 1000; |
| 28 | |
| 29 | // Pagination |
| 30 | export const REPOS_PER_PAGE = 20; |
| 31 | export const COMMITS_PER_PAGE = 20; |
| 32 | export const ISSUES_PER_PAGE = 20; |
| 33 | export const PATCHES_PER_PAGE = 20; |
| 34 | export const RELEASES_PER_PAGE = 20; |
| 35 | |
| 36 | // Cache sizes |
| 37 | export const MAX_MD_CACHE = 50; |
| 38 | export const MAX_FILE_CACHE = 500; |
| 39 | export const MAX_DIFF_CACHE = 500; |
| 40 | export const MAX_PATCH_CACHE = 100; |
| 41 | |
| 42 | // Paths |
| 43 | export const DB_PATH = path.join(DATA_DIR, "hearthforge.db"); |
| 44 | export const REPOS_DIR = path.join(DATA_DIR, "repos"); |
| 45 | export const AVATARS_DIR = path.join(DATA_DIR, "avatars"); |
| 46 | export const RELEASES_DIR = path.join(DATA_DIR, "releases"); |
| 47 | export const SSH_HOST_KEY_PATH = |
| 48 | process.env.SSH_HOST_KEY_PATH ?? path.join(DATA_DIR, "ssh_host_key"); |
| 49 | export const ALLOWED_SIGNERS_PATH = path.join(DATA_DIR, "allowed_signers"); |
| 50 |