-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it easier for downstream to modify settings #1428
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
I just realised this isn't going to work with Putting this on hold for now. |
So #1477 is now up, so we just need to wait for that. |
Bump because this would be very useful and #1477 is now merged |
It's still on my todo, but I'm unsure when I'll have time to finish this. |
Makes sure everything behaves the same way, even if there is no visible UI for a settings.
Makes it easier to see how things are connected.
951795c
to
3bef61e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great, this is a nice improvement!
I tested both setting stuff in vnc.html and in the defaults.json/mandatory.json, things work as expected as long as you clear the web storage inbetween, or use a private-browsing tab.
@@ -175,8 +187,6 @@ const UI = { | |||
UI.initSetting('repeaterID', ''); | |||
UI.initSetting('reconnect', false); | |||
UI.initSetting('reconnect_delay', 5000); | |||
|
|||
UI.setupSettingLabels(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to why this was moved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new code disables the UI for mandatory settings. The mapping between controls and labels need to be set up before we go through the settings for the labels to also be disabled properly.
app/ui.js
Outdated
@@ -24,6 +24,8 @@ const LINGUAS = ["cs", "de", "el", "es", "fr", "it", "ja", "ko", "nl", "pl", "pt | |||
|
|||
const UI = { | |||
|
|||
userSettings: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why userSettings
? When I read "user" I think about the end user in the browser, not about a dev who integrates noVNC's ui.js into his app.
Perhaps overriddenSettings
would better indicate what's special about these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I understand the confusion. I think "custom" might be even better descriptor.
And the target audience in my mind are mainly sysadmins, not developers.
Log.Error("Couldn't fetch mandatory.json: " + err); | ||
} | ||
|
||
// You can also override any defaults you need here: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neat!
Could we add a comment about how to find names of settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Don't know how to best refer to it, though. Just "docs/EMBEDDING.md"
?
@@ -0,0 +1 @@ | |||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these include a commented-out example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JSON doesn't support comments 🤬
Expose a simple and stable API to override default settings, and force settings that users shouldn't be able to change.
Make it even easier to customize things by loading the settings from separate configuration files.
Hmm... It looks like the tests are broken on |
Expose a simple and stable API to override default settings, and force settings that users shouldn't be able to change.
Fixes #1159.