Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Fix codeblocks in chat (#676)
Fabian Siegel44418e9745b2
diff --git a/core/chat/server.go b/core/chat/server.goindex d3daec0b74..33dbe1bfb6 100644--- a/core/chat/server.go+++ b/core/chat/server.go@@ -117,11 +117,13 @@ func (s *server) Listen() {// and standardize this message into something safe we can send everyone else.msg.RenderAndSanitizeMessageBody()- s.listener.MessageSent(msg)- s.sendAll(msg)+ if !msg.Empty() {+ s.listener.MessageSent(msg)+ s.sendAll(msg)- // Store in the message history- addMessage(msg)+ // Store in the message history+ addMessage(msg)+ }case ping := <-s.pingCh:fmt.Println("PING?", ping)diff --git a/models/chatMessage.go b/models/chatMessage.goindex 99656c60b1..5db416e46f 100644--- a/models/chatMessage.go+++ b/models/chatMessage.go@@ -38,6 +38,10 @@ func (m *ChatEvent) RenderAndSanitizeMessageBody() {m.Body = RenderAndSanitize(raw)}+func (m *ChatEvent) Empty() bool {+ return m.Body == ""+}+// RenderAndSanitize will turn markdown into HTML, sanitize raw user-supplied HTML and standardize// the message into something safe and renderable for clients.func RenderAndSanitize(raw string) string {@@ -111,5 +115,9 @@ func sanitize(raw string) string {// Allow emphasisp.AllowElements("em")+ // Allow code blocks+ p.AllowElements("code")+ p.AllowElements("pre")+return p.Sanitize(raw)}