From 3212aa5df6c939ca34f59d5e1339d60a516945f4 Mon Sep 17 00:00:00 2001 From: Xaekai Date: Sat, 22 Jan 2022 07:55:36 -0800 Subject: [PATCH] Allow for the omission of particular frames in SOCKET_DEBUG In particular, mediaUpdate spam. --- www/js/callbacks.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/www/js/callbacks.js b/www/js/callbacks.js index 24f90ac3..31dddcef 100644 --- a/www/js/callbacks.js +++ b/www/js/callbacks.js @@ -1173,18 +1173,25 @@ Callbacks = { } } -var SOCKET_DEBUG = localStorage.getItem('cytube_socket_debug') === 'true'; +var SOCKET_DEBUG = { + enabled: (localStorage.getItem('cytube_socket_debug') === 'true'), + omit: (((data)=>{ + const frames = data === null ? [] : JSON.parse(data); + return frames; + })(localStorage.getItem('cytube_socket_omissions'))) +} + setupCallbacks = function() { for(var key in Callbacks) { (function(key) { socket.on(key, function(data) { - if (SOCKET_DEBUG) { + if (SOCKET_DEBUG.enabled && !SOCKET_DEBUG.omit.includes(key)) { console.log(key, data); } try { Callbacks[key](data); } catch (e) { - if (SOCKET_DEBUG) { + if (SOCKET_DEBUG.enabled) { console.log("EXCEPTION: " + e + "\n" + e.stack); } }