Skip to content
This repository was archived by the owner on Jun 22, 2023. It is now read-only.

Commit 438f352

Browse files
committed
fix: format markdown
1 parent 0470414 commit 438f352

File tree

10 files changed

+307
-125
lines changed

10 files changed

+307
-125
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Torrust Documentation
2-
This is the documentation site for all Torrust projects.
2+
3+
This is the documentation site for the Torrust [Tracker](https://github.com/torrust/torrust-tracker) and [Index](https://github.com/torrust/torrust-index).
34

45
## Installation
5-
### Prerequisites (installed)
6+
7+
__Prerequisites:__
68

79
- [Python](https://www.python.org/)
810
- [pip](https://pip.pypa.io/en/stable/installing/)
@@ -16,29 +18,25 @@ pip3 install mkdocs
1618
pip3 install mkdocs-material
1719
```
1820

19-
### Project Files
20-
21-
Clone repo:
21+
__Install:__
2222

2323
```bash
2424
git clone https://github.com/torrust/torrust-documentation.git
2525
```
2626

2727
## Usage
2828

29-
### Run Development
29+
__Run for development:__
3030

3131
Navigate to the project folder (docs) and run the following command:
3232

3333
```bash
3434
mkdocs serve
3535
```
3636

37-
### Test Development
38-
3937
Visit `http://localhost:8000` to see live changes.
4038

41-
### Run Production
39+
__Run for production:__
4240

4341
Navigate to the project folder (docs) and build the static site:
4442

@@ -49,5 +47,5 @@ mkdocs build
4947
Publish the newly built docs/site folder using NGINX or Apache.
5048

5149
## Contributing
52-
Please report any bugs you find to our issue tracker. Ideas and feature requests are welcome as well!
53-
Any pull request targeting existing issues would be very much appreciated.
50+
51+
Please report any bugs you find to our issue tracker. Ideas and feature requests are welcome as well! Any pull request targeting existing issues would be very much appreciated.

cspell.config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
$schema: https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json
3+
version: '0.2'
4+
dictionaryDefinitions:
5+
- name: project-words
6+
path: './project-words.txt'
7+
addWords: true
8+
dictionaries:
9+
- project-words
10+
ignorePaths:
11+
- '/project-words.txt'

docs/torrust-index/api.md

Lines changed: 71 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,51 @@
1-
# REST API
1+
# Index REST API
2+
23
> This page is heavy WIP and missing a lot of endpoints from the newest torrust-index.
4+
35
## Authorization
6+
47
Some routes can only be accessed by logged in users.
58
For these routes you have to send the token obtained in [/user/login](api.md#login) in the `Authorization` header as a bearer token.
6-
<br><br>
9+
710
For example:
11+
812
```http
913
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJleGFtcGxlX3VzZXIiLCJleHAiOjE2MzIyNTQxNjZ9.kyugZXiR88q4n6Ze44HonazDp-sJdq886te9-XHthHg
1014
```
1115

1216
## Errors
17+
1318
Every route always returns a non `2xx` status code for an error.
1419
If the error is caused by user input the status code will be in the `4xx` range.
1520
Unrecoverable server errors return a `500` status code.
1621

1722
Every error contains a error message that is safe to display to an user.
1823
The body of an error _should_ always look like this:
24+
1925
```json
2026
{
2127
"error": "<error message>"
2228
}
2329
```
2430

2531
## Torrent
32+
2633
### `GET /torrents`
34+
2735
Get all torrent information of the listing with `id`, used for loading the data of the TorrentDetails page.
2836

29-
__Optional query params__
37+
__Optional query params:__
3038

3139
| Param | Description | Value | Example |
3240
|------------|-----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------|
3341
| categories | Included categories. | Comma seperated list. | ?categories=music,other,movies |
3442
| search | Search term. | String. | &search=bunny |
3543
| sort | Sorting and sort direction. | `uploaded_ASC`, `uploaded_DESC`, `seeders_ASC`, `seeders_DESC`, `leechers_ASC`, `leechers_DESC`, `name_ASC`, `name_DESC`, `size_ASC`, `size_DESC` |&sort=size_DESC|
3644

37-
__Response__:
45+
__Response:__
46+
3847
- On success: Status `200`.
48+
3949
```json
4050
{
4151
"data": {
@@ -57,44 +67,55 @@ __Response__:
5767
}
5868
}
5969
```
70+
6071
---
6172

6273
### `POST /torrent/upload`
74+
6375
Upload a torrent file and create a torrent listing for it in the index.
6476

65-
Consumes a __mutipart__ form with the fields:
77+
Consumes a __multipart__ form with the fields:
78+
6679
- `title`: Title of the torrent listing.
6780
- `description`: A Markdown description.
6881
- `category`: Category this torrent fits in.
6982
- `torrent`: The torrent file itself.
7083

71-
__Response__:
84+
__Response:__
85+
7286
- On success: Status `200`, returns id of the newly created torrent listing.
87+
7388
```json
7489
{
75-
"data": {
76-
"torrent_id": 1
77-
}
90+
"data": {
91+
"torrent_id": 1
92+
}
7893
}
7994
```
95+
8096
- On error: Standard error, see [Errors](api.md#errors)
8197

8298
---
8399

84100
### `GET /torrent/download/<id>`
85-
Generate and download torrent file with a personal annouce URL for the authenticated user.
86101

87-
__Response__:
88-
- On success: Status `200`, Personalised .torrent file stream.
102+
Generate and download torrent file with a personal announce URL for the authenticated user.
103+
104+
__Response:__
105+
106+
- On success: Status `200`, Personalized .torrent file stream.
89107
- On error: Standard error, see [Errors](api.md#errors)
90108

91109
---
92110

93111
### `GET /torrent/<id>`
112+
94113
Get all torrent information of the listing with `id`, used for loading the data of the TorrentDetails page.
95114

96115
__Response__:
116+
97117
- On success: Status `200`.
118+
98119
```json
99120
{
100121
"data": {
@@ -112,16 +133,21 @@ __Response__:
112133
}
113134
}
114135
```
136+
115137
- On error: Standard error, see [Errors](api.md#errors)
116138

117139
---
118140

119141
## Category
142+
120143
### `GET /category`
144+
121145
Get a list of existing categories.
122146

123147
__Response__:
148+
124149
- On success: Status `200`.
150+
125151
```json
126152
{
127153
"data": [
@@ -156,49 +182,61 @@ __Response__:
156182
]
157183
}
158184
```
185+
159186
- On error: Standard error, see [Errors](api.md#errors)
160187

161188
---
162189

163190
## User
191+
164192
### `POST /user/register`
193+
165194
Register (sign-up) a new user account.
166195

167196
`Example: POST /user/register`
197+
168198
__Body__:
169-
```json
199+
200+
```json
170201
{
171-
"email": "[email protected]",
172-
"username": "example_user",
173-
"password": "password",
174-
"confirm_password": "password"
202+
"email": "[email protected]",
203+
"username": "example_user",
204+
"password": "password",
205+
"confirm_password": "password"
175206
}
176207
```
177208

178209
__Response__:
210+
179211
- On success: Status `200`, with an empty body.
180212
- On error: Standard error, see [Errors](api.md#errors)
181213

182214
---
215+
183216
### `POST /user/login`
217+
184218
Login into an existing account.
185219

186220
__Fields__:
221+
187222
- `login`: Either the email or username of the account
188223
- `password`: password of the account
189-
<br><br>
190224

191225
`Example: POST /user/login`
226+
192227
__Body__:
193-
```json
228+
229+
```json
194230
{
195-
"login": "[email protected]",
196-
"password": "password"
231+
"login": "[email protected]",
232+
"password": "password"
197233
}
198234
```
199235

200236
__Response__:
237+
201238
- On success: Status `200`.
239+
202240
```json
203241
{
204242
"data": {
@@ -207,39 +245,50 @@ __Response__:
207245
}
208246
}
209247
```
248+
210249
- On error: Standard error, see [Errors](api.md#errors)
211250

212251
---
213252

214253
### `GET /user/verify/<token>`
215-
Email verification handler. <br>
254+
255+
Email verification handler.
256+
216257
On register an email is sent to the email address of the registered account with a link to this route to verify their email address.
217258

218259
`Example: GET /user/verify/<token>`
260+
219261
__Response__:
262+
220263
- On success: Status `200`.
264+
221265
```html
222266
Email verified, you can close this page.
223267
```
268+
224269
- On error: Error message as a string.
270+
225271
```html
226272
Token invalid.
227273
```
228274

229275
---
230276

231277
### `DELETE /user/ban/<username>`
278+
232279
Ban users.
233280

234281
`Example: DELETE /user/verify/<username>`
235282
__Response__:
283+
236284
- On success: Status `200`.
237285

238286
```json
239287
{
240288
"message": "User successfully banned!"
241289
}
242290
```
291+
243292
- On error: Error message as a string.
244293

245294
```json
@@ -249,4 +298,3 @@ __Response__:
249298
```
250299

251300
---
252-

docs/torrust-index/config.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,35 @@
1-
# Configuring Torrust
1+
# Configuring the Index
2+
23
Torrust's configuration is a simple TOML file. If no TOML file is found, it will fail on startup.
34

45
## Must change
6+
57
> These are all the configuration options that can affect the security of your instance. Please make sure to change these to your own values.
8+
69
- `tracker.token`
710
- `auth.secret_key`
811

912
## Configuration
1013

1114
### Tracker
15+
1216
- `REQUIRED` `url`: public UDP url of the torrust-tracker instance.
1317
- `REQUIRED` `api_url`: URL of the torrust-tracker API, usually `http://localhost:1212`.
1418
- `REQUIRED` `token`: token configured in the torrust-tracker configuration.
1519
- `REQUIRED` `token_valid_seconds`: Lifetime of a tracker key.
1620

1721
### NET
18-
- `REQUIRED` `port`: The port the API will listen on. It's not advised to use ports under 1024 because root access is required for these ports.
19-
- `OPTIONAL` `base_url`: The URL this application is accesible from. Used to build the email verification URL. If not set it uses the hostname the endpoint was called from.
2022

23+
- `REQUIRED` `port`: The port the API will listen on. It's not advised to use ports under 1024 because root access is required for these ports.
24+
- `OPTIONAL` `base_url`: The URL this application is accessible from. Used to build the email verification URL. If not set it uses the hostname the endpoint was called from.
2125

2226
### Database
23-
- `REQUIRED` `connect_url`: The connection URL of the database. Should always start with `sqlite:`, no other databases are supported as of now.Including `mode=rwc` allows the database to be `Read / Writed / Created`. Example: `sqlite://data.db?mode=rwc`
27+
28+
- `REQUIRED` `connect_url`: The connection URL of the database. Should always start with `sqlite:`, no other databases are supported as of now.Including `mode=rwc` allows the database to be `Read / Written / Created`. Example: `sqlite://data.db?mode=rwc`
2429
- `REQUIRED` `torrent_info_update_interval`: Interval in seconds for updating torrent seeder and leecher information. This can be a heavy operation depending on the amount of torrents that are tracked, and thus is not recommended to be lower than `1800` seconds.
2530

2631
### Mail
32+
2733
- `REQUIRED` `server`: Hostname or IP address of a SMTP server.
2834
- `REQUIRED` `port`: Port of the SMTP server.
2935
- `REQUIRED` `username`: Username for authenticating with the specified SMTP server.
@@ -32,14 +38,17 @@ Torrust's configuration is a simple TOML file. If no TOML file is found, it will
3238
- `REQUIRED` `reply_to`: Email address to which replies on the emails should be sent. Can also be a non reply address, or the same as the from address.
3339

3440
### Auth
41+
3542
- `REQUIRED` `min_password_length`: Minimum length of a password when registering a new user.
3643
- `REQUIRED` `max_password_length`: Maximum length of a password when registering a new user.
37-
- `REQUIRED` `secret_key`: Signing key of the JWT authentication tokens. Keeping these default will severly impact the security of your instance, and allows attackers to login as any user.
44+
- `REQUIRED` `secret_key`: Signing key of the JWT authentication tokens. Keeping these default will severely impact the security of your instance, and allows attackers to login as any user.
3845

3946
### Storage
47+
4048
- `REQUIRED` `upload_path`: Path where uploads should be stored. Directories will be automatically created on startup if they don't exist.
4149

4250
## Default
51+
4352
```toml
4453
[website]
4554
name = "Torrust"

0 commit comments

Comments
 (0)