summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2025-12-29 23:01:53 -0800
committerRose Hogenson <rosehogenson@posteo.net>2025-12-29 23:01:53 -0800
commit689df3b2a8a8d7d79d18cd5e9bbc4beba6b12f4c (patch)
tree4a7553346b011493aea5f11bbded3c9a7a4e9c8b
parenta6840f568b33aa030edafa0d007647f4303a4ca9 (diff)
downloadroseh.moe-689df3b2a8a8d7d79d18cd5e9bbc4beba6b12f4c.tar.zst
Fix error messages
-rw-r--r--assets/404.xcfbin2009934 -> 2584128 bytes
-rw-r--r--assets/angry.xcfbin0 -> 45686 bytes
-rw-r--r--assets/confused.xcfbin0 -> 62617 bytes
-rw-r--r--roseh.moe.go13
-rw-r--r--static/404/404.webpbin87426 -> 189518 bytes
-rw-r--r--static/angry.webpbin0 -> 15474 bytes
-rw-r--r--static/confused.webpbin0 -> 14702 bytes
-rw-r--r--static/styles.css29
-rw-r--r--templates/login.html.template2
-rw-r--r--templates/wormhole.html.template9
10 files changed, 46 insertions, 7 deletions
diff --git a/assets/404.xcf b/assets/404.xcf
index 0073a49..8a128d6 100644
--- a/assets/404.xcf
+++ b/assets/404.xcf
Binary files differ
diff --git a/assets/angry.xcf b/assets/angry.xcf
new file mode 100644
index 0000000..5baed5d
--- /dev/null
+++ b/assets/angry.xcf
Binary files differ
diff --git a/assets/confused.xcf b/assets/confused.xcf
new file mode 100644
index 0000000..3bc5a95
--- /dev/null
+++ b/assets/confused.xcf
Binary files 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
--- a/static/404/404.webp
+++ b/static/404/404.webp
Binary files differ
diff --git a/static/angry.webp b/static/angry.webp
new file mode 100644
index 0000000..2aaa4c9
--- /dev/null
+++ b/static/angry.webp
Binary files differ
diff --git a/static/confused.webp b/static/confused.webp
new file mode 100644
index 0000000..6ab3041
--- /dev/null
+++ b/static/confused.webp
Binary files 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 @@
<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