diff --git a/pkg/config/config.go b/pkg/config/config.go index a8e1b7e..7f2758d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -13,7 +13,7 @@ import ( // Version of the config format - when new fields are added, it will attempt // to write the settings.toml to disk so new defaults populate. -var currentVersion = 11 +var currentVersion = 12 // Config for your BareRTC app. type Config struct { @@ -94,10 +94,11 @@ func (c Config) GetChannel(id string) (Channel, bool) { // Channel config for a default public room. type Channel struct { - ID string // Like "lobby" - Name string // Like "Main Chat Room" - Icon string `toml:",omitempty"` // CSS class names for room icon (optional) - VIP bool // For VIP users only + ID string // Like "lobby" + Name string // Like "Main Chat Room" + Icon string `toml:",omitempty"` // CSS class names for room icon (optional) + VIP bool // For VIP users only + PermitPhotos bool // photos are allowed to be shared // ChatServer messages to send to the user immediately upon connecting. WelcomeMessages []string @@ -151,11 +152,13 @@ func DefaultConfig() Config { WelcomeMessages: []string{ "Welcome to the Off Topic channel!", }, + PermitPhotos: true, }, { - ID: "vip", - Name: "VIPs Only", - VIP: true, + ID: "vip", + Name: "VIPs Only", + VIP: true, + PermitPhotos: true, WelcomeMessages: []string{ "This channel is only for operators and VIPs.", }, diff --git a/pkg/websocket.go b/pkg/websocket.go index b56c256..42875a7 100644 --- a/pkg/websocket.go +++ b/pkg/websocket.go @@ -544,7 +544,7 @@ func (s *Server) SendWhoList() { // VIP flags: if we are in MutuallySecret mode, only VIPs can see // other VIP flags on the Who List. if config.Current.VIP.MutuallySecret { - if sub.IsVIP() || sub.IsAdmin() { + if sub.IsVIP() { who.VIP = user.JWTClaims.VIP } } else { diff --git a/src/App.vue b/src/App.vue index fe85865..c42b9a4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -631,9 +631,16 @@ export default { return status === null || status.name !== "online"; }, canUploadFile() { - // Public channels: OK - if (!this.channel.indexOf('@') === 0) { - return true; + // Public channels: check whether it PermitsPhotos. + if (!this.isDM) { + for (let cfg of this.config.channels) { + if (cfg.ID === this.channel && cfg.PermitPhotos) { + return true; + } + } + + // By default: channels do not permit photos. + return false; } // User is an admin?