commit 525d776a1a7518b9483a94cabf14fb4836846cc4
parent 255abfa819e666d225f9ff9642cd7aafce05118b
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 8 Jun 2023 20:40:57 -0700
cleanup
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/pkg/web/handlers/streamModals/codeModal.go b/pkg/web/handlers/streamModals/codeModal.go
@@ -62,9 +62,9 @@ func getCss() string {
}
func getCodeModalHTML(codeModalIdx int, roomName, csrf string, msgTyp database.ChatMessageType, syntaxHighlightCode string) string {
- htmlTmpl := `<div class="code-modal code-modal-` + strconv.Itoa(codeModalIdx) + `">
-<form method="post" target="iframe1" action="/api/v1/chat/top-bar/` + roomName + `">
- <input type="hidden" name="csrf" value="` + csrf + `" />
+ htmlTmpl := `<div class="code-modal code-modal-{{ .CodeModalIdx }}">
+<form method="post" target="iframe1" action="/api/v1/chat/top-bar/{{ .RoomName }}">
+ <input type="hidden" name="csrf" value="{{ .CSRF }}" />
{{ if .IsMod }}
<input type="hidden" name="isMod" value="1" />
{{ end }}
@@ -102,6 +102,9 @@ func getCodeModalHTML(codeModalIdx int, roomName, csrf string, msgTyp database.C
{"bash", "Bash"},
}
data := map[string]any{
+ "CSRF": csrf,
+ "RoomName": roomName,
+ "CodeModalIdx": codeModalIdx,
"IsMod": msgTyp.IsMod,
"ToUserUsername": msgTyp.ToUserUsername,
"SyntaxHighlightCode": syntaxHighlightCode,