From 3125e1f4e7d5c29179385fe69992d86945df6d79 Mon Sep 17 00:00:00 2001 From: xenofem Date: Thu, 26 May 2022 15:09:37 -0400 Subject: [PATCH] show file expiry on download page --- src/main.rs | 3 +++ templates/download.html | 1 + 2 files changed, 4 insertions(+) diff --git a/src/main.rs b/src/main.rs index 2539635..61533a0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,9 @@ use tokio::{fs::File, sync::RwLock}; const APP_NAME: &str = "transbeam"; +const DATE_DISPLAY_FORMAT: &[time::format_description::FormatItem] = + time::macros::format_description!("[year]-[month]-[day]"); + struct AppState { file_store: RwLock, config: Config, diff --git a/templates/download.html b/templates/download.html index 8675972..4d1c6a6 100644 --- a/templates/download.html +++ b/templates/download.html @@ -15,6 +15,7 @@
{{ info.file.name }}
{{ bytesize::to_string(info.file.size.clone(), false).replace(" ", "") }}
+
Expires {{ info.file.expiry.format(DATE_DISPLAY_FORMAT).unwrap() }}
{% match info.file.contents %} {% when Some with (files) %}