Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions app/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,20 @@ html > body[data-scroll-locked] {
code {
tab-size: 4;
}

/* version switcher: match the search field, placed above it */
#nd-sidebar button:has(> .lucide-chevrons-up-down) {
@apply inline-flex items-center gap-2 rounded-lg border p-1.5 ps-2 text-sm text-fd-muted-foreground;
background-color: var(--color-gray-900);
order: 1;
margin-bottom: -0.375rem;
}

#nd-sidebar button[data-search-full] {
order: 2;
}

#nd-sidebar button:has(> .lucide-chevrons-up-down):hover,
#nd-sidebar button:has(> .lucide-chevrons-up-down)[data-state='open'] {
@apply bg-fd-accent text-fd-accent-foreground;
}
21 changes: 21 additions & 0 deletions app/routes/docs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useFumadocsLoader } from 'fumadocs-core/source/client'
import { DocsLayout } from 'fumadocs-ui/layouts/docs'
import { DocsBody, DocsDescription, DocsPage, DocsTitle } from 'fumadocs-ui/layouts/docs/page'
import { use } from 'react'
import { redirect } from 'react-router'
import { Breadcrumb } from '@/components/breadcrumb'
import { Feedback } from '@/components/feedback/client'
import { useMDXComponents } from '@/components/mdx'
Expand All @@ -11,12 +12,32 @@ import { baseOptions } from '@/lib/layout.shared'
import { docs, source } from '@/lib/source'
import type { Route } from './+types/docs'

// Pre-versioning paths (e.g. /docs/godot/install) redirect to the default version.
const DEFAULT_VERSION = '1.x'
const LEGACY_SECTIONS = ['godot', 'unity', 'http', 'sockets', 'selfhosting', 'integrations']
const VERSION_REDIRECTS: Record<string, string> = {
'1.0': '1.x',
'0.49': 'pre-1.0',
'0.60': 'pre-1.0',
}

export async function loader({ params }: Route.LoaderArgs) {
const slugs = params['*'].split('/').filter((v) => v.length > 0)
const page = source.getPage(slugs)
if (!page) {
const first = slugs[0] ?? ''
if (LEGACY_SECTIONS.includes(first)) {
throw redirect(`/docs/${DEFAULT_VERSION}/${slugs.join('/')}`)
}
if (VERSION_REDIRECTS[first]) {
throw redirect(`/docs/${VERSION_REDIRECTS[first]}/${slugs.slice(1).join('/')}`)
}
throw new Response('Not found', { status: 404 })
}
// Default the docs root to the default version.
if (slugs.length === 0) {
throw redirect(`/docs/${DEFAULT_VERSION}`)
}

return {
path: page.path,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Authentication

The Admin API is a way of programmatically managing your game data like stats and leaderboards.

Unlike the gameplay-orientated [HTTP API](/docs/http/authentication), which authenticates requests on behalf of players, the Admin API authenticates requests using admin API keys scoped to your game.
Unlike the gameplay-orientated [HTTP API](/docs/1.x/http/authentication), which authenticates requests on behalf of players, the Admin API authenticates requests using admin API keys scoped to your game.

## Creating an admin API key

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: Common errors

The `Authorization` header is required, with its value set to `Bearer your-admin-api-key`.

Admin API keys are prefixed with `ta_` and are created inside the [dashboard](https://dashboard.trytalo.com/api-keys). Unlike the gameplay [HTTP API](/docs/http/authentication), admin API keys are scoped to a single game rather than authenticating on behalf of a player.
Admin API keys are prefixed with `ta_` and are created inside the [dashboard](https://dashboard.trytalo.com/api-keys). Unlike the gameplay [HTTP API](/docs/1.x/http/authentication), admin API keys are scoped to a single game rather than authenticating on behalf of a player.

## Missing scopes

Expand Down Expand Up @@ -66,4 +66,4 @@ The `Retry-After` header will return how many seconds to wait before retrying -

Admin endpoints that read entities (e.g. listing leaderboard entries or listing stats) respect the `X-Talo-Include-Dev-Data` header. Set it to `1` to include development data, or leave it unset to only return live data.

Learn more in the [dev data guide](/docs/admin/dev-data).
Learn more in the [dev data guide](/docs/1.x/admin/dev-data).
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Separating development data
---
## Dev build headers

When creating players through the [HTTP API](/docs/http/dev-data), you can optionally specify if the player belongs to a development build and therefore if they should be excluded from live data.
When creating players through the [HTTP API](/docs/1.x/http/dev-data), you can optionally specify if the player belongs to a development build and therefore if they should be excluded from live data.

By default, the Admin API only returns data associated with live players. To include development data in these reads, set the `X-Talo-Include-Dev-Data` header to `1`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const pageToc = [

## Overview

The game stat admin API lets you create, update, delete and reset [game stats](/docs/http/game-stat-api) programmatically, as well as read stats and their metrics. This is useful for automation like creating stats ahead of a new patch or resetting player stats between competitive seasons.
The game stat admin API lets you create, update, delete and reset [game stats](/docs/1.x/http/game-stat-api) programmatically, as well as read stats and their metrics. This is useful for automation like creating stats ahead of a new patch or resetting player stats between competitive seasons.

## Endpoints

Expand Down Expand Up @@ -52,7 +52,7 @@ type Stat = {

### StatMetrics

Metrics are **optional** and only included when the `withMetrics` query parameter is set on [list](/docs/admin/game-stat-api#get-all-game-stats) and [find](/docs/admin/game-stat-api#get-an-individual-game-stat) requests. When `withMetrics` is set, the `metrics` property is included with the stat response.
Metrics are **optional** and only included when the `withMetrics` query parameter is set on [list](/docs/1.x/admin/game-stat-api#get-all-game-stats) and [find](/docs/1.x/admin/game-stat-api#get-an-individual-game-stat) requests. When `withMetrics` is set, the `metrics` property is included with the stat response.

```ts
type StatMetrics = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const pageToc = [

## Overview

The leaderboard admin API lets you create, update, delete and reset [leaderboards](/docs/http/leaderboard-api) programmatically, as well as read leaderboards and their entries. This is useful for automation like creating a new leaderboard ahead of a patch, resetting entries between competitive seasons or hiding suspicious entries.
The leaderboard admin API lets you create, update, delete and reset [leaderboards](/docs/1.x/http/leaderboard-api) programmatically, as well as read leaderboards and their entries. This is useful for automation like creating a new leaderboard ahead of a patch, resetting entries between competitive seasons or hiding suspicious entries.

## Endpoints

Expand Down
File renamed without changes.
Loading
Loading