From 689df3b2a8a8d7d79d18cd5e9bbc4beba6b12f4c Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Mon, 29 Dec 2025 23:01:53 -0800 Subject: Fix error messages --- assets/404.xcf | Bin 2009934 -> 2584128 bytes assets/angry.xcf | Bin 0 -> 45686 bytes assets/confused.xcf | Bin 0 -> 62617 bytes roseh.moe.go | 13 ++++++++++--- static/404/404.webp | Bin 87426 -> 189518 bytes static/angry.webp | Bin 0 -> 15474 bytes static/confused.webp | Bin 0 -> 14702 bytes static/styles.css | 29 +++++++++++++++++++++++++++++ templates/login.html.template | 2 +- templates/wormhole.html.template | 9 ++++++--- 10 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 assets/angry.xcf create mode 100644 assets/confused.xcf create mode 100644 static/angry.webp create mode 100644 static/confused.webp diff --git a/assets/404.xcf b/assets/404.xcf index 0073a49..8a128d6 100644 Binary files a/assets/404.xcf and b/assets/404.xcf differ diff --git a/assets/angry.xcf b/assets/angry.xcf new file mode 100644 index 0000000..5baed5d Binary files /dev/null and b/assets/angry.xcf differ diff --git a/assets/confused.xcf b/assets/confused.xcf new file mode 100644 index 0000000..3bc5a95 Binary files /dev/null and b/assets/confused.xcf differ diff --git a/roseh.moe.go b/roseh.moe.go index 02428f3..55e2682 100644 --- a/roseh.moe.go +++ b/roseh.moe.go @@ -217,6 +217,10 @@ var ( wormholeTemplate = template.Must(template.Must(outlineTemplate.Clone()).New("body").Parse(wormholeTemplateString)).Lookup("outline") ) +type wormholeTemplateArgs struct { + Err string +} + func makeHole() string { const nWords = 10 buf := make([]byte, 2*nWords) @@ -306,7 +310,7 @@ func readHoleFile(w http.ResponseWriter, hole string) error { } func wormhole(w http.ResponseWriter, r *http.Request) { - if err := wormholeTemplate.Execute(w, nil); err != nil { + if err := wormholeTemplate.Execute(w, wormholeTemplateArgs{}); err != nil { log.Printf("Warning: wormhole: %s", err) } } @@ -333,7 +337,7 @@ func wormholeUpload(w http.ResponseWriter, r *http.Request) { if err != nil { break } - if part.FormName() != "file" { + if part.FormName() != "file" || part.FileName() == "" { continue } hole, err := writeHoleFile(part) @@ -351,7 +355,10 @@ func wormholeUpload(w http.ResponseWriter, r *http.Request) { } return } - http.Error(w, "file not found", http.StatusBadRequest) + w.WriteHeader(http.StatusBadRequest) + if err := wormholeTemplate.Execute(w, wormholeTemplateArgs{Err: "don't forget to pick a file"}); err != nil { + log.Printf("Warning: wormholeTemplate: %s", err) + } } func wormholeDownload(w http.ResponseWriter, r *http.Request) { diff --git a/static/404/404.webp b/static/404/404.webp index c416a79..2dd45f1 100644 Binary files a/static/404/404.webp and b/static/404/404.webp differ diff --git a/static/angry.webp b/static/angry.webp new file mode 100644 index 0000000..2aaa4c9 Binary files /dev/null and b/static/angry.webp differ diff --git a/static/confused.webp b/static/confused.webp new file mode 100644 index 0000000..6ab3041 Binary files /dev/null and b/static/confused.webp differ diff --git a/static/styles.css b/static/styles.css index d214480..0f56527 100644 --- a/static/styles.css +++ b/static/styles.css @@ -110,3 +110,32 @@ input.submit { box-shadow: 0 0 10px rgba(255, 105, 180, 0.5); font-size: 25px; } + +form.wormhole { + display: flex; + flex-direction: column; + align-items: center; + font-size: 30px; +} + +form.wormhole input { + font-size: 30px; +} + +form.wormhole input::file-selector-button, +form.wormhole input.wormhole-input { + margin: 30px; + padding: 30px; + background: #f5f5f5; + outline: none; + border: 5px solid #ff69b4; + border-radius: 15px; + box-shadow: 0 0 10px rgba(255, 105, 180, 0.5); +} + +img.inline { + border: none; + background: transparent; + margin-right: 5px; + filter: drop-shadow(2px -1px 3px grey); +} diff --git a/templates/login.html.template b/templates/login.html.template index 8bdc613..e9ffe2b 100644 --- a/templates/login.html.template +++ b/templates/login.html.template @@ -2,7 +2,7 @@
{{if .Error}} - + {{end}}
diff --git a/templates/wormhole.html.template b/templates/wormhole.html.template index c89bad6..238719a 100644 --- a/templates/wormhole.html.template +++ b/templates/wormhole.html.template @@ -5,13 +5,16 @@ + class="wormhole">
  1. - +
  2. - + + {{if .Err}} +

    A logical dragon maid{{.Err}}

    + {{end}}
Files will be deleted after 1 hour -- cgit v1.3.1