From ff7324d089d02b6a0dab08f200b58c3f4671afa2 Mon Sep 17 00:00:00 2001 From: blek Date: Fri, 13 Oct 2023 23:13:16 +1000 Subject: [PATCH] add TOS --- filed/src/web/pages.rs | 24 +++++++++++++++++++++++- filed/templates/index.html | 12 ++++++++++++ filed/templates/tos.html | 20 ++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 filed/templates/tos.html diff --git a/filed/src/web/pages.rs b/filed/src/web/pages.rs index 363f6fa..c9d0453 100644 --- a/filed/src/web/pages.rs +++ b/filed/src/web/pages.rs @@ -61,6 +61,13 @@ pub struct LicensePage { pub env: Env } +#[derive(Template)] +#[template( path = "tos.html" )] +#[allow(dead_code)] +pub struct TOSPage { + pub env: Env +} + pub async fn uploaded(query: HashMap, state: SharedState) -> Result, Rejection> { if ! query.contains_key("file") { @@ -138,10 +145,25 @@ pub fn license_f(state: SharedState) -> impl Filter Result, Rejection> { + let rendered = TOSPage { + env: state.env + }; + Ok(warp::reply::html(rendered.render().map_err(|err| warp::reject::custom(HttpReject::AskamaError(err)))?)) +} + +pub fn tos_f(state: SharedState) -> impl Filter + Clone { + warp::path!("tos") + .and(warp::path::end()) + .map(move || state.clone()) + .and_then(tos) +} + pub fn get_routes(state: SharedState) -> impl Filter + Clone { index_f(state.clone()) .or(uploaded_f(state.clone())) .or(passworded_f(state.clone())) .or(authors_f(state.clone())) - .or(license_f(state)) + .or(license_f(state.clone())) + .or(tos_f(state)) } \ No newline at end of file diff --git a/filed/templates/index.html b/filed/templates/index.html index af3c417..1efab65 100644 --- a/filed/templates/index.html +++ b/filed/templates/index.html @@ -67,6 +67,18 @@ +

+ +

+

Terms and conditions

+
    +
  1. + By uploading any file to this website, as a user, you state that the files + you upload are completely legal and take full responsibility for their + distribution via blek! File. +
  2. +
  3. + Uploading a file with password gives no guarantee that the password will be + stored securely, or that the file will be encrypted or protected at all. +
  4. +
+
+ +{% endblock %} \ No newline at end of file