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]] [[package]]
name = "pict-rs" name = "pict-rs"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"actix-form-data", "actix-form-data",
"actix-fs", "actix-fs",

View file

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

View file

@ -95,8 +95,8 @@ pict-rs offers four endpoints:
``` ```
which would create a 256x256px which would create a 256x256px
thumbnail and blur it thumbnail and blur it
- `DELETE /image/{delete_token}/{file}` to delete a file, where `delete_token` and `file` are from - `DELETE /image/{delete_token}/{file}` or `GET /image/{delete_token}/{file}` to delete a file,
the `/image` endpoint's JSON where `delete_token` and `file` are from the `/image` endpoint's JSON
## Contributing ## 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. 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("/download").route(web::get().to(download)))
.service( .service(
web::resource("/delete/{delete_token}/{filename}") 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))), .service(web::resource("/{tail:.*}").route(web::get().to(serve))),
) )