update docs
This commit is contained in:
parent
346aa4bbd0
commit
a6b9534f48
|
@ -9,31 +9,16 @@ APIs should not be exposed directly to the internet, they are intended for inter
|
||||||
|
|
||||||
All Endpoints require a authorization token which must be set in the configuration before running the tracker.
|
All Endpoints require a authorization token which must be set in the configuration before running the tracker.
|
||||||
|
|
||||||
- Listing Torrents
|
| Method | Route | Description |
|
||||||
|
| -- | -- | -- |
|
||||||
|
| `GET` | /t | list all tracked torrents. Possible query parameters are: <br /> _offset_ - The offset in the db where to start listing torrents from.<br />_limit_ - Maximum amount of records to retrieve (max. 1000). |
|
||||||
|
| `GET` | /t/_infohash_ | get information about a specific torrent: connected peers & stats |
|
||||||
|
| `DELETE` | /t/_infohash_ | drop a torrent from the database. |
|
||||||
|
| `POST` | /t/_infohash_ | add/flag/unflag torrent |
|
||||||
|
|
||||||
This can be useful if you want to see which torrents are currently registered in any of the tracking modes.
|
The payload expected for adding a torrent can be empty, flagging or unflagging a torrent has the following payload:
|
||||||
|
```json
|
||||||
`GET /t?offset=0&limit=1000&token=... HTTP/1.0`
|
{
|
||||||
|
"is_flagged": false
|
||||||
Optional Parameters:
|
}
|
||||||
- `offset` - Offset of the torrent list to return. Default: 0.
|
```
|
||||||
- `limit` - Limit of torrents to output. Between 1 and 4096. Default 1000.
|
|
||||||
|
|
||||||
- Getting a torrent's stats
|
|
||||||
|
|
||||||
Allows collection of stats from active torrents.
|
|
||||||
|
|
||||||
`GET /t/<info_hash>?token=... HTTP/1.0`
|
|
||||||
|
|
||||||
This request will return information about the torrent, such as:
|
|
||||||
- if the torrent is flagged
|
|
||||||
- seeders & leechers
|
|
||||||
- times the torrent's download was completed
|
|
||||||
|
|
||||||
- Performing actions on torrents
|
|
||||||
|
|
||||||
`POST /t/<info_hash>?action=<action>&token=... HTTP/1.0`
|
|
||||||
|
|
||||||
Valid actions are: `flag`, `unflag`, `add` & `remove`.
|
|
||||||
|
|
||||||
`add` & `remove` are only valid for non-dynamic tracking modes.
|
|
||||||
|
|
|
@ -6,18 +6,37 @@ use std::sync::Arc;
|
||||||
use warp::{filters, reply, reply::Reply, serve, Filter, Server};
|
use warp::{filters, reply, reply::Reply, serve, Filter, Server};
|
||||||
|
|
||||||
fn view_root() -> impl Reply {
|
fn view_root() -> impl Reply {
|
||||||
reply::html(concat!(
|
warp::http::Response::builder()
|
||||||
r#"<html>
|
.header("Content-Type", "text/html; charset=utf-8")
|
||||||
<head>
|
.header("Server", concat!("udpt/", env!("CARGO_PKG_VERSION"), "; https://abda.nl/"))
|
||||||
<title>udpt/"#,
|
.body(concat!(r#"<html>
|
||||||
env!("CARGO_PKG_VERSION"),
|
<head>
|
||||||
r#"</title>
|
<title>udpt server</title>
|
||||||
</head>
|
<style>
|
||||||
<body>
|
body {
|
||||||
This is your <a href="https://github.com/naim94a/udpt">udpt</a> torrent tracker.
|
background-color: #222;
|
||||||
</body>
|
color: #eee;
|
||||||
</html>"#
|
margin-left: auto;
|
||||||
))
|
margin-right: auto;
|
||||||
|
margin-top: 20%;
|
||||||
|
max-width: 750px;
|
||||||
|
}
|
||||||
|
a, a:active, a:visited {
|
||||||
|
color: lightpink;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>
|
||||||
|
This server is running <a style="font-weight: bold; font-size: large" href="https://github.com/naim94a/udpt"><code>udpt</code></a>, a <a href="https://en.wikipedia.org/wiki/BitTorrent_tracker" rel="nofollow" target="_blank">BitTorrent tracker</a> based on the <a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol" rel="nofollow" target="_blank">UDP</a> protocol.
|
||||||
|
</p>
|
||||||
|
<div style="color: grey; font-size: small; border-top: 1px solid grey; width: 75%; max-width: 300px; margin-left: auto; margin-right: auto; text-align: center; padding-top: 5px">
|
||||||
|
udpt/"#, env!("CARGO_PKG_VERSION"), r#"<br />
|
||||||
|
<a href="https://naim94a.github.com/udpt/">docs</a> · <a href="https://github.com/naim94a/udpt/issues">issues & PRs</a> · <a href="https://paypal.me/naim94a">donate</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>"#))
|
||||||
|
.unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Deserialize, Debug)]
|
||||||
|
|
Loading…
Reference in a new issue