diff options
author | Devaev Maxim <[email protected]> | 2021-05-19 09:11:44 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-05-19 09:11:44 +0300 |
commit | cd802864143636955bd82f6b292af62534c4f8d5 (patch) | |
tree | 1e923f2cab7d1862e9ea1f7a4154af88b43a6a4b | |
parent | ac109043ed03013083bfd771e248ef9ac43c66c7 (diff) |
Fixed pikvm/pikvm#307: mute hid switch
-rw-r--r-- | web/kvm/index.html | 10 | ||||
-rw-r--r-- | web/kvm/navbar-system.pug | 2 | ||||
-rw-r--r-- | web/share/js/kvm/keyboard.js | 2 | ||||
-rw-r--r-- | web/share/js/kvm/mouse.js | 2 |
4 files changed, 14 insertions, 2 deletions
diff --git a/web/kvm/index.html b/web/kvm/index.html index 2223c8ef..f91dc9ad 100644 --- a/web/kvm/index.html +++ b/web/kvm/index.html @@ -207,6 +207,16 @@ </table> </div> <hr> + <table class="kv"> + <td>Mute HID input events:</td> + <td align="right"> + <div class="switch-box"> + <input type="checkbox" id="hid-mute-switch"> + <label for="hid-mute-switch"><span class="switch-inner"></span><span class="switch"></span></label> + </div> + </td> + </table> + <hr> <div class="feature-disabled" id="v3-usb-breaker"> <table class="kv"> <td>Connect main USB to Server:</td> diff --git a/web/kvm/navbar-system.pug b/web/kvm/navbar-system.pug index 0cc1af00..7548852f 100644 --- a/web/kvm/navbar-system.pug +++ b/web/kvm/navbar-system.pug @@ -55,6 +55,8 @@ li(class="right") hr +menu_switch("hid-connect-switch", "Connect HID to Server", true, true) hr + +menu_switch("hid-mute-switch", "Mute HID input events", true, false) + hr div(id="v3-usb-breaker" class="feature-disabled") table(class="kv") td Connect main USB to Server: diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js index d9241ae3..1ec6b492 100644 --- a/web/share/js/kvm/keyboard.js +++ b/web/share/js/kvm/keyboard.js @@ -149,7 +149,7 @@ export function Keyboard(record_callback) { "event_type": "key", "event": {"key": code, "state": state}, }; - if (__ws) { + if (__ws && !$("hid-mute-switch").checked) { __ws.send(JSON.stringify(event)); } __record_callback(event); diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index dbdbdc44..3199745b 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -301,7 +301,7 @@ export function Mouse(get_resolution_callback, record_callback) { var __sendEvent = function(event_type, event) { event = {"event_type": event_type, "event": event}; - if (__ws) { + if (__ws && !$("hid-mute-switch").checked) { __ws.send(JSON.stringify(event)); } __record_callback(event); |