diff --git a/README.md b/README.md index 6e63a067..0c4c0fef 100644 --- a/README.md +++ b/README.md @@ -4,63 +4,7 @@ Content database for Minetest mods, games, and more.\ Developed by rubenwardy, license GPLv3.0+. -## Getting started (debug/dev) - -Docker is the recommended way to develop and deploy ContentDB. - -1. Install `docker` and `docker-compose`. - - Debian/Ubuntu: - - sudo apt install docker-ce docker-compose - -2. Copy `config.example.cfg` to `config.cfg`. - - 1. Set `SECRET_KEY` and `WTF_CSRF_SECRET_KEY` to different random values. - -3. (Optional) Set up mail in config.cfg. - Make sure to set `USER_ENABLE_EMAIL` to True. - -4. (Optional) Set up GitHub integration - 1. Make a Github OAuth Client at : - 2. Homepage URL - `http://localhost:5123/` - 3. Authorization callback URL - `http://localhost:5123/user/github/callback/` - 4. Put client id and client secret in `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` in config.cfg. - -5. Create config.env: - - POSTGRES_USER=contentdb - POSTGRES_PASSWORD=password - POSTGRES_DB=contentdb - FLASK_DEBUG=1 - -6. Start docker images: - - docker-compose up --build - -7. Setup database: - - ./utils/run_migrations.sh - -8. Create initial data - 1. `./utils/bash.sh` - 2. Either `python utils/setup.py -t` or `python utils/setup.py -o`: - 1. `-o` creates just the admin, and static data like tags, and licenses. - 2. `-t` will do `-o` and also create test packages. (Recommended) - -9. View at . - The admin username is `rubenwardy` and the password is `tuckfrump`. - -In the future, starting CDB is as simple as: - - docker-compose up --build - -To hot/live update CDB whilst it is running, use: - - ./utils/reload.sh - -This will only work with python code and templates, it won't update tasks or config. - +See [Getting Started](docs/getting_started.md). ## How-tos diff --git a/docs/getting_started.md b/docs/getting_started.md new file mode 100644 index 00000000..1c87ae84 --- /dev/null +++ b/docs/getting_started.md @@ -0,0 +1,56 @@ +# Getting started + +Docker is the recommended way to develop and deploy ContentDB. + +1. Install `docker` and `docker-compose`. + + Debian/Ubuntu: + + sudo apt install docker-ce docker-compose + +2. Copy `config.example.cfg` to `config.cfg`. + + 1. Set `SECRET_KEY` and `WTF_CSRF_SECRET_KEY` to different random values. + +3. (Optional) Set up mail in config.cfg. + Make sure to set `USER_ENABLE_EMAIL` to True. + +4. (Optional) Set up GitHub integration + 1. Make a Github OAuth Client at : + 2. Homepage URL - `http://localhost:5123/` + 3. Authorization callback URL - `http://localhost:5123/user/github/callback/` + 4. Put client id and client secret in `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET` in config.cfg. + +5. Create config.env: + + POSTGRES_USER=contentdb + POSTGRES_PASSWORD=password + POSTGRES_DB=contentdb + FLASK_DEBUG=1 + +6. Start docker images: + + docker-compose up --build + +7. Setup database: + + ./utils/run_migrations.sh + +8. Create initial data + 1. `./utils/bash.sh` + 2. Either `python utils/setup.py -t` or `python utils/setup.py -o`: + 1. `-o` creates just the admin, and static data like tags, and licenses. + 2. `-t` will do `-o` and also create test packages. (Recommended) + +9. View at . + The admin username is `rubenwardy` and the password is `tuckfrump`. + +In the future, starting CDB is as simple as: + + docker-compose up --build + +To hot/live update CDB whilst it is running, use: + + ./utils/reload.sh + +This will only work with python code and templates, it won't update tasks or config. diff --git a/docs/minetest_client.md b/docs/minetest_client.md new file mode 100644 index 00000000..e2feb55c --- /dev/null +++ b/docs/minetest_client.md @@ -0,0 +1,58 @@ +# Minetest's use of the API + +This document explains how Minetest's ContentDB client interacts with ContentDB. +This is useful both for implementing your own client for ContentDB to install mods, +or for implementing ContentDB compatible servers. + +## Package List API call + +The first request the client makes is to `/api/packages/`. +The client will provide a list of supported types, the current engine version information, +and any hidden [Content Flags](https://content.minetest.net/help/content_flags/). + +Because the client specifies the engine version information, the response must contain a release +number and the package must be downloadable. + +Example URL: + + +Example response: + +```json +[ + { + "author": "Wuzzy", + "name": "mineclone2", + "release": 4209, + "short_description": "A short description", + "thumbnail": "https://content.minetest.net/thumbnails/1/tgbH5CwlAZ.jpg", + "title": "MineClone 2", + "type": "game" + } +] +``` + +## Screenshots + +The client can simply download the URL mentioned in `thumbnail`. + +## Downloading and installing + +The client downloads packages by constructing a URL for the release and downloading it: + +``` +https://content.minetest.net/packages///releases//download/ +``` + +This supports redirects. + +The client will edit the .conf of the installed content to add `author`, `name`, and `release` to +track the installed release to detect updates in the future. + +## View in browser + +The client will open the package in a browser by constructing the following URL + +``` +https://content.minetest.net/packages/// +```