summaryrefslogtreecommitdiffstats
path: root/roseh.moe.go
diff options
context:
space:
mode:
Diffstat (limited to 'roseh.moe.go')
-rw-r--r--roseh.moe.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/roseh.moe.go b/roseh.moe.go
index 19d6109..abafa2e 100644
--- a/roseh.moe.go
+++ b/roseh.moe.go
@@ -252,6 +252,12 @@ func (c wormholeConn) wormholeCopy(ctx context.Context, hole string) error {
return nil
}
+var (
+ //go:embed templates/wormhole-success.html.template
+ wormholeSuccessTemplateString string
+ wormholeSuccessTemplate = template.Must(template.Must(outlineTemplate.Clone()).New("body").Parse(wormholeSuccessTemplateString)).Lookup("outline")
+)
+
func wormholeSend(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
reader, err := r.MultipartReader()
@@ -271,7 +277,9 @@ func wormholeSend(w http.ResponseWriter, r *http.Request) {
if err := (wormholeConn{done: make(chan struct{}), r: part}).wormholeCopy(ctx, hole); err != nil {
http.Error(w, fmt.Sprintf("Error during copy: %s", err), http.StatusServiceUnavailable)
}
- fmt.Fprintf(w, "uploaded!")
+ if err := wormholeSuccessTemplate.Execute(w, nil); err != nil {
+ log.Printf("Warning: wormholeSend: %s", err)
+ }
return
}
http.Error(w, "file not found", http.StatusBadRequest)