From f3517bec87fc1b2ee36492f9e4e5ed66543bc22b Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Thu, 27 Jul 2023 22:29:56 -0700 Subject: [PATCH] No pictures shared over chat DMs --- pkg/handlers.go | 5 ++++- web/static/js/BareRTC.js | 4 ++++ web/templates/chat.html | 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/pkg/handlers.go b/pkg/handlers.go index 7133045..71cf95f 100644 --- a/pkg/handlers.go +++ b/pkg/handlers.go @@ -104,7 +104,10 @@ func (s *Server) OnLogin(sub *Subscriber, msg Message) { // OnMessage handles a chat message posted by the user. func (s *Server) OnMessage(sub *Subscriber, msg Message) { - log.Info("[%s] %s", sub.Username, msg.Message) + if !strings.HasPrefix(msg.Channel, "@") { + log.Info("[%s to #%s] %s", sub.Username, msg.Channel, msg.Message) + } + if sub.Username == "" { sub.ChatServer("You must log in first.") return diff --git a/web/static/js/BareRTC.js b/web/static/js/BareRTC.js index 21b7440..9259533 100644 --- a/web/static/js/BareRTC.js +++ b/web/static/js/BareRTC.js @@ -1760,6 +1760,10 @@ const app = Vue.createApp({ // The image upload button handler. uploadFile() { + if (this.isDM) { + return; + } + let input = document.createElement('input'); input.type = 'file'; input.accept = 'image/*'; diff --git a/web/templates/chat.html b/web/templates/chat.html index aa61891..fface72 100644 --- a/web/templates/chat.html +++ b/web/templates/chat.html @@ -923,7 +923,8 @@
-
+
-
+