aboutsummaryrefslogtreecommitdiffstats
path: root/src/renderer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/renderer.rs')
-rw-r--r--src/renderer.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/renderer.rs b/src/renderer.rs
index c8958fe..6aad5bd 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -40,6 +40,12 @@ pub fn page(
let title_path = breadcrumbs_to_path_string(breadcrumbs);
+ let upload_allowed = conf.allowed_upload_dir.is_empty()
+ || conf
+ .allowed_upload_dir
+ .iter()
+ .any(|x| encoded_dir.starts_with(&format!("/{}", x)));
+
html! {
(DOCTYPE)
html {
@@ -120,7 +126,7 @@ pub fn page(
}
}
div.toolbar_box_group {
- @if conf.file_upload {
+ @if conf.file_upload && upload_allowed {
div.toolbar_box {
form id="file_submit" action=(upload_action) method="POST" enctype="multipart/form-data" {
p { "Select a file to upload or drag it anywhere into the window" }
@@ -235,7 +241,7 @@ fn qr_code_svg(url: impl AsRef<str>, margin: usize) -> Result<String, QRCodeErro
let qr = QRBuilder::new(url.as_ref().into())
.ecl(consts::QR_EC_LEVEL)
.build()?;
- let svg = SvgBuilder::new().margin(margin).build_qr(qr);
+ let svg = SvgBuilder::default().margin(margin).to_str(&qr);
Ok(svg)
}