mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-08 08:33:45 +01:00
Improve documentation
This commit is contained in:
parent
ce4c2142e2
commit
8fad3a15cd
58
README.md
58
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 <https://github.com/settings/developers>:
|
||||
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 <http://localhost:5123>.
|
||||
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
|
||||
|
||||
|
56
docs/getting_started.md
Normal file
56
docs/getting_started.md
Normal file
@ -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 <https://github.com/settings/developers>:
|
||||
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 <http://localhost:5123>.
|
||||
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.
|
58
docs/minetest_client.md
Normal file
58
docs/minetest_client.md
Normal file
@ -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:
|
||||
<https://content.minetest.net/api/packages/?type=mod&type=game&type=txp&protocol_version=39&engine_version=5.3.0&hide=nonfree&hide=desktop_default>
|
||||
|
||||
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/<author>/<name>/releases/<release>/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/<author>/<name>/
|
||||
```
|
Loading…
Reference in New Issue
Block a user