From f2629ecb06df3e83a7a75c162e2309796ed8c615 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sat, 19 Oct 2024 13:49:29 -0700 Subject: [PATCH] Diagnostic feature for the dark video detector --- src/App.vue | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/src/App.vue b/src/App.vue index 9ef7303..4cc3fda 100644 --- a/src/App.vue +++ b/src/App.vue @@ -230,7 +230,7 @@ export default { // Configuration thresholds: how dark is too dark? (0-255) // NOTE: 0=disable the feature. - threshold: 0, // 10, + threshold: 10, }, }, @@ -383,6 +383,9 @@ export default { this.setupIdleDetection(); this.setupDropZone(); // file upload drag/drop + // Export a handy sendMessage function to the global window scope. + window.SendMessage = this.sendCommand; + // Configure the StatusMessage controller. StatusMessage.nsfw = this.config.permitNSFW; StatusMessage.currentStatus = () => { @@ -1138,11 +1141,23 @@ export default { if (this.webcam.darkVideo.lastImage === null) { this.ChatClient("There is no recent image available."); } else { - this.ChatClient( - `Last average color of your video: ${JSON.stringify(this.webcam.darkVideo.lastAverage)} ` + - `${this.webcam.darkVideo.lastAverageColor}` + - `
` - ); + this.ChatClient(` + Dark Video Detector: Diagnostics

+ If your camera has been detected as being "too dark" but you believe this was an error, please + find a chat moderator (or visit the main website and contact the support team) for assistance: + you may be able to help us to resolve this error.

+ In your message to an admin, please copy the following information:

+ * The last average color detected from your video: ${JSON.stringify(this.webcam.darkVideo.lastAverage)} + ${this.webcam.darkVideo.lastAverageColor}
+ * Your web browser user-agent: ${navigator.userAgent}

+ Below is a recent screenshot from your webcam, which the chat page uses to find the average color + of your video feed. Note: if this image appears to be solid black, but your webcam was not + actually this dark, definitely let us know! It may point to a bug in the dark video detector:

+

+ For a troubleshooting tip: if your webcam is a removable USB device, please try closing your web browser, + unplugging and reconnecting your webcam, and then open your web browser again and see if the issue + is resolved. If that worked, also let a chat moderator know! + `); } this.message = ""; return; @@ -2976,9 +2991,13 @@ export default { if (this.wasTooDark) { // Last sample was too dark too, = cut the camera. this.stopVideo(); - this.ChatClient( - "Your webcam was too dark to see anything and has been turned off.", - ); + this.ChatClient(` + Your webcam was too dark to see anything and has been turned off.

+ Note: if your camera did not look dark to you and you believe there + may have been an error, please + to see + diagnostic information and contact a chat room moderator for assistance. + `); } else { // Mark that this frame was too dark, if the next sample is too, // cut their camera.