From c3e1ff145deae3cf7a102623cb00ee02dfd62b16 Mon Sep 17 00:00:00 2001 From: lew Date: Fri, 10 Apr 2026 02:48:55 +0100 Subject: [PATCH] fix: remove unused label configs, fix entry audio gap, canvas spacing --- src/config.rs | 8 -------- src/render.rs | 6 ++---- src/web.rs | 2 -- templates/default.css | 4 ++++ 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/src/config.rs b/src/config.rs index 80fc2e2..711f78d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -22,11 +22,9 @@ pub struct Config { pub captcha_exact: bool, pub captcha_casesensitive: bool, pub enable_drawings: bool, - pub label_drawing: String, pub canvas_width: u32, pub canvas_height: u32, pub enable_voice_notes: bool, - pub label_voice_note: String, pub voice_note_max_duration: u32, pub template: Option, pub success_template: Option, @@ -114,8 +112,6 @@ impl Config { enable_drawings: env::var("BOOK_ENABLE_DRAWINGS") .map(|v| v != "false") .unwrap_or(false), - label_drawing: env::var("BOOK_LABEL_DRAWING") - .unwrap_or_else(|_| "Draw (optional):".into()), canvas_width: env::var("BOOK_CANVAS_WIDTH") .unwrap_or_else(|_| "400".into()) .parse() @@ -127,8 +123,6 @@ impl Config { enable_voice_notes: env::var("BOOK_ENABLE_VOICE_NOTES") .map(|v| v != "false") .unwrap_or(false), - label_voice_note: env::var("BOOK_LABEL_VOICE_NOTE") - .unwrap_or_else(|_| "Voice note (optional):".into()), voice_note_max_duration: env::var("BOOK_VOICE_NOTE_MAX_DURATION") .unwrap_or_else(|_| "20".into()) .parse() @@ -301,7 +295,6 @@ mod tests { assert_eq!(config.canvas_width, 400); assert_eq!(config.canvas_height, 200); assert_eq!(config.max_drawing_bytes(), 400 * 200 * 4); - assert_eq!(config.label_drawing, "Draw (optional):"); } #[test] @@ -315,7 +308,6 @@ mod tests { assert!(!config.enable_voice_notes); assert_eq!(config.voice_note_max_duration, 20); assert_eq!(config.max_voice_note_bytes(), 20 * 10 * 1024); - assert_eq!(config.label_voice_note, "Voice note (optional):"); } #[test] diff --git a/src/render.rs b/src/render.rs index 3161d60..6585d3a 100644 --- a/src/render.rs +++ b/src/render.rs @@ -280,7 +280,7 @@ fn render_entry(entry: &Entry, config: &Config) -> String { }; let drawing_html = if !entry.meta.drawing.is_empty() { format!( - "\n", + "", escape_html(&entry.meta.drawing) ) } else { @@ -288,7 +288,7 @@ fn render_entry(entry: &Entry, config: &Config) -> String { }; let voice_note_html = if !entry.meta.voice_note.is_empty() { format!( - "\n", + "", escape_html(&entry.meta.voice_note) ) } else { @@ -327,11 +327,9 @@ mod tests { captcha_exact: false, captcha_casesensitive: false, enable_drawings: false, - label_drawing: "Draw (optional):".into(), canvas_width: 400, canvas_height: 200, enable_voice_notes: false, - label_voice_note: "Voice note (optional):".into(), voice_note_max_duration: 20, template: None, success_template: None, diff --git a/src/web.rs b/src/web.rs index cb4d67e..0a46563 100644 --- a/src/web.rs +++ b/src/web.rs @@ -335,11 +335,9 @@ mod tests { captcha_exact: false, captcha_casesensitive: false, enable_drawings: false, - label_drawing: "Draw (optional):".into(), canvas_width: 400, canvas_height: 200, enable_voice_notes: false, - label_voice_note: "Voice note (optional):".into(), voice_note_max_duration: 20, template: None, success_template: None, diff --git a/templates/default.css b/templates/default.css index e239e32..f0fc797 100644 --- a/templates/default.css +++ b/templates/default.css @@ -35,6 +35,10 @@ .guestbook-drawing-inline a { cursor: pointer; } +.guestbook-drawing-content { + display: block; + margin-bottom: 1em; +} .guestbook-swatch { display: inline-block; width: 0.85em;