diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-12-29 23:01:53 -0800 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-12-29 23:01:53 -0800 |
| commit | 689df3b2a8a8d7d79d18cd5e9bbc4beba6b12f4c (patch) | |
| tree | 4a7553346b011493aea5f11bbded3c9a7a4e9c8b | |
| parent | a6840f568b33aa030edafa0d007647f4303a4ca9 (diff) | |
| download | roseh.moe-689df3b2a8a8d7d79d18cd5e9bbc4beba6b12f4c.tar.zst | |
Fix error messages
| -rw-r--r-- | assets/404.xcf | bin | 2009934 -> 2584128 bytes | |||
| -rw-r--r-- | assets/angry.xcf | bin | 0 -> 45686 bytes | |||
| -rw-r--r-- | assets/confused.xcf | bin | 0 -> 62617 bytes | |||
| -rw-r--r-- | roseh.moe.go | 13 | ||||
| -rw-r--r-- | static/404/404.webp | bin | 87426 -> 189518 bytes | |||
| -rw-r--r-- | static/angry.webp | bin | 0 -> 15474 bytes | |||
| -rw-r--r-- | static/confused.webp | bin | 0 -> 14702 bytes | |||
| -rw-r--r-- | static/styles.css | 29 | ||||
| -rw-r--r-- | templates/login.html.template | 2 | ||||
| -rw-r--r-- | templates/wormhole.html.template | 9 |
10 files changed, 46 insertions, 7 deletions
diff --git a/assets/404.xcf b/assets/404.xcf Binary files differindex 0073a49..8a128d6 100644 --- a/assets/404.xcf +++ b/assets/404.xcf diff --git a/assets/angry.xcf b/assets/angry.xcf Binary files differnew file mode 100644 index 0000000..5baed5d --- /dev/null +++ b/assets/angry.xcf diff --git a/assets/confused.xcf b/assets/confused.xcf Binary files differnew file mode 100644 index 0000000..3bc5a95 --- /dev/null +++ b/assets/confused.xcf 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 Binary files differindex c416a79..2dd45f1 100644 --- a/static/404/404.webp +++ b/static/404/404.webp diff --git a/static/angry.webp b/static/angry.webp Binary files differnew file mode 100644 index 0000000..2aaa4c9 --- /dev/null +++ b/static/angry.webp diff --git a/static/confused.webp b/static/confused.webp Binary files differnew file mode 100644 index 0000000..6ab3041 --- /dev/null +++ b/static/confused.webp 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 @@ <section> {{if .Error}} - <p class="login-error">Incorrect password</p> + <p class="login-error"><img class="inline" src="/static/angry.webp">Incorrect password</p> {{end}} <form class="password-form" action="/login" method="post"> <input type="hidden" name="redirect" value="{{.Redirect}}"> 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 @@ <form method="post" enctype="multipart/form-data" - style="display:flex;flex-direction:column;align-items:center"> + class="wormhole"> <ol> <li> - <input id="file-input" type="file" name="file" width="50px"> + <input type="file" name="file"> </li> <li> - <input id="submit" type="submit" value="Upload" width="50px"> + <input type="submit" value="Upload" class="wormhole-input"> + {{if .Err}} + <p><img class="inline" src="/static/confused.webp" alt="A logical dragon maid"><span style="color:red">{{.Err}}</span></p> + {{end}} </li> </ol> Files will be deleted after 1 hour |
