dkforest

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

commit 6565cafda4bef4938c7256d7bc1cdcffb33c5d97
parent ef1b9800962249945c20a8f3842ce728a381aa90
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun, 12 Mar 2023 23:21:07 -0700

af2023

Diffstat:
Mpkg/template/templates.go | 44++++++++++++++++++++++++--------------------
Mpkg/web/middlewares/middlewares.go | 4++--
Apkg/web/public/img/login_bg_2.jpg | 0
Apkg/web/public/img/logo_donkey_kong.png | 0
Apkg/web/public/img/trees_donkey_kong.png | 0
Mpkg/web/public/views/pages/chat.gohtml | 4+++-
Mpkg/web/public/views/pages/index.gohtml | 4+++-
7 files changed, 32 insertions(+), 24 deletions(-)

diff --git a/pkg/template/templates.go b/pkg/template/templates.go @@ -40,25 +40,26 @@ func (t *Templates) AddFn(name string, fn any) { } type templateDataStruct struct { - Bundle *i18n.Bundle - AcceptLanguage string - Lang string - Data any - VERSION string - SHA string - VersionHTML template.HTML - ShaHTML template.HTML - LogoASCII template.HTML - NullUsername string - DB *database.DkfDB - CSRF string - Master bool - Development bool - BaseKeywords string - TmplName string - AuthUser *database.User - InboxCount int64 - WallpaperImg string + Bundle *i18n.Bundle + AcceptLanguage string + Lang string + Data any + VERSION string + SHA string + VersionHTML template.HTML + ShaHTML template.HTML + LogoASCII template.HTML + NullUsername string + DB *database.DkfDB + CSRF string + Master bool + Development bool + BaseKeywords string + TmplName string + AuthUser *database.User + InboxCount int64 + WallpaperImg string + IsAprilFool2023 bool } // Render render a template @@ -88,9 +89,12 @@ func (t *Templates) Render(w io.Writer, name string, data any, c echo.Context) e d.AuthUser = c.Get("authUser").(*database.User) d.WallpaperImg = "/public/img/login_bg.jpg" - _, month, _ := time.Now().UTC().Date() + year, month, day := time.Now().UTC().Date() + d.IsAprilFool2023 = year == 2023 && month == time.April && day == 1 if month == time.December { d.WallpaperImg = "/public/img/login_bg_1.jpg" + } else if d.IsAprilFool2023 { + d.WallpaperImg = "/public/img/login_bg_2.jpg" } if d.AuthUser != nil { diff --git a/pkg/web/middlewares/middlewares.go b/pkg/web/middlewares/middlewares.go @@ -378,8 +378,8 @@ func AprilFoolMiddleware() echo.MiddlewareFunc { return next(c) } - _, month, day := time.Now().UTC().Date() - if month == time.April && day == 1 { + year, month, day := time.Now().UTC().Date() + if year == 2022 && month == time.April && day == 1 { vv := hutils.GetAprilFoolCookie(c) if vv < 3 { hutils.CreateAprilFoolCookie(c, vv+1) diff --git a/pkg/web/public/img/login_bg_2.jpg b/pkg/web/public/img/login_bg_2.jpg Binary files differ. diff --git a/pkg/web/public/img/logo_donkey_kong.png b/pkg/web/public/img/logo_donkey_kong.png Binary files differ. diff --git a/pkg/web/public/img/trees_donkey_kong.png b/pkg/web/public/img/trees_donkey_kong.png Binary files differ. diff --git a/pkg/web/public/views/pages/chat.gohtml b/pkg/web/public/views/pages/chat.gohtml @@ -21,7 +21,9 @@ font-size: 11px !important; } body { - {{ if eq .AuthUser.Theme 1 }} + {{ if .IsAprilFool2023 }} + background-image: url("/public/img/trees_donkey_kong.png"); + {{ else if eq .AuthUser.Theme 1 }} background-image: url("/public/img/trees_christmas.png"); {{ else if eq .AuthUser.Theme 2 }} {{ else }} diff --git a/pkg/web/public/views/pages/index.gohtml b/pkg/web/public/views/pages/index.gohtml @@ -16,7 +16,9 @@ {{ block "navbar" . }} <nav style="padding: 0px 8px 0px 0px;" class="navbar navbar-expand-sm navbar-dark bg-dark{{ block "nav-mb" . }} mb-3{{ end }}"> <a style="padding: 0px 0px;" class="navbar-brand" href="/"> - {{ if .AuthUser }} + {{ if .IsAprilFool2023 }} + <img src="/public/img/logo_donkey_kong.png" alt="logo" /> + {{ else if .AuthUser }} {{ if eq .AuthUser.Theme 1 }} <img src="/public/img/logo_christmas.png" alt="logo" /> {{ else }}