mirror of
https://github.com/LemmyNet/lemmy-docs.git
synced 2024-11-23 04:41:11 +00:00
Generate config docs from lemmy code (#102)
* Generate config docs from lemmy code * fix mkdir error in build.sh, update lemmy submodule * fix drone config * init git submodule * install git * apt update * -y * dont do submodule init * x * w * update gitignore * xz * remove submodule * readd submodule * step * update rust * deps * use defaults.hjson from lemmy without building, also include apub examples * use updated mdbook from upstream pr https://github.com/rust-lang/mdBook/pull/1306#issuecomment-920429495 * Download embeds over http instead of using git submodule * install curl * apt update * typo * -y
This commit is contained in:
parent
aae2800e4e
commit
06a3da7d42
7 changed files with 42 additions and 135 deletions
13
.drone.yml
13
.drone.yml
|
@ -2,9 +2,18 @@ kind: pipeline
|
||||||
name: default
|
name: default
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: fetch git submodules
|
||||||
|
image: alpine/git
|
||||||
|
commands:
|
||||||
|
- git submodule init
|
||||||
|
- git submodule update --recursive --remote
|
||||||
|
|
||||||
- name: check documentation build
|
- name: check documentation build
|
||||||
image: rust:1.49-slim-buster
|
image: rust:1.49-slim-buster
|
||||||
commands:
|
commands:
|
||||||
- cargo install mdbook --git https://github.com/Nutomic/mdBook.git --branch localization
|
- cargo install mdbook --git https://github.com/Ruin0x11/mdBook.git --branch localization
|
||||||
--rev 0982a82 --force --debug
|
--rev 9d8147c --force --debug
|
||||||
|
- apt-get update
|
||||||
|
- apt-get install curl -y
|
||||||
|
- ./update-includes.sh
|
||||||
- mdbook build .
|
- mdbook build .
|
||||||
|
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1 +1,4 @@
|
||||||
book
|
book
|
||||||
|
include
|
||||||
|
node_modules
|
||||||
|
.idea
|
||||||
|
|
0
.gitmodules
vendored
Normal file
0
.gitmodules
vendored
Normal file
|
@ -10,7 +10,8 @@ Our documentation tool [mdbook](https://github.com/rust-lang/mdBook) doesn't sup
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install mdbook --git https://github.com/Ruin0x11/mdBook.git \
|
cargo install mdbook --git https://github.com/Ruin0x11/mdBook.git \
|
||||||
--branch localization --rev d06249b
|
--branch localization --rev 9d8147c
|
||||||
|
./update-includes.sh
|
||||||
# generate static page in `book` subfolder
|
# generate static page in `book` subfolder
|
||||||
mdbook build
|
mdbook build
|
||||||
# serve the book at `http://localhost:3000`, and rebuilds on changes
|
# serve the book at `http://localhost:3000`, and rebuilds on changes
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
The configuration is based on the file [config.hjson](https://github.com/lemmynet/lemmy/blob/main/config/config.hjson). This file also contains documentation for all the available options. The install instructions tell you how to override the defaults.
|
The configuration is based on the file config.hjson, which is located by default at `config/config.hjson`. To change the default location, you can set the environment variable `LEMMY_CONFIG_LOCATION`.
|
||||||
|
|
||||||
The `config.hjson` file is located at `config/config.hjson`. To change the default location, you can set the environment variable `LEMMY_CONFIG_LOCATION`.
|
|
||||||
|
|
||||||
An additional environment variable `LEMMY_DATABASE_URL` is available, which can be used with a PostgreSQL connection string like `postgres://lemmy:password@lemmy_db:5432/lemmy`, passing all connection details at once.
|
An additional environment variable `LEMMY_DATABASE_URL` is available, which can be used with a PostgreSQL connection string like `postgres://lemmy:password@lemmy_db:5432/lemmy`, passing all connection details at once.
|
||||||
|
|
||||||
|
@ -14,3 +12,9 @@ cd server
|
||||||
```
|
```
|
||||||
|
|
||||||
**Federation is not set up by default.** You can add this [this federation block](https://github.com/lemmynet/lemmy/blob/main/config/config.hjson#L64) to your `lemmy.hjson`, and ask other servers to add you to their allowlist.
|
**Federation is not set up by default.** You can add this [this federation block](https://github.com/lemmynet/lemmy/blob/main/config/config.hjson#L64) to your `lemmy.hjson`, and ask other servers to add you to their allowlist.
|
||||||
|
|
||||||
|
## Full config with default values
|
||||||
|
|
||||||
|
```hjson
|
||||||
|
{{#include ../../../include/config/defaults.hjson}}
|
||||||
|
```
|
|
@ -84,42 +84,7 @@ Sends activities to user: `Accept/Follow`, `Announce`
|
||||||
Receives activities from user: `Follow`, `Undo/Follow`, `Create`, `Update`, `Like`, `Dislike`, `Remove` (only admin/mod), `Delete` (only creator), `Undo` (only for own actions)
|
Receives activities from user: `Follow`, `Undo/Follow`, `Create`, `Update`, `Like`, `Dislike`, `Remove` (only admin/mod), `Delete` (only creator), `Undo` (only for own actions)
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{{#include ../../../include/activitypub/lemmy-community.json}}
|
||||||
"@context": ...,
|
|
||||||
"id": "https://enterprise.lemmy.ml/c/main",
|
|
||||||
"type": "Group",
|
|
||||||
"preferredUsername": "main",
|
|
||||||
"name": "The Main Community",
|
|
||||||
"sensitive": false,
|
|
||||||
"content": "Welcome to the default community!",
|
|
||||||
"mediaType": "text/html",
|
|
||||||
"source": {
|
|
||||||
"content": "Welcome to the default community!",
|
|
||||||
"mediaType": "text/markdown"
|
|
||||||
},
|
|
||||||
"icon": {
|
|
||||||
"type": "Image",
|
|
||||||
"url": "https://enterprise.lemmy.ml/pictrs/image/Z8pFFb21cl.png"
|
|
||||||
},
|
|
||||||
"image": {
|
|
||||||
"type": "Image",
|
|
||||||
"url": "https://enterprise.lemmy.ml/pictrs/image/Wt8zoMcCmE.jpg"
|
|
||||||
},
|
|
||||||
"inbox": "https://enterprise.lemmy.ml/c/main/inbox",
|
|
||||||
"outbox": "https://enterprise.lemmy.ml/c/main/outbox",
|
|
||||||
"followers": "https://enterprise.lemmy.ml/c/main/followers",
|
|
||||||
"moderators": "https://enterprise.lemmy.ml/c/main/moderators",
|
|
||||||
"endpoints": {
|
|
||||||
"sharedInbox": "https://enterprise.lemmy.ml/inbox"
|
|
||||||
},
|
|
||||||
"published": "2020-10-06T17:27:43.282386+00:00",
|
|
||||||
"updated": "2020-10-08T11:57:50.545821+00:00",
|
|
||||||
"publicKey": {
|
|
||||||
"id": "https://enterprise.lemmy.ml/c/main#main-key",
|
|
||||||
"owner": "https://enterprise.lemmy.ml/c/main",
|
|
||||||
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9JJ7Ybp/H7iXeLkWFepg\ny4PHyIXY1TO9rK3lIBmAjNnkNywyGXMgUiiVhGyN9yU7Km8aWayQsNHOkPL7wMZK\nnY2Q+CTQv49kprEdcDVPGABi6EbCSOcRFVaUjjvRHf9Olod2QP/9OtX0oIFKN2KN\nPIUjeKK5tw4EWB8N1i5HOuOjuTcl2BXSemCQLAlXerLjT8xCarGi21xHPaQvAuns\nHt8ye7fUZKPRT10kwDMapjQ9Tsd+9HeBvNa4SDjJX1ONskNh2j4bqHHs2WUymLpX\n1cgf2jmaXAsz6jD9u0wfrLPelPJog8RSuvOzDPrtwX6uyQOl5NK00RlBZwj7bMDx\nzwIDAQAB\n-----END PUBLIC KEY-----\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
| Field Name | Mandatory | Description |
|
| Field Name | Mandatory | Description |
|
||||||
|
@ -194,38 +159,7 @@ Receives activities from Community: `Accept/Follow`, `Announce`
|
||||||
Sends and receives activities from/to other users: `Create/Note`, `Update/Note`, `Delete/Note`, `Undo/Delete/Note` (all those related to private messages)
|
Sends and receives activities from/to other users: `Create/Note`, `Update/Note`, `Delete/Note`, `Undo/Delete/Note` (all those related to private messages)
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{{#include ../../../include/activitypub/lemmy-person.json}}
|
||||||
"@context": ...,
|
|
||||||
"id": "https://enterprise.lemmy.ml/u/picard",
|
|
||||||
"type": "Person",
|
|
||||||
"preferredUsername": "picard",
|
|
||||||
"name": "Jean-Luc Picard",
|
|
||||||
"content": "The user bio",
|
|
||||||
"mediaType": "text/html",
|
|
||||||
"source": {
|
|
||||||
"content": "The user bio",
|
|
||||||
"mediaType": "text/markdown"
|
|
||||||
},
|
|
||||||
"icon": {
|
|
||||||
"type": "Image",
|
|
||||||
"url": "https://enterprise.lemmy.ml/pictrs/image/DS3q0colRA.jpg"
|
|
||||||
},
|
|
||||||
"image": {
|
|
||||||
"type": "Image",
|
|
||||||
"url": "https://enterprise.lemmy.ml/pictrs/image/XenaYI5hTn.png"
|
|
||||||
},
|
|
||||||
"inbox": "https://enterprise.lemmy.ml/u/picard/inbox",
|
|
||||||
"endpoints": {
|
|
||||||
"sharedInbox": "https://enterprise.lemmy.ml/inbox"
|
|
||||||
},
|
|
||||||
"published": "2020-10-06T17:27:43.234391+00:00",
|
|
||||||
"updated": "2020-10-08T11:27:17.905625+00:00",
|
|
||||||
"publicKey": {
|
|
||||||
"id": "https://enterprise.lemmy.ml/u/picard#main-key",
|
|
||||||
"owner": "https://enterprise.lemmy.ml/u/picard",
|
|
||||||
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyH9iH83+idw/T4QpuRSY\n5YgQ/T5pJCNxvQWb6qcCu3gEVigfbreqZKJpOih4YT36wu4GjPfoIkbWJXcfcEzq\nMEQoYbPStuwnklpN2zj3lRIPfGLht9CAlENLWikTUoW5kZLyU6UQtOGdT2b1hDuK\nsUEn67In6qYx6pal8fUbO6X3O2BKzGeofnXgHCu7QNIuH4RPzkWsLhvwqEJYP0zG\nodao2j+qmhKFsI4oNOUCGkdJejO7q+9gdoNxAtNNKilIOwUFBYXeZJb+XGlzo0X+\n70jdJ/xQCPlPlItU4pD/0FwPLtuReoOpMzLi20oDsPXJBvn+/NJaxqDINuywcN5p\n4wIDAQAB\n-----END PUBLIC KEY-----\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
| Field Name | Mandatory | Description |
|
| Field Name | Mandatory | Description |
|
||||||
|
@ -262,33 +196,7 @@ The user inbox is not actually implemented yet, and is only a placeholder for Ac
|
||||||
A page with title, and optional URL and text content. The URL often leads to an image, in which case a thumbnail is included. Each post belongs to exactly one community.
|
A page with title, and optional URL and text content. The URL often leads to an image, in which case a thumbnail is included. Each post belongs to exactly one community.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{{#include ../../../include/activitypub/lemmy-post.json}}
|
||||||
"@context": ...,
|
|
||||||
"id": "https://voyager.lemmy.ml/post/29",
|
|
||||||
"type": "Page",
|
|
||||||
"attributedTo": "https://voyager.lemmy.ml/u/picard",
|
|
||||||
"to": [
|
|
||||||
"https://voyager.lemmy.ml/c/main",
|
|
||||||
"https://www.w3.org/ns/activitystreams#Public"
|
|
||||||
],
|
|
||||||
"name": "Test thumbnail 2",
|
|
||||||
"content": "blub blub",
|
|
||||||
"mediaType": "text/html",
|
|
||||||
"source": {
|
|
||||||
"content": "blub blub",
|
|
||||||
"mediaType": "text/markdown"
|
|
||||||
},
|
|
||||||
"url": "https://voyager.lemmy.ml:/pictrs/image/fzGwCsq7BJ.jpg",
|
|
||||||
"image": {
|
|
||||||
"type": "Image",
|
|
||||||
"url": "https://voyager.lemmy.ml/pictrs/image/UejwBqrJM2.jpg"
|
|
||||||
},
|
|
||||||
"commentsEnabled": true,
|
|
||||||
"sensitive": false,
|
|
||||||
"stickied": false,
|
|
||||||
"published": "2020-09-24T17:42:50.396237+00:00",
|
|
||||||
"updated": "2020-09-24T18:31:14.158618+00:00"
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
| Field Name | Mandatory | Description |
|
| Field Name | Mandatory | Description |
|
||||||
|
@ -310,25 +218,7 @@ A page with title, and optional URL and text content. The URL often leads to an
|
||||||
A reply to a post, or reply to another comment. Contains only text (including references to other users or communities). Lemmy displays comments in a tree structure.
|
A reply to a post, or reply to another comment. Contains only text (including references to other users or communities). Lemmy displays comments in a tree structure.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{{#include ../../../include/activitypub/lemmy-comment.json}}
|
||||||
"@context": ...,
|
|
||||||
"id": "https://enterprise.lemmy.ml/comment/95",
|
|
||||||
"type": "Note",
|
|
||||||
"attributedTo": "https://enterprise.lemmy.ml/u/picard",
|
|
||||||
"to": "https://www.w3.org/ns/activitystreams#Public",
|
|
||||||
"content": "mmmk",
|
|
||||||
"mediaType": "text/html",
|
|
||||||
"source": {
|
|
||||||
"content": "mmmk",
|
|
||||||
"mediaType": "text/markdown"
|
|
||||||
},
|
|
||||||
"inReplyTo": [
|
|
||||||
"https://enterprise.lemmy.ml/post/38",
|
|
||||||
"https://voyager.lemmy.ml/comment/73"
|
|
||||||
],
|
|
||||||
"published": "2020-10-06T17:53:22.174836+00:00",
|
|
||||||
"updated": "2020-10-06T17:53:22.174836+00:00"
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
| Field Name | Mandatory | Description |
|
| Field Name | Mandatory | Description |
|
||||||
|
@ -345,21 +235,7 @@ A reply to a post, or reply to another comment. Contains only text (including re
|
||||||
A direct message from one user to another. Can not include additional users. Threading is not implemented yet, so the `inReplyTo` field is missing.
|
A direct message from one user to another. Can not include additional users. Threading is not implemented yet, so the `inReplyTo` field is missing.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{{#include ../../../include/activitypub/lemmy-private-message.json}}
|
||||||
"@context": ...,
|
|
||||||
"id": "https://enterprise.lemmy.ml/private_message/34",
|
|
||||||
"type": "Note",
|
|
||||||
"attributedTo": "https://enterprise.lemmy.ml/u/picard",
|
|
||||||
"to": "https://voyager.lemmy.ml/u/janeway",
|
|
||||||
"content": "test",
|
|
||||||
"source": {
|
|
||||||
"content": "test",
|
|
||||||
"mediaType": "text/markdown"
|
|
||||||
},
|
|
||||||
"mediaType": "text/markdown",
|
|
||||||
"published": "2020-10-08T19:10:46.542820+00:00",
|
|
||||||
"updated": "2020-10-08T20:13:52.547156+00:00"
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
| Field Name | Mandatory | Description |
|
| Field Name | Mandatory | Description |
|
||||||
|
|
14
update-includes.sh
Executable file
14
update-includes.sh
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mkdir -p include/config
|
||||||
|
mkdir -p include/activitypub
|
||||||
|
cd include/config
|
||||||
|
curl https://raw.githubusercontent.com/LemmyNet/lemmy/main/config/defaults.hjson -o defaults.hjson
|
||||||
|
|
||||||
|
cd ../activitypub
|
||||||
|
curl https://raw.githubusercontent.com/LemmyNet/lemmy/main/crates/apub/assets/lemmy-person.json -o lemmy-person.json
|
||||||
|
curl https://raw.githubusercontent.com/LemmyNet/lemmy/main/crates/apub/assets/lemmy-community.json -o lemmy-community.json
|
||||||
|
curl https://raw.githubusercontent.com/LemmyNet/lemmy/main/crates/apub/assets/lemmy-post.json -o lemmy-post.json
|
||||||
|
curl https://raw.githubusercontent.com/LemmyNet/lemmy/main/crates/apub/assets/lemmy-comment.json -o lemmy-comment.json
|
||||||
|
curl https://raw.githubusercontent.com/LemmyNet/lemmy/main/crates/apub/assets/lemmy-private-message.json -o lemmy-private-message.json
|
Loading…
Reference in a new issue