diff --git a/docs/src/api.md b/docs/src/api.md index e30dfb3..06ca292 100644 --- a/docs/src/api.md +++ b/docs/src/api.md @@ -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. -- Listing Torrents - - This can be useful if you want to see which torrents are currently registered in any of the tracking modes. - - `GET /t?offset=0&limit=1000&token=... HTTP/1.0` - - 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 +| Method | Route | Description | +| -- | -- | -- | +| `GET` | /t | list all tracked torrents. Possible query parameters are:
_offset_ - The offset in the db where to start listing torrents from.
_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 | - Allows collection of stats from active torrents. - - `GET /t/?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/?action=&token=... HTTP/1.0` - - Valid actions are: `flag`, `unflag`, `add` & `remove`. - - `add` & `remove` are only valid for non-dynamic tracking modes. +The payload expected for adding a torrent can be empty, flagging or unflagging a torrent has the following payload: +```json +{ + "is_flagged": false +} +``` diff --git a/src/webserver.rs b/src/webserver.rs index 093feeb..c9431cc 100644 --- a/src/webserver.rs +++ b/src/webserver.rs @@ -6,18 +6,37 @@ use std::sync::Arc; use warp::{filters, reply, reply::Reply, serve, Filter, Server}; fn view_root() -> impl Reply { - reply::html(concat!( - r#" - - udpt/"#, - env!("CARGO_PKG_VERSION"), - r#" - - - This is your udpt torrent tracker. - - "# - )) + warp::http::Response::builder() + .header("Content-Type", "text/html; charset=utf-8") + .header("Server", concat!("udpt/", env!("CARGO_PKG_VERSION"), "; https://abda.nl/")) + .body(concat!(r#" + + udpt server + + + +

+ This server is running udpt, a BitTorrent tracker based on the UDP protocol. +

+
+ udpt/"#, env!("CARGO_PKG_VERSION"), r#"
+ docs · issues & PRs · donate +
+ + "#)) + .unwrap() } #[derive(Deserialize, Debug)] diff --git a/udpt.toml b/udpt.toml index 44c0598..c1ad360 100644 --- a/udpt.toml +++ b/udpt.toml @@ -1,5 +1,6 @@ mode = "dynamic" db_path = "database.json.bz2" +log_level = "trace" [udp] announce_interval = 120 # Two minutes