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
|
||||
// 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 {
|
||||
|
@ -98,6 +98,7 @@ type Channel struct {
|
|||
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,
|
||||
PermitPhotos: true,
|
||||
WelcomeMessages: []string{
|
||||
"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
|
||||
// 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 {
|
||||
|
|
11
src/App.vue
11
src/App.vue
|
@ -631,10 +631,17 @@ export default {
|
|||
return status === null || status.name !== "online";
|
||||
},
|
||||
canUploadFile() {
|
||||
// Public channels: OK
|
||||
if (!this.channel.indexOf('@') === 0) {
|
||||
// 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?
|
||||
if (this.jwt.claims.op) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user