Checks which slugs a dump category may take. A dump 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 dump category is created or renamed, and the migrations that reserve more words rename the categories that had one with renameReservedCategories. A playlist category's page is /playlists/<slug>, under a reserved word, so it reserves nothing.

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.

Functions

f
isReservedSlug(slug: string): boolean

Checks whether slug is one of the RESERVED_SLUGS.

f
renameReservedCategories(db: DatabaseSync): void

Renames each category whose slug is now reserved, such as hot, to the first of <slug>-2, <slug>-3… that is free, and logs it. Migration 0021 runs it for v4's words, 0022 for community, 0024 for authorize and federation, and 0025 for playlists.

Variables

v
RESERVED_SLUGS: readonly string[]

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.