diff --git a/web/share/js/kvm/atx.js b/web/share/js/kvm/atx.js index 69a0d2c51..b910a302e 100644 --- a/web/share/js/kvm/atx.js +++ b/web/share/js/kvm/atx.js @@ -39,7 +39,7 @@ export function Atx(__recorder) { $("atx-power-led").title = "Power Led"; $("atx-hdd-led").title = "Disk Activity Led"; - tools.storage.bindSimpleSwitch($("atx-ask-switch"), "atx.ask", true); + tools.storage.bindSimpleSwitch($("atx-ask-switch"), "atx.ask", tools.config.getBool("kvm--atx-ask", true)); tools.el.setOnClick($("atx-power-button"), () => __clickAtx("power")); tools.el.setOnClick($("atx-power-button-long"), () => __clickAtx("power_long")); diff --git a/web/share/js/kvm/hid.js b/web/share/js/kvm/hid.js index 0e778e2c6..5c8183930 100644 --- a/web/share/js/kvm/hid.js +++ b/web/share/js/kvm/hid.js @@ -75,7 +75,7 @@ export function Hid(__getGeometry, __recorder) { }); } - tools.storage.bindSimpleSwitch($("hid-sysrq-ask-switch"), "hid.sysrq.ask", true); + tools.storage.bindSimpleSwitch($("hid-sysrq-ask-switch"), "hid.sysrq.ask", tools.config.getBool("kvm--hid-sysrq-ask", true)); tools.el.setOnClick($("hid-jiggler-switch"), __clickJigglerSwitch); }; diff --git a/web/share/js/kvm/keyboard.js b/web/share/js/kvm/keyboard.js index 040cc01dd..e0fbeee4c 100644 --- a/web/share/js/kvm/keyboard.js +++ b/web/share/js/kvm/keyboard.js @@ -50,8 +50,8 @@ export function Keyboard(__recordWsEvent) { window.addEventListener("focusin", __updateOnlineLeds); window.addEventListener("focusout", __updateOnlineLeds); - tools.storage.bindSimpleSwitch($("hid-keyboard-bad-link-switch"), "hid.keyboard.bad_link", false); - tools.storage.bindSimpleSwitch($("hid-keyboard-swap-cc-switch"), "hid.keyboard.swap_cc", false); + tools.storage.bindSimpleSwitch($("hid-keyboard-bad-link-switch"), "hid.keyboard.bad_link", tools.config.getBool("kvm--hid-keyboard-bad-link", false)); + tools.storage.bindSimpleSwitch($("hid-keyboard-swap-cc-switch"), "hid.keyboard.swap_cc", tools.config.getBool("kvm--hid-keyboard-swap-cc", false)); __el_magic = $("hid-keyboard-magic-selector"); let alt = (tools.browser.is_apple ? "Option" : "Alt"); diff --git a/web/share/js/kvm/main.js b/web/share/js/kvm/main.js index a52be1c1f..4c93b74e4 100644 --- a/web/share/js/kvm/main.js +++ b/web/share/js/kvm/main.js @@ -45,7 +45,7 @@ export function main() { } }, false); - tools.storage.bindSimpleSwitch($("page-close-ask-switch"), "page.close.ask", true, function(value) { + tools.storage.bindSimpleSwitch($("page-close-ask-switch"), "page.close.ask", tools.config.getBool("kvm--page-close-ask", true), function(value) { if (value) { window.onbeforeunload = function(ev) { let text = "Are you sure you want to close PiKVM session?"; diff --git a/web/share/js/kvm/mouse.js b/web/share/js/kvm/mouse.js index 8604ef87e..6d78f36eb 100644 --- a/web/share/js/kvm/mouse.js +++ b/web/share/js/kvm/mouse.js @@ -85,12 +85,12 @@ export function Mouse(__getGeometry, __recordWsEvent) { $("stream-box").addEventListener("touchmove", __streamTouchMoveHandler); $("stream-box").addEventListener("touchend", __streamTouchEndHandler); - tools.storage.bindSimpleSwitch($("hid-mouse-squash-switch"), "hid.mouse.squash", true); - tools.storage.bindSimpleSwitch($("hid-mouse-reverse-scrolling-y-switch"), "hid.mouse.reverse_scrolling", false); - tools.storage.bindSimpleSwitch($("hid-mouse-reverse-scrolling-x-switch"), "hid.mouse.reverse_panning", false); + tools.storage.bindSimpleSwitch($("hid-mouse-squash-switch"), "hid.mouse.squash", tools.config.getBool("kvm--hid-mouse-squash", true)); + tools.storage.bindSimpleSwitch($("hid-mouse-reverse-scrolling-y-switch"), "hid.mouse.reverse_scrolling", tools.config.getBool("kvm--hid-mouse-reverse-scrolling", false)); + tools.storage.bindSimpleSwitch($("hid-mouse-reverse-scrolling-x-switch"), "hid.mouse.reverse_panning", tools.config.getBool("kvm--hid-mouse-reverse-panning", false)); let cumulative_scrolling = !(tools.browser.is_firefox && !tools.browser.is_mac); - tools.storage.bindSimpleSwitch($("hid-mouse-cumulative-scrolling-switch"), "hid.mouse.cumulative_scrolling", cumulative_scrolling); - tools.storage.bindSimpleSwitch($("hid-mouse-dot-switch"), "hid.mouse.dot", true, __updateOnlineLeds); + tools.storage.bindSimpleSwitch($("hid-mouse-cumulative-scrolling-switch"), "hid.mouse.cumulative_scrolling", tools.config.getBool("kvm--hid-mouse-cumulative-scrolling", cumulative_scrolling)); + tools.storage.bindSimpleSwitch($("hid-mouse-dot-switch"), "hid.mouse.dot", tools.config.getBool("kvm--hid-mouse-dot", true), __updateOnlineLeds); __updateOnlineLeds(); }; diff --git a/web/share/js/kvm/paste.js b/web/share/js/kvm/paste.js index 8a23cb6a5..482ca0435 100644 --- a/web/share/js/kvm/paste.js +++ b/web/share/js/kvm/paste.js @@ -39,9 +39,9 @@ export function Paste(__recorder) { } }); - tools.storage.bindSimpleSwitch($("hid-pak-ask-switch"), "hid.pak.ask", true); + tools.storage.bindSimpleSwitch($("hid-pak-ask-switch"), "hid.pak.ask", tools.config.getBool("kvm--hid-pak-ask", true)); - tools.storage.bindSimpleSwitch($("hid-pak-secure-switch"), "hid.pak.secure", false, function(value) { + tools.storage.bindSimpleSwitch($("hid-pak-secure-switch"), "hid.pak.secure", tools.config.getBool("kvm--hid-pak-secure", false), function(value) { $("hid-pak-text").style.setProperty("-webkit-text-security", (value ? "disc" : "none")); }); diff --git a/web/share/js/kvm/stream.js b/web/share/js/kvm/stream.js index e7f1f6ee7..18851b192 100644 --- a/web/share/js/kvm/stream.js +++ b/web/share/js/kvm/stream.js @@ -73,7 +73,7 @@ export function Streamer() { // Not getInt() because of radio is a string container. // Also don't reset Streamer at class init. - tools.radio.clickValue("stream-orient-radio", tools.storage.get("stream.orient", 0)); + tools.radio.clickValue("stream-orient-radio", tools.storage.get("stream.orient", tools.config.get("kvm--stream-orient", 0))); tools.radio.setOnClick("stream-orient-radio", function() { if (["janus", "media"].includes(__streamer.getMode())) { let orient = parseInt(tools.radio.getValue("stream-orient-radio")); @@ -98,7 +98,7 @@ export function Streamer() { tools.el.setEnabled($("stream-cam-switch"), !!value); }); - tools.storage.bindSimpleSwitch($("stream-mic-switch"), "stream.mic", false, function(allow_mic) { + tools.storage.bindSimpleSwitch($("stream-mic-switch"), "stream.mic", tools.config.getBool("kvm--stream-mic", false), function(allow_mic) { if (__streamer.getMode() === "janus") { if (__streamer.isMicAllowed() !== allow_mic) { __resetStream(); @@ -106,7 +106,7 @@ export function Streamer() { } }); - tools.storage.bindSimpleSwitch($("stream-cam-switch"), "stream.cam", false, function(allow_cam) { + tools.storage.bindSimpleSwitch($("stream-cam-switch"), "stream.cam", tools.config.getBool("kvm--stream-cam", false), function(allow_cam) { if (__streamer.getMode() === "janus") { if (__streamer.isCamAllowed() !== allow_cam) { __resetStream(); @@ -117,7 +117,7 @@ export function Streamer() { tools.el.setOnClick($("stream-screenshot-button"), __clickScreenshotButton); tools.el.setOnClick($("stream-reset-button"), __clickResetButton); - tools.storage.bindSimpleSwitch($("stream-suspend-switch"), "stream.suspend", false, __visibilityHook); + tools.storage.bindSimpleSwitch($("stream-suspend-switch"), "stream.suspend", tools.config.getBool("kvm--stream-suspend", false), __visibilityHook); $("stream-window").show_hook = __visibilityHook; $("stream-window").close_hook = __visibilityHook; @@ -253,7 +253,7 @@ export function Streamer() { tools.feature.setEnabled($("stream-cam"), false); } - let mode = tools.storage.get("stream.mode", "janus"); + let mode = tools.storage.get("stream.mode", tools.config.get("kvm--stream-mode", "janus")); if (mode === "janus" && !has_janus) { mode = "media"; } diff --git a/web/share/js/kvm/switch.js b/web/share/js/kvm/switch.js index 75d7136db..e820eae95 100644 --- a/web/share/js/kvm/switch.js +++ b/web/share/js/kvm/switch.js @@ -45,8 +45,8 @@ export function Switch() { tools.el.setOnClick($("switch-edid-remove-button"), __clickRemoveEdidButton); tools.el.setOnClick($("switch-edid-copy-data-button"), __clickCopyEdidDataButton); - tools.storage.bindSimpleSwitch($("switch-atx-ask-switch"), "switch.atx.ask", true); - tools.storage.bindSimpleSwitch($("switch-msd-ask-switch"), "switch.msd.ask", true); + tools.storage.bindSimpleSwitch($("switch-atx-ask-switch"), "switch.atx.ask", tools.config.getBool("kvm--switch-atx-ask", true)); + tools.storage.bindSimpleSwitch($("switch-msd-ask-switch"), "switch.msd.ask", tools.config.getBool("kvm--switch-msd-ask", true)); for (let role of ["inactive", "active", "flashing", "beacon", "bootloader"]) { let el_brightness = $(`switch-color-${role}-brightness-slider`);