Add support for /gallery links
This commit is contained in:
parent
3f804a388a
commit
782ac4e86c
|
@ -30,6 +30,9 @@ async fn async_main(port: u16) {
|
||||||
let album_path = warp::path!("a" / String)
|
let album_path = warp::path!("a" / String)
|
||||||
.and(client.clone())
|
.and(client.clone())
|
||||||
.and_then(handle_album);
|
.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 media_path = warp::path!(String).and(client).and_then(handle_media);
|
||||||
let root_handler = warp::path::end().map(|| warp::reply::html(
|
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"))
|
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(
|
let routes = warp::filters::method::get().and(
|
||||||
album_path
|
album_path
|
||||||
|
.or(gallery_path)
|
||||||
.or(index_handler)
|
.or(index_handler)
|
||||||
.or(media_path)
|
.or(media_path)
|
||||||
.or(root_handler)
|
.or(root_handler)
|
||||||
|
|
Loading…
Reference in New Issue