diff --git a/pkg/config/config.go b/pkg/config/config.go index 6b71592..a2345ae 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -138,6 +138,7 @@ type ModerationRule struct { NoBroadcast bool NoVideo bool NoImage bool + NoDarkVideo bool } // Current loaded configuration. diff --git a/pkg/jwt/rules.go b/pkg/jwt/rules.go index 677159d..1063178 100644 --- a/pkg/jwt/rules.go +++ b/pkg/jwt/rules.go @@ -14,6 +14,7 @@ const ( NoBroadcastRule = Rule("nobroadcast") // They can not share their webcam NoImageRule = Rule("noimage") // Can not upload or see images RedCamRule = Rule("redcam") // Their camera is force marked NSFW + NoDarkVideoRule = Rule("nodvd") // Exempt user from the dark video detector ) func (r Rule) IsNoVideoRule() bool { @@ -32,6 +33,10 @@ func (r Rule) IsRedCamRule() bool { return r == RedCamRule } +func (r Rule) IsNoDarkVideoRule() bool { + return r == NoDarkVideoRule +} + // Rules are the plural set of rules as shown on a JWT token (string array), // with some extra functionality attached such as an easy serializer to JSON. type Rules []Rule @@ -44,6 +49,7 @@ func (r Rules) ToDict() map[string]bool { "IsNoImageRule": false, "IsNoBroadcastRule": false, "IsRedCamRule": false, + "IsNoDarkVideoRule": false, } for _, rule := range r { @@ -59,6 +65,9 @@ func (r Rules) ToDict() map[string]bool { if v := rule.IsRedCamRule(); v { result["IsRedCamRule"] = true } + if v := rule.IsNoDarkVideoRule(); v { + result["IsNoDarkVideoRule"] = true + } } return result diff --git a/pkg/moderation_rules.go b/pkg/moderation_rules.go index 91615c5..2143393 100644 --- a/pkg/moderation_rules.go +++ b/pkg/moderation_rules.go @@ -30,6 +30,9 @@ func (sub *Subscriber) GetModerationRule() *config.ModerationRule { if rule.IsNoBroadcastRule() { rules.NoBroadcast = true } + if rule.IsNoDarkVideoRule() { + rules.NoDarkVideo = true + } } } diff --git a/src/App.vue b/src/App.vue index 1cb157e..205c20a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3043,6 +3043,9 @@ export default { this.webcam.darkVideo.lastAverage = rgb; this.webcam.darkVideo.lastAverageColor = `rgba(${rgb[0]}, ${rgb[1]}, ${rgb[2]}, 1)`; + // If they are exempt from the dark video rule, do not check their camera color. + if (this.jwt.rules.IsNoDarkVideoRule) return; + // If the average total color is below the threshold (too dark of a video). let averageBrightness = Math.floor((rgb[0] + rgb[1] + rgb[2]) / 3); if (averageBrightness < this.webcam.darkVideo.threshold) { diff --git a/src/components/MessageBox.vue b/src/components/MessageBox.vue index 5e829aa..54c985d 100644 --- a/src/components/MessageBox.vue +++ b/src/components/MessageBox.vue @@ -331,7 +331,7 @@ export default { @@ -528,7 +528,7 @@ export default { - + Google Translate