dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 42867b396ab2a887f354956b7dd50fdb83ef1696
parent 6d8b508ace60e4f1c7ae4c80a77f5ecbab04bdf5
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 11 Dec 2023 15:10:39 -0500

cleanup

Diffstat:
Mpkg/web/handlers/api/v1/chat.go | 5+----
Mpkg/web/handlers/chess.go | 10++--------
2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/pkg/web/handlers/api/v1/chat.go b/pkg/web/handlers/api/v1/chat.go @@ -95,10 +95,7 @@ func ChatStreamMessagesHandler(c echo.Context) error { } // Setup headers for http request - c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8) - c.Response().WriteHeader(http.StatusOK) - c.Response().Header().Set("Transfer-Encoding", "chunked") - c.Response().Header().Set("Connection", "keep-alive") + hutils.SetStreamingHeaders(c) quit := hutils.CloseSignalChan(c) diff --git a/pkg/web/handlers/chess.go b/pkg/web/handlers/chess.go @@ -171,10 +171,7 @@ func ChessGameAnalyzeHandler(c echo.Context) error { } defer usersStreamsManager.Inst.Remove(authUser.ID, "analyze_"+key) - c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8) - c.Response().WriteHeader(http.StatusOK) - c.Response().Header().Set("Transfer-Encoding", "chunked") - c.Response().Header().Set("Connection", "keep-alive") + hutils.SetStreamingHeaders(c) sub := interceptors.ChessAnalyzeProgressPubSub.Subscribe([]string{"chess_analyze_progress_" + key}) defer sub.Close() @@ -656,10 +653,7 @@ func ChessGameHandler(c echo.Context) error { } defer usersStreamsManager.Inst.Remove(authUser.ID, key) - c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTMLCharsetUTF8) - c.Response().WriteHeader(http.StatusOK) - c.Response().Header().Set("Transfer-Encoding", "chunked") - c.Response().Header().Set("Connection", "keep-alive") + hutils.SetStreamingHeaders(c) send(cssReset) send(`<style>html, body { background-color: #222; }</style>`)