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
13
.drone.yml
13
.drone.yml
|
@ -2,9 +2,18 @@ kind: pipeline
|
|||
name: default
|
||||
|
||||
steps:
|
||||
- name: fetch git submodules
|
||||
image: alpine/git
|
||||
commands:
|
||||
- git submodule init
|
||||
- git submodule update --recursive --remote
|
||||
|
||||
- name: check documentation build
|
||||
image: rust:1.49-slim-buster
|
||||
commands:
|
||||
- cargo install mdbook --git https://github.com/Nutomic/mdBook.git --branch localization
|
||||
--rev 0982a82 --force --debug
|
||||
- cargo install mdbook --git https://github.com/Ruin0x11/mdBook.git --branch localization
|
||||
--rev 9d8147c --force --debug
|
||||
- apt-get update
|
||||
- apt-get install curl -y
|
||||
- ./update-includes.sh
|
||||
- mdbook build .
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
book
|
||||
include
|
||||
node_modules
|
||||
.idea
|
||||
|
|
|
@ -10,7 +10,8 @@ Our documentation tool [mdbook](https://github.com/rust-lang/mdBook) doesn't sup
|
|||
|
||||
```bash
|
||||
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
|
||||
mdbook build
|
||||
# serve the book at `http://localhost:3000`, and rebuilds on changes
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# 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 `config.hjson` file is located at `config/config.hjson`. To change the default location, you can set the environment variable `LEMMY_CONFIG_LOCATION`.
|
||||
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`.
|
||||
|
||||
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.
|
||||
|
||||
## 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)
|
||||
|
||||
```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"
|
||||
}
|
||||
}
|
||||
{{#include ../../../include/activitypub/lemmy-community.json}}
|
||||
```
|
||||
|
||||
| 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)
|
||||
|
||||
```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"
|
||||
}
|
||||
}
|
||||
{{#include ../../../include/activitypub/lemmy-person.json}}
|
||||
```
|
||||
|
||||
| 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.
|
||||
|
||||
```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"
|
||||
}
|
||||
{{#include ../../../include/activitypub/lemmy-post.json}}
|
||||
```
|
||||
|
||||
| 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.
|
||||
|
||||
```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"
|
||||
}
|
||||
{{#include ../../../include/activitypub/lemmy-comment.json}}
|
||||
```
|
||||
|
||||
| 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.
|
||||
|
||||
```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"
|
||||
}
|
||||
{{#include ../../../include/activitypub/lemmy-private-message.json}}
|
||||
```
|
||||
|
||||
| Field Name | Mandatory | Description |
|
||||
|
|
|
@ -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 New Issue