diff --git a/Cargo.lock b/Cargo.lock index 1e63448..0f37ffc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -452,7 +452,7 @@ dependencies = [ [[package]] name = "guestbook" -version = "0.2.0" +version = "0.2.1" dependencies = [ "axum", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 95b5f86..69374cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "guestbook" -version = "0.2.0" +version = "0.2.1" edition = "2021" description = "A configurable web guestbook made to be easy to use, with entries in plain text files, options for honeypots and captchas to deter spam, and moderation via Telegram bot." license = "MIT" diff --git a/src/render.rs b/src/render.rs index 1951b65..318f698 100644 --- a/src/render.rs +++ b/src/render.rs @@ -85,7 +85,7 @@ fn render_entry(entry: &Entry, config: &Config) -> String { }; let mut header = format!( "{} - {}", - entry.meta.date, name + &entry.meta.date[..10], name ); if config.enable_website_links && !entry.meta.website.is_empty() { let website = escape_html(&entry.meta.website); diff --git a/src/web.rs b/src/web.rs index 3276a26..5f1cee7 100644 --- a/src/web.rs +++ b/src/web.rs @@ -117,8 +117,9 @@ async fn submit( } let short_id = &Uuid::new_v4().to_string()[..8]; - let date = chrono::Utc::now().format("%Y-%m-%d").to_string(); - let filename = format!("{date}-{short_id}.txt"); + let date = chrono::Utc::now().format("%Y-%m-%dT%H:%M:%S").to_string(); + let date_short = &date[..10]; + let filename = format!("{date_short}-{short_id}.txt"); let entry = Entry { id: filename.trim_end_matches(".txt").to_string(),