From 7d2a1c6952d5db0687381868c2a7ec3db1538861 Mon Sep 17 00:00:00 2001 From: DecDuck Date: Fri, 25 Oct 2024 13:15:46 +1100 Subject: [PATCH] starting docs infra --- .vscode/settings.json | 6 + components/DocsSidebar.vue | 50 ++ components/DocsSidebarNavItem.vue | 30 + dev-tools/compose.yml | 3 +- docs/.about.txt | 1 + docs/1.index.md | 3 + docs/about/1.API.md | 23 + docs/about/clients.md | 11 + docs/about/index.md | 5 + layouts/docs.vue | 124 +++ nuxt.config.ts | 30 +- package.json | 1 + pages/docs/[...id].vue | 91 +++ pages/index.vue | 18 +- pages/store/[id]/index.vue | 2 +- yarn.lock | 1268 ++++++++++++++++++++++++++++- 16 files changed, 1647 insertions(+), 19 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 components/DocsSidebar.vue create mode 100644 components/DocsSidebarNavItem.vue create mode 100644 docs/.about.txt create mode 100644 docs/1.index.md create mode 100644 docs/about/1.API.md create mode 100644 docs/about/clients.md create mode 100644 docs/about/index.md create mode 100644 layouts/docs.vue create mode 100644 pages/docs/[...id].vue diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..42e000e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "spellchecker.ignoreWordsList": [ + "mTLS", + "Wireguard" + ] +} \ No newline at end of file diff --git a/components/DocsSidebar.vue b/components/DocsSidebar.vue new file mode 100644 index 0000000..a8d1ed1 --- /dev/null +++ b/components/DocsSidebar.vue @@ -0,0 +1,50 @@ + + + diff --git a/components/DocsSidebarNavItem.vue b/components/DocsSidebarNavItem.vue new file mode 100644 index 0000000..ae6e96a --- /dev/null +++ b/components/DocsSidebarNavItem.vue @@ -0,0 +1,30 @@ + + + diff --git a/dev-tools/compose.yml b/dev-tools/compose.yml index efc01bd..bd37f6e 100644 --- a/dev-tools/compose.yml +++ b/dev-tools/compose.yml @@ -1,6 +1,7 @@ services: postgres: image: postgres:14-alpine + user: "1000:1000" ports: - 5432:5432 volumes: @@ -20,4 +21,4 @@ services: environment: - MINIO_ROOT_USER=drop - MINIO_ROOT_PASSWORD=drop - command: server /data --console-address ":9001" \ No newline at end of file + command: server /data --console-address ":9001" diff --git a/docs/.about.txt b/docs/.about.txt new file mode 100644 index 0000000..f467bc0 --- /dev/null +++ b/docs/.about.txt @@ -0,0 +1 @@ +These docs are automatically compiled in the Drop UI and are designed for admins and users to understand how Drop works. diff --git a/docs/1.index.md b/docs/1.index.md new file mode 100644 index 0000000..1b8ede0 --- /dev/null +++ b/docs/1.index.md @@ -0,0 +1,3 @@ +# Home + +This page is intentionally left blank, as it should be replaced with a custom home page. diff --git a/docs/about/1.API.md b/docs/about/1.API.md new file mode 100644 index 0000000..0d96ddc --- /dev/null +++ b/docs/about/1.API.md @@ -0,0 +1,23 @@ +# API + +All Drop components communicate through HTTP-based APIs. However, due to the different use-cases they differ in how they are used. + +## Frontend APIs + +Frontend APIs run on the server, and are found under `/api/v1/`. They are used to render the web frontend, and are focused around user-based control of Drop systems. + +For example, frontend APIs are responsible for uploading profile pictures, customizing your profile and adding friends. + +The frontend, however, does not have access to some Drop features, namely downloading content. That feature is reserved for the client APIs, where it is actually used. + +## Client APIs + +Client APIs run on the server, and are found under `/api/v1/client/`. They are used by Drop clients (namely the desktop client) to manage, download and communicate with other Drop clients. They have a very specific feature set, and are limited in how they can change user profiles. + +For example, client APIs have the ability to download content, setup P2P connections and report game activity. However, they do not have access to user profile management or administrator controls. + +## P2P APIs + +P2P APIs run on Drop clients, and are found at the root of the HTTP server. They are used by other Drop clients to download content and negotiate P2P features. They use mTLS authentication as a lightweight and efficient way to do peer to peer authentication. + +For example, P2P APIs would be used to negotiate a Wireguard tunnel to do Remote LAN play. diff --git a/docs/about/clients.md b/docs/about/clients.md new file mode 100644 index 0000000..cfad6a2 --- /dev/null +++ b/docs/about/clients.md @@ -0,0 +1,11 @@ +# Clients + +Drop clients connected to a given Drop server can access: + +- Game content and files (to download) +- User data +- Game metadata and images +- Information about other clients connected to the same Drop server + +**It is important that you trust the client that you grant access to your Drop account.** + diff --git a/docs/about/index.md b/docs/about/index.md new file mode 100644 index 0000000..d01acf9 --- /dev/null +++ b/docs/about/index.md @@ -0,0 +1,5 @@ +# About + +This section is about what Drop does, and how it works. For users interested in the inner workings of Drop, this will go through many of the design decisions, why they were made and more! + +For users that don't care how Drop works, and want help using Drop, look under other sections. This section is purely technical and theoretical. \ No newline at end of file diff --git a/layouts/docs.vue b/layouts/docs.vue new file mode 100644 index 0000000..e2305ed --- /dev/null +++ b/layouts/docs.vue @@ -0,0 +1,124 @@ + + + diff --git a/nuxt.config.ts b/nuxt.config.ts index f031654..f66cab8 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,9 +1,12 @@ +import path from "path"; + // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ + // Nuxt-only config compatibilityDate: "2024-04-03", devtools: { enabled: false }, - css: ["~/assets/core.scss"], + postcss: { plugins: { tailwindcss: {}, @@ -22,4 +25,29 @@ export default defineNuxtConfig({ websocket: true, }, }, + + watchers: { + chokidar: { + ignored: ".data", + }, + }, + + // Module config from here down + modules: ["@nuxt/content"], + + content: { + api: { + baseURL: "/api/v1/_content", + }, + markdown: { + anchorLinks: false, + }, + sources: { + content: { + driver: "fs", + prefix: "/docs", + base: path.resolve(__dirname, "docs"), + }, + }, + }, }); diff --git a/package.json b/package.json index ace264f..06909fe 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@drop/droplet": "^0.5.1", "@headlessui/vue": "^1.7.23", "@heroicons/vue": "^2.1.5", + "@nuxt/content": "^2.13.4", "@prisma/client": "5.20.0", "axios": "^1.7.7", "bcrypt": "^5.1.1", diff --git a/pages/docs/[...id].vue b/pages/docs/[...id].vue new file mode 100644 index 0000000..e560fac --- /dev/null +++ b/pages/docs/[...id].vue @@ -0,0 +1,91 @@ + + + diff --git a/pages/index.vue b/pages/index.vue index cc11b96..5eb8881 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,16 +1,20 @@