/** * API endpoint path constants. * * Every backend path used by the frontend is defined here. * Components and API modules import from this file rather than * hard-coding URL strings, so renaming an endpoint requires only one change. */ export const ENDPOINTS = { // ------------------------------------------------------------------------- // Health // ------------------------------------------------------------------------- health: "/health", // ------------------------------------------------------------------------- // Setup wizard // ------------------------------------------------------------------------- setup: "/setup", setupTimezone: "/setup/timezone", // ------------------------------------------------------------------------- // Authentication // ------------------------------------------------------------------------- authLogin: "/auth/login", authLogout: "/auth/logout", // ------------------------------------------------------------------------- // Dashboard // ------------------------------------------------------------------------- dashboardStatus: "/dashboard/status", dashboardBans: "/dashboard/bans", dashboardBansByCountry: "/dashboard/bans/by-country", // ------------------------------------------------------------------------- // Jails // ------------------------------------------------------------------------- jails: "/jails", jail: (name: string): string => `/jails/${encodeURIComponent(name)}`, jailStart: (name: string): string => `/jails/${encodeURIComponent(name)}/start`, jailStop: (name: string): string => `/jails/${encodeURIComponent(name)}/stop`, jailIdle: (name: string): string => `/jails/${encodeURIComponent(name)}/idle`, jailReload: (name: string): string => `/jails/${encodeURIComponent(name)}/reload`, jailsReloadAll: "/jails/reload-all", jailIgnoreIp: (name: string): string => `/jails/${encodeURIComponent(name)}/ignoreip`, // ------------------------------------------------------------------------- // Bans // ------------------------------------------------------------------------- bans: "/bans", bansActive: "/bans/active", // ------------------------------------------------------------------------- // Geo / IP lookup // ------------------------------------------------------------------------- geoLookup: (ip: string): string => `/geo/lookup/${encodeURIComponent(ip)}`, // ------------------------------------------------------------------------- // Configuration // ------------------------------------------------------------------------- configJails: "/config/jails", configJail: (name: string): string => `/config/jails/${encodeURIComponent(name)}`, configJailLogPath: (name: string): string => `/config/jails/${encodeURIComponent(name)}/logpath`, configGlobal: "/config/global", configReload: "/config/reload", configRegexTest: "/config/regex-test", configPreviewLog: "/config/preview-log", // ------------------------------------------------------------------------- // Server settings // ------------------------------------------------------------------------- serverSettings: "/server/settings", serverFlushLogs: "/server/flush-logs", // ------------------------------------------------------------------------- // Ban history // ------------------------------------------------------------------------- history: "/history", historyIp: (ip: string): string => `/history/${encodeURIComponent(ip)}`, // ------------------------------------------------------------------------- // Blocklists // ------------------------------------------------------------------------- blocklists: "/blocklists", blocklist: (id: number): string => `/blocklists/${String(id)}`, blocklistPreview: (id: number): string => `/blocklists/${String(id)}/preview`, blocklistsImport: "/blocklists/import", blocklistsSchedule: "/blocklists/schedule", blocklistsLog: "/blocklists/log", } as const;