dkforest

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

commit 8ba02222853ccb35b60a7c19c6d6f02ca5f1eb1a
parent dfd5b933cbf6ce1cf103a99d11a4f7c0da7f65ec
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 23 Jan 2023 10:40:25 -0800

add user-whitelist wall page

Diffstat:
Mpkg/web/handlers/chat.go | 3+++
Apkg/web/public/views/pages/chat-whitelist.gohtml | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/pkg/web/handlers/chat.go b/pkg/web/handlers/chat.go @@ -70,6 +70,9 @@ func chatHandler(c echo.Context, redRoom bool) error { // If you don't have access to the room (room is protected and user is nil or no cookie with the password) // We display the page to enter room password. if !room.HasAccess(c) { + if !room.IsProtected() && room.Mode == database.UserWhitelistRoomMode { + return c.Render(http.StatusOK, "chat-whitelist", data) + } return c.Render(http.StatusOK, "chat-password", data) } diff --git a/pkg/web/public/views/pages/chat-whitelist.gohtml b/pkg/web/public/views/pages/chat-whitelist.gohtml @@ -0,0 +1,76 @@ +{{ define "base" }}<!DOCTYPE html><html lang="en"><head> + {{ .LogoASCII }} + {{ .VersionHTML }} + {{ .ShaHTML }} + <link href="/public/img/favicon.ico" rel="icon" type="image/x-icon" /> + <meta charset="UTF-8" /> + <meta name="author" content="n0tr1v"> + <meta name="keywords" content="{{ block "keywords" . }}{{ .BaseKeywords }}{{ end }}"/> + <meta name="subject" content=""> + <meta name="description" content="{{ block "meta-description" . }}{{ end }}" /> + <meta name="classification" content=""> + <meta name="distribution" content=""> + <meta name="robots" content="all" /> + <meta name="language" content="English"> + <meta name="revisit-after" content="1 days"> + <meta http-equiv="expires" content="0"> + <meta http-equiv="pragma" content="no-cache"> + <title>{{ block "title" . }}DarkForest{{ end }}</title> + {{ block "canonical-link" . }}{{ end }} + <link rel="stylesheet" type="text/css" href="/public/css/bootstrap.min.css?v={{ .VERSION }}" /> + <link rel="stylesheet" type="text/css" href="/public/css/style.css?v={{ .VERSION }}" /> + + <style> + body, html { + height: 100%; + display:table; + width:100%; + } + body { + display:table-cell; + vertical-align:middle; + } + .bg { + /* The image used */ + background-image: url({{ .WallpaperImg }}); + + /* Full height */ + height: 100%; + + /* Center and scale the image nicely */ + background-position: center; + background-repeat: no-repeat; + background-size: cover; + } + #parent { + display: table; + width: 100%; + } + #form_login { + display:table;/* shrinks to fit content */ + margin:auto; + } + .captcha-img { transition: transform .2s; } + .captcha-img:hover { transform: scale(2.5); } + </style> +</head> +<body class="bg"> + +<div id="parent"> + <div class="container" id="form_login"> + <div class="row"> + + <div class="container mt-3"> + <div class="col-8 offset-2 col-md-8 offset-md-2 col-sm-8 col-lg-6 offset-lg-3 col-xl-4 offset-xl-4"> + <div class="form-group"> + <label for="password" class="bg-label">{{ t "Room is in user whitelist mode" . }}</label> + </div> + </div> + </div> + + </div> + </div> +</div> + +</body> +</html>{{ end }} +\ No newline at end of file