Add GET for deleting images

This commit is contained in:
asonix 2020-06-09 17:37:48 -05:00
parent c8720d0d1d
commit 9a3b8dd4d7
4 changed files with 6 additions and 5 deletions

2
Cargo.lock generated
View file

@ -1341,7 +1341,7 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
[[package]]
name = "pict-rs"
version = "0.1.0"
version = "0.1.1"
dependencies = [
"actix-form-data",
"actix-fs",

View file

@ -1,7 +1,7 @@
[package]
name = "pict-rs"
description = "A simple image hosting service"
version = "0.1.0"
version = "0.1.1"
authors = ["asonix <asonix@asonix.dog>"]
license = "AGPL-3.0"
readme = "README.md"

View file

@ -95,8 +95,8 @@ pict-rs offers four endpoints:
```
which would create a 256x256px
thumbnail and blur it
- `DELETE /image/{delete_token}/{file}` to delete a file, where `delete_token` and `file` are from
the `/image` endpoint's JSON
- `DELETE /image/{delete_token}/{file}` or `GET /image/{delete_token}/{file}` to delete a file,
where `delete_token` and `file` are from the `/image` endpoint's JSON
## Contributing
Feel free to open issues for anything you find an issue with. Please note that any contributed code will be licensed under the AGPLv3.

View file

@ -306,7 +306,8 @@ async fn main() -> Result<(), anyhow::Error> {
.service(web::resource("/download").route(web::get().to(download)))
.service(
web::resource("/delete/{delete_token}/{filename}")
.route(web::delete().to(delete)),
.route(web::delete().to(delete))
.route(web::get().to(delete)),
)
.service(web::resource("/{tail:.*}").route(web::get().to(serve))),
)