Noah Petherbridge
7021c56045
Some users had reported the dark video detector errors out on their camera, reading a solid black image and average color of 0 despite their camera actually being bright and colorful. This case seems rare, but the nodvd moderation rule can lift the feature for specific affected users while keeping it in place for everyone else.
43 lines
1000 B
Go
43 lines
1000 B
Go
package barertc
|
|
|
|
import (
|
|
"git.kirsle.net/apps/barertc/pkg/config"
|
|
"git.kirsle.net/apps/barertc/pkg/log"
|
|
)
|
|
|
|
/*
|
|
GetModerationRule loads any moderation rules applied to the user.
|
|
|
|
Moderation rules can be applied by your chat server (in settings.toml) or provided
|
|
by your website (in the custom JWT claims "rules" key).
|
|
*/
|
|
func (sub *Subscriber) GetModerationRule() *config.ModerationRule {
|
|
// Get server side mod rules to start.
|
|
rules := config.Current.GetModerationRule(sub.Username)
|
|
if rules == nil {
|
|
rules = &config.ModerationRule{}
|
|
}
|
|
|
|
// Add in client side (JWT) rules.
|
|
if sub.JWTClaims != nil {
|
|
for _, rule := range sub.JWTClaims.Rules {
|
|
if rule.IsRedCamRule() {
|
|
rules.CameraAlwaysNSFW = true
|
|
}
|
|
if rule.IsNoVideoRule() {
|
|
rules.NoVideo = true
|
|
}
|
|
if rule.IsNoBroadcastRule() {
|
|
rules.NoBroadcast = true
|
|
}
|
|
if rule.IsNoDarkVideoRule() {
|
|
rules.NoDarkVideo = true
|
|
}
|
|
}
|
|
}
|
|
|
|
log.Error("GetModerationRule(%s): %+v", sub.Username, rules)
|
|
|
|
return rules
|
|
}
|