/** * Checks which slugs a category may take. A category's feed lives at the URL * root (`/music`), so its slug must not shadow another top-level page. The * category service runs this check when a category is created or renamed, and * migration 0021 renamed the categories it newly reserved. * * Dump and playlist slugs reserve nothing: they live under their owner's * `dumps/` and `playlists/`, where nothing else is named by a user. A user * can't clash with a category either, since `@` is never in a slug. * * @module */ import { FEED_TABS } from "../../shared/paths.ts"; /** * Lists the top-level path segments a category slug may not take: the feed * tabs (`/hot`), the SPA's own pages (`src/App.tsx`), and `api`, `ws`, * `assets` and `emojibase`, which the server answers before the SPA. Keep it * in step with the route table and the build's top-level folders. */ export const RESERVED_SLUGS: readonly string[] = [ ...FEED_TABS, "search", "login", "register", "notifications", "reset-password", "unsubscribe", "settings", "manage", "api", "ws", "assets", "emojibase", ]; /** Checks whether `slug` is one of the {@link RESERVED_SLUGS}. */ export function isReservedSlug(slug: string): boolean { return RESERVED_SLUGS.includes(slug); }