From 73739b5bc47faee27849f77e2e90e4ed02205c47 Mon Sep 17 00:00:00 2001
From: blek
Date: Mon, 9 Oct 2023 20:13:07 +1000
Subject: [PATCH] add file password security notice
---
filed/src/web/pages.rs | 22 ++++++++++
filed/templates/index.html | 33 +++++++++++----
filed/templates/passworded-files.html | 59 +++++++++++++++++++++++++++
3 files changed, 105 insertions(+), 9 deletions(-)
create mode 100644 filed/templates/passworded-files.html
diff --git a/filed/src/web/pages.rs b/filed/src/web/pages.rs
index 6bf88ad..19339ad 100644
--- a/filed/src/web/pages.rs
+++ b/filed/src/web/pages.rs
@@ -31,6 +31,13 @@ pub struct Uploaded {
pub env: Env
}
+#[derive(Template)]
+#[template( path = "passworded-files.html" )]
+#[allow(dead_code)]
+pub struct PasswordedFilesHelpPage {
+ pub env: Env
+}
+
pub async fn uploaded(query: HashMap, state: SharedState) -> Result, Rejection> {
@@ -67,7 +74,22 @@ pub fn index_f(state: SharedState) -> impl Filter Result, Rejection> {
+ let rendered = PasswordedFilesHelpPage {
+ env: state.env.clone()
+ };
+ Ok(warp::reply::html(rendered.render().map_err(|err| warp::reject::custom(HttpReject::AskamaError(err)))?))
+}
+
+pub fn passworded_f(state: SharedState) -> impl Filter + Clone {
+ warp::path!("password-files")
+ .and(warp::path::end())
+ .map(move || state.clone())
+ .and_then(passworded)
+}
+
pub fn get_routes(state: SharedState) -> impl Filter + Clone {
index_f(state.clone())
.or(uploaded_f(state.clone()))
+ .or(passworded_f(state))
}
\ No newline at end of file
diff --git a/filed/templates/index.html b/filed/templates/index.html
index b147042..a6777b9 100644
--- a/filed/templates/index.html
+++ b/filed/templates/index.html
@@ -42,15 +42,30 @@
-
-
-
-
+