diff --git a/src/app/web/library/page.mdx b/src/app/web/library/page.mdx new file mode 100644 index 0000000..6ce1fb7 --- /dev/null +++ b/src/app/web/library/page.mdx @@ -0,0 +1,185 @@ +export const metadata = { + title: 'Library', + description: + "On this page, we'll dive into how to manage the instance's library and sources.", +} + +# Library + +Drop supports having more than one library 'source' enabled at a time. This allows users to use multiple folders on their server, and merge all the separate libraries into one. + +Each library source has a specific type, which defines how it connects to games: + +- Drop-style (internally `Filesystem`). The default and recommended type, it supports the versioned folders that Drop was built for. +- Compatibility (internally `FlatFilesystem`). Implemented for compatibility with GameVault and similar libraries, doesn't use versioned folders. + +You can read more about the user's side of things on the docs: [Library Sources](https://docs.droposs.org/docs/library). + + + We plan to add network-based library sources in the future, so keep this in + mind when using the endpoints. They may take longer to return values in the + future. + + +--- + +## The game model + +The game model stores most of the metadata attached to the game, and is used to render store pages and display in clients. + +### Properties + + + #### Internal IDs and metadata + + UUID of the game. Used internally to refer to this game. + + + ID of the metadata sourced originally used to import this game. + + + Internal metadata source's ID for the original import. + + + Timestamp of when this game was originally created. + + + ID of library source this game is linked to. + + + Path within the library source this game is linked to. + + +#### Admin-provided metadata + + + The name of this game. + + + A short description of this game, without requiring formatting. + + + A markdown representation of the long-form description of this game. + + + When this game was released. + + + + Object ID of icon. + + + Object ID of background banner. Usually a wide, high-resolution image. + + + Object ID of cover. Usually a tall image with the title of the game. + + + Array of object IDs shown on the store's carousel. + + + An array of all object IDs linked to this game. + + +#### Metadata flags + + + Whether or not this game is featured for the carousel. + + + +--- + +## Fetch library {{ tag: 'GET', label: '/api/v1/admin/library', apilevel: "system", acl: "library:read" }} + + + + + This endpoint fetches all unimported and imported games. + + ### Response values + + + + An object of library ID to paths that are yet to be imported. + + + An array of game objects with attached status. + + + + + A metadata game object. Refer to [the game model](#the-game-model). + + + A field indicating the status of this game. + + If it is a string, it'll be "offline", which means that the library source this game is connected to isn't working right now. + + If it's an object, it'll look like: + + ```json + { + "noVersions": false, + "unimportedVersions": [] + } + ``` + + + + + + + + + + + + ```bash {{ title: 'cURL' }} + curl -G http://localhost:3000/api/v1/admin/library \ + -H "Authorization: Bearer {token}" + ``` + + ```js + const response = await fetch("http://localhost:3000/api/v1/admin/library", { + headers: { + Authorization: "Bearer {token}" + }, + }); + + const results = await response.json(); + + ``` + + + + ```json {{ title: 'Response' }} + { + "unimportedGames": { + "myLibraryId": [ // These are paths on disk + "My Game", + "My Other Game", + "Horizon Zero Dawn" + ], + "myOtherLibraryId": [] + }, + "games": [ + { + "game": { ... }, + "status": { + "noVersions": false, + "unimportedVersions": [] + } + }, + { + "game": { ... }, + "status": "offline" + } + ] + } + ``` + + + + +--- diff --git a/src/components/Code.tsx b/src/components/Code.tsx index aab9103..359740c 100644 --- a/src/components/Code.tsx +++ b/src/components/Code.tsx @@ -24,7 +24,7 @@ const languageNames: Record = { python: 'Python', ruby: 'Ruby', go: 'Go', -} +}; function getPanelTitle({ title, diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index 5aa284e..ab45dbe 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -271,6 +271,7 @@ export const navigation: Array = [ { title: 'Objects', href: '/web/objects' }, { title: 'Tasks', href: '/web/tasks' }, { title: 'Import', href: '/web/import' }, + { title: 'Library', href: '/web/library' }, ], }, ] diff --git a/src/components/mdx.tsx b/src/components/mdx.tsx index 3555c15..9a58d49 100644 --- a/src/components/mdx.tsx +++ b/src/components/mdx.tsx @@ -127,5 +127,5 @@ export function Property({ ) } -import PG from './PayloadGenerator'; -export const PayloadGenerator = PG; \ No newline at end of file +import PG from './PayloadGenerator' +export const PayloadGenerator = PG \ No newline at end of file diff --git a/typography.ts b/typography.ts index b512ccb..c003e8d 100644 --- a/typography.ts +++ b/typography.ts @@ -27,9 +27,7 @@ export default { '--tw-prose-invert-headings': theme('colors.white'), '--tw-prose-invert-links': theme('colors.blue.400'), '--tw-prose-invert-links-hover': theme('colors.blue.500'), - '--tw-prose-invert-links-underline': theme( - 'colors.blue.500 / 0.3', - ), + '--tw-prose-invert-links-underline': theme('colors.blue.500 / 0.3'), '--tw-prose-invert-bold': theme('colors.white'), '--tw-prose-invert-counters': theme('colors.zinc.400'), '--tw-prose-invert-bullets': theme('colors.zinc.600'), @@ -195,6 +193,14 @@ export default { marginTop: theme('spacing.10'), marginBottom: theme('spacing.2'), }, + h4: { + color: 'var(--tw-prose-headings)', + fontSize: theme('fontSize.sm')[0], + ...theme('fontSize.base')[1], + fontWeight: '500', + marginTop: theme('spacing.4'), + marginBottom: theme('spacing.2'), + }, // Media 'img, video, figure': {