Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Limit chat display names to 30 characters. Closes #1919
Gabe Kangasf818c86675a8
diff --git a/config/constants.go b/config/constants.goindex 5e860bf57b..21c40ea425 100644--- a/config/constants.go+++ b/config/constants.go@@ -13,6 +13,8 @@ const (DataDirectory = "data"// EmojiDir is relative to the webroot.EmojiDir = "/img/emoji"+ // MaxChatDisplayNameLength is the maximum length of a chat display name.+ MaxChatDisplayNameLength = 30)var (diff --git a/core/chat/events.go b/core/chat/events.goindex 36467264cb..6ea148248e 100644--- a/core/chat/events.go+++ b/core/chat/events.go@@ -6,6 +6,7 @@ import ("strings""time"+ "github.com/owncast/owncast/config""github.com/owncast/owncast/core/chat/events""github.com/owncast/owncast/core/data""github.com/owncast/owncast/core/user"@@ -25,6 +26,11 @@ func (s *Server) userNameChanged(eventData chatClientEvent) {// Check if name is on the blocklistblocklist := data.GetForbiddenUsernameList()+ // Names have a max length+ if len(proposedUsername) > config.MaxChatDisplayNameLength {+ proposedUsername = proposedUsername[:config.MaxChatDisplayNameLength]+ }+for _, blockedName := range blocklist {normalizedName := strings.TrimSpace(blockedName)normalizedName = strings.ToLower(normalizedName)@@ -59,7 +65,7 @@ func (s *Server) userNameChanged(eventData chatClientEvent) {oldName := savedUser.DisplayName// Save the new name- if err := user.ChangeUsername(eventData.client.User.ID, receivedEvent.NewName); err != nil {+ if err := user.ChangeUsername(eventData.client.User.ID, proposedUsername); err != nil {log.Errorln("error changing username", err)}@@ -69,7 +75,7 @@ func (s *Server) userNameChanged(eventData chatClientEvent) {eventData.client.User.NameChangedAt = &now// Send chat event letting everyone about about the name change- savedUser.DisplayName = receivedEvent.NewName+ savedUser.DisplayName = proposedUsernamebroadcastEvent := events.NameChangeBroadcast{Oldname: oldName,