dkforest

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

commit 9d247040e185dcd76dce7a2ef25c54dfea31c349
parent de14611d80434ba0c8a03ea90225324ab3b35635
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed,  5 Apr 2023 16:15:25 -0700

fix stupid color regex

Diffstat:
Mpkg/web/handlers/handlers.go | 2+-
Mpkg/web/public/views/pages/chat-messages.gohtml | 26--------------------------
2 files changed, 1 insertion(+), 27 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -3103,7 +3103,7 @@ func changeSettingsForm(c echo.Context, data settingsChatData) error { //data.NotifyNewMessageSound = utils.DoParseInt64(c.Request().PostFormValue("notify_new_message_sound")) //data.NotifyTaggedSound = utils.DoParseInt64(c.Request().PostFormValue("notify_tagged_sound")) //data.NotifyPmmedSound = utils.DoParseInt64(c.Request().PostFormValue("notify_pmmed_sound")) - colorRgx := regexp.MustCompile(`(#(?:[0-9a-f]{2}){2,4}|#[0-9a-f]{3}|(?:rgba?|hsla?)\((?:\d+%?(?:deg|rad|grad|turn)?(?:,|\s)+){2,3}[\s/]*[\d.]+%?\))`) + colorRgx := regexp.MustCompile(`#[0-9a-f]{6}`) if !colorRgx.MatchString(data.ChatColor) { data.Error = "Invalid color format" return c.Render(http.StatusOK, "settings.chat", data) diff --git a/pkg/web/public/views/pages/chat-messages.gohtml b/pkg/web/public/views/pages/chat-messages.gohtml @@ -429,30 +429,4 @@ </div> {{- end -}} {{- end -}} - -{{/* <script>*/}} -{{/* (function(){*/}} -{{/* window.stop();*/}} -{{/* let iframeDoc = document;*/}} -{{/* // let iframeDoc = document.getElementsByName("iframe2")[0].contentWindow.document;*/}} -{{/* // iframeDoc.getElementsByTagName("meta")[0].remove();*/}} -{{/* /*const socket = new WebSocket("ws://dkforestseeaaq2dqz2uflmlsybvnq2irzn4ygyvu53oazyorednviid.onion/ws/general");*/*/}} -{{/* const socket = new WebSocket("ws://127.0.0.1:8080/ws/general");*/}} -{{/* socket.onmessage = function(evt) {*/}} -{{/* let data = JSON.parse(evt.data);*/}} -{{/* let msgs = iframeDoc.getElementById("msgs");*/}} -{{/* let firstID = msgs.children[0].attributes["id"].value;*/}} -{{/* for (var m of data.Messages) {*/}} -{{/* let div = document.createElement("div");*/}} -{{/* div.innerHTML = m.Message;*/}} -{{/* div.setAttribute("id", "msgid-" + m.UUID);*/}} -{{/* msgs.prepend(div);*/}} -{{/* if (firstID === "msgid-" + m.UUID) {*/}} -{{/* break;*/}} -{{/* }*/}} -{{/* }*/}} -{{/* /*iframeDoc.body.innerHTML = evt.data;*/*/}} -{{/* };*/}} -{{/* })();*/}} -{{/* </script>*/}} {{ end }} \ No newline at end of file