diff --git a/filed/src/web/forms.rs b/filed/src/web/forms.rs index 1aafa80..6593938 100644 --- a/filed/src/web/forms.rs +++ b/filed/src/web/forms.rs @@ -5,11 +5,12 @@ use std::collections::HashMap; -use warp::{Filter, reply::Reply, reject::Rejection, filters::multipart::FormData}; +use askama::Template; +use warp::{Filter, reply::{Reply, Html}, reject::Rejection, filters::multipart::FormData, http::StatusCode, Error}; use futures_util::TryStreamExt; use bytes::BufMut; -use super::state::SharedState; +use super::{state::SharedState, pages::BadActionReq, rejection::HttpReject}; pub async fn upload(form: FormData, _state: SharedState) -> Result, Rejection> { @@ -20,7 +21,31 @@ pub async fn upload(form: FormData, _state: SharedState) -> Result Html { let rendered = Index {}; diff --git a/filed/src/web/rejection.rs b/filed/src/web/rejection.rs new file mode 100644 index 0000000..e35816a --- /dev/null +++ b/filed/src/web/rejection.rs @@ -0,0 +1,7 @@ + +#[derive(Debug)] +pub enum HttpReject { + WarpError(warp::Error), + AskamaError(askama::Error) +} +impl warp::reject::Reject for HttpReject {} \ No newline at end of file diff --git a/filed/templates/bad_action_req.html b/filed/templates/bad_action_req.html new file mode 100644 index 0000000..63913c1 --- /dev/null +++ b/filed/templates/bad_action_req.html @@ -0,0 +1 @@ +{% extends "base.html" %} \ No newline at end of file