web: allow server-side defaults for page-close and stream-suspend settings#209
Open
nullstacked wants to merge 1 commit intopikvm:masterfrom
Open
web: allow server-side defaults for page-close and stream-suspend settings#209nullstacked wants to merge 1 commit intopikvm:masterfrom
nullstacked wants to merge 1 commit intopikvm:masterfrom
Conversation
7952b54 to
c069113
Compare
Apply the existing tools.config.getBool()/get() pattern to all remaining bindSimpleSwitch calls and storage.get() defaults across the Web UI, allowing admins to set defaults for every toggle via /etc/kvmd/web.css CSS custom properties. Previously only "Expand for the entire tab" supported this. Now all settings including confirmations, keyboard/mouse options, stream mode/orientation, mic/cam, and more can be configured server-side while still allowing per-user localStorage overrides.
c069113 to
d6126c7
Compare
Member
|
Hello. I like the idea but I need to think a bit about implementation. |
Author
Thank you for taking a look. Reason I went with this approach is because I saw you had code already using this already for one of the ui settings so I thought that was the established pattern:
Either way would be great to get a solution as the use case for this request is because I have multiple users across many browsers and we have to constantly reapply the settings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Web UI has ~18 client-side settings with defaults hardcoded in JavaScript. Only one of them (
Expand for the entire tab by default) uses the existingtools.config.getBool()mechanism to allow server-side configuration via CSS custom properties in/etc/kvmd/web.css.This PR extends that same pattern to all remaining settings, so admins can configure defaults for every UI toggle server-side.
What changed
Every
tools.storage.bindSimpleSwitch()call with a hardcoded default now reads fromtools.config.getBool()(ortools.config.get()for non-boolean values) first, falling back to the original default. No behavior changes when no CSS properties are set.Files changed:
web/share/js/kvm/main.js— page close confirmationweb/share/js/kvm/stream.js— stream suspend, mic, cam, mode, orientationweb/share/js/kvm/atx.js— ATX confirmation dialogweb/share/js/kvm/switch.js— switch ATX/MSD confirmationsweb/share/js/kvm/hid.js— SysRq confirmationweb/share/js/kvm/keyboard.js— bad link, swap Ctrl/CapsLockweb/share/js/kvm/mouse.js— squash, reverse scroll X/Y, cumulative scroll, dot cursorweb/share/js/kvm/paste.js— paste confirmation, secure modeExample usage
Admins can now set defaults in
/etc/kvmd/web.css:These set the initial default for new users or cleared browsers. Users can still override via the UI, and their preference is saved in localStorage as before.
Notes
tools.config.getBool()/tools.config.get()infrastructure and the CSS injection pipeline (/etc/kvmd/web.css→ nginxuser.cssalias →:rootproperties) already exist