dkforest

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

commit 540a51f66ea19424aef590c56197c3df0e51fa69
parent 6031a1fb265a5ecfce8660fdd87ec1d311f202ce
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat,  3 Dec 2022 23:26:07 -0500

cleanup

Diffstat:
Mpkg/web/handlers/handlers.go | 3+--
Mpkg/web/handlers/utils/utils.go | 11++++-------
2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -4066,8 +4066,7 @@ func ByteRoadChallengeHandler(c echo.Context) error { data.CaptchaID, data.CaptchaImg = captcha.New() setCookie := func(token string) { - maxAge := int64(86400) // 24h - c.SetCookie(hutils.CreateCookie("challenge_byte_road_session", token, maxAge)) + c.SetCookie(hutils.CreateCookie("challenge_byte_road_session", token, utils.OneDaySecs)) } if c.Request().Method == http.MethodPost { diff --git a/pkg/web/handlers/utils/utils.go b/pkg/web/handlers/utils/utils.go @@ -43,9 +43,8 @@ func DeleteRoomCookie(c echo.Context, roomID int64) { } func CreateRoomCookie(c echo.Context, roomID int64, v, key string) { - maxAge := int64(86400) // 24h - c.SetCookie(CreateCookie("room_"+utils.FormatInt64(roomID)+"_auth", v, maxAge)) - c.SetCookie(CreateCookie("room_"+utils.FormatInt64(roomID)+"_key", key, maxAge)) + c.SetCookie(CreateCookie("room_"+utils.FormatInt64(roomID)+"_auth", v, utils.OneDaySecs)) + c.SetCookie(CreateCookie("room_"+utils.FormatInt64(roomID)+"_key", key, utils.OneDaySecs)) } func GetGistCookie(c echo.Context, gistUUID string) (*http.Cookie, error) { @@ -57,8 +56,7 @@ func DeleteGistCookie(c echo.Context, gistUUID string) { } func CreateGistCookie(c echo.Context, gistUUID, v string) { - maxAge := int64(86400) // 24h - c.SetCookie(CreateCookie("gist_"+gistUUID+"_auth", v, maxAge)) + c.SetCookie(CreateCookie("gist_"+gistUUID+"_auth", v, utils.OneDaySecs)) } func GetAprilFoolCookie(c echo.Context) int { @@ -74,8 +72,7 @@ func GetAprilFoolCookie(c echo.Context) int { } func CreateAprilFoolCookie(c echo.Context, v int) { - maxAge := int64(86400) // 24h - c.SetCookie(CreateCookie("april_fool", strconv.Itoa(v), maxAge)) + c.SetCookie(CreateCookie("april_fool", strconv.Itoa(v), utils.OneDaySecs)) } // CaptchaVerifyString ensure that all captcha across the website makes HB life miserable.