Skip to content
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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

CendioOssman
Copy link
Member

Expose a simple and stable API to override default settings, and force settings that users shouldn't be able to change.

Fixes #1159.

@CendioOssman CendioOssman added this to the v1.2.0 milestone Jun 26, 2020
Copy link
Member

@samhed samhed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@CendioOssman
Copy link
Member Author

I just realised this isn't going to work with use_require.js. So either that needs to be fixed somehow, or we have to wait until we can drop Internet Explorer and require module support.

Putting this on hold for now.

@CendioOssman CendioOssman modified the milestones: v1.2.0, Future Features Jun 29, 2020
@CendioOssman CendioOssman marked this pull request as draft June 29, 2020 12:11
@CendioOssman
Copy link
Member Author

So #1477 is now up, so we just need to wait for that.

@tculp
Copy link

tculp commented Apr 19, 2021

Bump because this would be very useful and #1477 is now merged

@CendioOssman
Copy link
Member Author

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.
@CendioOssman CendioOssman force-pushed the ui_init branch 2 times, most recently from 951795c to 3bef61e Compare August 8, 2024 14:24
@CendioOssman CendioOssman marked this pull request as ready for review August 8, 2024 14:26
@samhed samhed modified the milestones: Future Features, v1.6.0 Oct 3, 2024
Copy link
Member

@samhed samhed left a 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();
Copy link
Member

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?

Copy link
Member Author

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: {},
Copy link
Member

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?

Copy link
Member Author

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:
Copy link
Member

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?

Copy link
Member Author

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 @@
{}
Copy link
Member

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?

Copy link
Member Author

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.
@CendioOssman
Copy link
Member Author

Hmm... It looks like the tests are broken on master. Something with the new H.264 code. Open a new issue and ping the author(s) of that code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make it easier to customize default host, password, port in the url via code
3 participants