No pictures shared over chat DMs

This commit is contained in:
Noah 2023-07-27 22:29:56 -07:00
parent fbae93d4f9
commit f3517bec87
3 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -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/*';

View File

@ -923,7 +923,8 @@
<div class="card-content p-2">
<div class="columns is-mobile">
<div class="column pr-1">
<div class="column"
:class="{'pr-1': !isDM}">
<form @submit.prevent="sendMessage()">
<input type="text" class="input"
v-model="message"
@ -932,7 +933,7 @@
:disabled="!ws.connected">
</form>
</div>
<div class="column pl-1 is-narrow">
<div class="column pl-1 is-narrow" v-if="!isDM">
<button type="button" class="button"
@click="uploadFile()">
<i class="fa fa-image"></i>