diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2025-11-02 18:20:50 -0800 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2025-11-02 18:22:55 -0800 |
| commit | ff84730a324fb31ba388d9e37e8f00f344b8dec3 (patch) | |
| tree | 3d6a1fc2d0da536c4fd1f60617c240bf302712d3 /roseh.moe.go | |
| parent | 171119fa753ea82eb36e79559cb333b732d4cc60 (diff) | |
| download | roseh.moe-ff84730a324fb31ba388d9e37e8f00f344b8dec3.tar.zst | |
Improve the upload success screen
Diffstat (limited to 'roseh.moe.go')
| -rw-r--r-- | roseh.moe.go | 10 |
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) |
