Let channels configure whether to permit photos
This commit is contained in:
parent
745c282650
commit
747f4fd5d4
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
// Version of the config format - when new fields are added, it will attempt
|
// Version of the config format - when new fields are added, it will attempt
|
||||||
// to write the settings.toml to disk so new defaults populate.
|
// to write the settings.toml to disk so new defaults populate.
|
||||||
var currentVersion = 11
|
var currentVersion = 12
|
||||||
|
|
||||||
// Config for your BareRTC app.
|
// Config for your BareRTC app.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
|
@ -94,10 +94,11 @@ func (c Config) GetChannel(id string) (Channel, bool) {
|
||||||
|
|
||||||
// Channel config for a default public room.
|
// Channel config for a default public room.
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
ID string // Like "lobby"
|
ID string // Like "lobby"
|
||||||
Name string // Like "Main Chat Room"
|
Name string // Like "Main Chat Room"
|
||||||
Icon string `toml:",omitempty"` // CSS class names for room icon (optional)
|
Icon string `toml:",omitempty"` // CSS class names for room icon (optional)
|
||||||
VIP bool // For VIP users only
|
VIP bool // For VIP users only
|
||||||
|
PermitPhotos bool // photos are allowed to be shared
|
||||||
|
|
||||||
// ChatServer messages to send to the user immediately upon connecting.
|
// ChatServer messages to send to the user immediately upon connecting.
|
||||||
WelcomeMessages []string
|
WelcomeMessages []string
|
||||||
|
@ -151,11 +152,13 @@ func DefaultConfig() Config {
|
||||||
WelcomeMessages: []string{
|
WelcomeMessages: []string{
|
||||||
"Welcome to the Off Topic channel!",
|
"Welcome to the Off Topic channel!",
|
||||||
},
|
},
|
||||||
|
PermitPhotos: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: "vip",
|
ID: "vip",
|
||||||
Name: "VIPs Only",
|
Name: "VIPs Only",
|
||||||
VIP: true,
|
VIP: true,
|
||||||
|
PermitPhotos: true,
|
||||||
WelcomeMessages: []string{
|
WelcomeMessages: []string{
|
||||||
"This channel is only for operators and VIPs.",
|
"This channel is only for operators and VIPs.",
|
||||||
},
|
},
|
||||||
|
|
|
@ -544,7 +544,7 @@ func (s *Server) SendWhoList() {
|
||||||
// VIP flags: if we are in MutuallySecret mode, only VIPs can see
|
// VIP flags: if we are in MutuallySecret mode, only VIPs can see
|
||||||
// other VIP flags on the Who List.
|
// other VIP flags on the Who List.
|
||||||
if config.Current.VIP.MutuallySecret {
|
if config.Current.VIP.MutuallySecret {
|
||||||
if sub.IsVIP() || sub.IsAdmin() {
|
if sub.IsVIP() {
|
||||||
who.VIP = user.JWTClaims.VIP
|
who.VIP = user.JWTClaims.VIP
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
13
src/App.vue
13
src/App.vue
|
@ -631,9 +631,16 @@ export default {
|
||||||
return status === null || status.name !== "online";
|
return status === null || status.name !== "online";
|
||||||
},
|
},
|
||||||
canUploadFile() {
|
canUploadFile() {
|
||||||
// Public channels: OK
|
// Public channels: check whether it PermitsPhotos.
|
||||||
if (!this.channel.indexOf('@') === 0) {
|
if (!this.isDM) {
|
||||||
return true;
|
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?
|
// User is an admin?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user