dkforest

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

commit ab064054cc96be50ebfcc0b87fe1b67b79ba9568
parent f3567444ca28cd1069b2e417f600916317fe8132
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun,  7 Jan 2024 00:16:05 -0500

Revert "POC multi domain hack to avoid network.http.max-persistent-connections-per-server limitations"

This reverts commit f3567444ca28cd1069b2e417f600916317fe8132.

Diffstat:
Mpkg/web/handlers/poker/poker.go | 13++-----------
Mpkg/web/middlewares/middlewares.go | 8--------
2 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -2,7 +2,6 @@ package poker import ( "bytes" - "dkforest/pkg/config" "dkforest/pkg/database" "dkforest/pkg/pubsub" "dkforest/pkg/utils" @@ -1736,14 +1735,6 @@ func buildGameDiv(g *Game, authUser *database.User) (html string) { } func BuildBaseHtml(g *Game, authUser *database.User, chatRoomSlug string) (html string) { - firstDomain := "" - secondDomain := "" - apiToken := authUser.ApiKey - if config.Development.IsFalse() && apiToken != "" { - firstDomain = "http://peddrcq5m2digvtwjf3beh7wb4pqsn3jbfxq2x4wwvey4gy42uqgtbyd.onion" - secondDomain = "http://hm4iv33o5l7gmjk6gnp75payt7ruoez754hukqksf5vatrgxs7xmx2yd.onion" - } - ongoing := g.ongoing roomID := g.roomID html += hutils.HtmlCssReset @@ -1755,9 +1746,9 @@ func BuildBaseHtml(g *Game, authUser *database.User, chatRoomSlug string) (html html += buildHelpHtml() html += `<div id="chat-div">` html += ` <iframe id="chat-top-bar" name="iframe1" src="/api/v1/chat/top-bar/` + chatRoomSlug + `" sandbox="allow-forms allow-scripts allow-same-origin allow-top-navigation-by-user-activation"></iframe>` - html += ` <iframe id="chat-content" name="iframe2" src="` + firstDomain + `/api/v1/chat/messages/` + chatRoomSlug + `/stream?hrm=1&hactions=1&hide_ts=1&auto-auth=` + apiToken + `"></iframe>` + html += ` <iframe id="chat-content" name="iframe2" src="/api/v1/chat/messages/` + chatRoomSlug + `/stream?hrm=1&hactions=1&hide_ts=1"></iframe>` html += `</div>` - html += `<iframe src="` + secondDomain + `/poker/` + roomID.String() + `/logs?auto-auth=` + apiToken + `" id="eventLogs"></iframe>` + html += `<iframe src="/poker/` + roomID.String() + `/logs" id="eventLogs"></iframe>` if ongoing != nil { html += drawCountDownStyle(ongoing.waitTurnEvent.Get()) diff --git a/pkg/web/middlewares/middlewares.go b/pkg/web/middlewares/middlewares.go @@ -264,14 +264,6 @@ func SetUserMiddleware(next echo.HandlerFunc) echo.HandlerFunc { return next(ctx) } else { } - } else if ctx.QueryParam("auto-auth") != "" { - if err := db.GetUserByApiKey(&user, apiKey); err == nil { - dur := time.Hour * 24 - session := db.DoCreateSession(user.ID, ctx.Request().UserAgent(), dur) - ctx.SetCookie(hutils.CreateCookie(hutils.AuthCookieName, session.Token, int64(dur))) - ctx.Set("authUser", &user) - return next(ctx) - } } ctx.Set("authUser", nilUser)