Add support for /gallery links

This commit is contained in:
blank X 2021-05-03 14:55:07 +07:00
parent 3f804a388a
commit 782ac4e86c
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 4 additions and 0 deletions

View File

@ -30,6 +30,9 @@ async fn async_main(port: u16) {
let album_path = warp::path!("a" / String)
.and(client.clone())
.and_then(handle_album);
let gallery_path = warp::path!("gallery" / String)
.and(client.clone())
.and_then(handle_album);
let media_path = warp::path!(String).and(client).and_then(handle_media);
let root_handler = warp::path::end().map(|| warp::reply::html(
format!("<html><head><title>ImgurX v{0}</title><style>body {{ background-color: black; color: black; text-align: center; }}\ndiv {{ border: 1px solid #008; background: #eef; padding: 0.5em 1em 0.5em 1em; }}</style></head><body><div><b><a href=\"https://gitlab.com/blankX/imgurx\" style=\"text-decoration: none;\">ImgurX v{0}</a></b><br>An alternative JS-less Imgur frontend</div></body></html>", env!("CARGO_PKG_VERSION"))
@ -41,6 +44,7 @@ async fn async_main(port: u16) {
));
let routes = warp::filters::method::get().and(
album_path
.or(gallery_path)
.or(index_handler)
.or(media_path)
.or(root_handler)