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

webcfg: add header and meta refresh for main page #379

Merged
merged 4 commits into from
Jun 3, 2024

Conversation

duhow
Copy link
Contributor

@duhow duhow commented May 29, 2024

Adds a meta refresh in main / website to reload every 15 seconds on visit.

@duhow duhow marked this pull request as ready for review May 29, 2024 18:05
@iranl
Copy link
Collaborator

iranl commented May 30, 2024

Wouldn't a async javascript call be a cleaner solution instead of forcibly refreshing the entire page every 15 seconds?

@duhow
Copy link
Contributor Author

duhow commented May 30, 2024

Anything works, sure. I'll check. Would you like to keep the custom header code anyway?

@duhow duhow marked this pull request as draft May 30, 2024 10:32
@technyon
Copy link
Owner

Agree, wouldn't this reset your viewport to the top of the page every 15 seconds?

I'm not sure if adding javascript and async calls is really worth it, I mean the header part only display basic information that rarely changes, unless you're pairing a device. Maybe we should send the header as long as no device is paired?

@iranl
Copy link
Collaborator

iranl commented May 31, 2024

See 85e8f9c for proposal using async javascript.

Updates every 3 seconds until:
-MQTT is connected
-Latest firmware is known (if update checking is enabled)
-Lock is paired and state is known (if lock is enabled)
-Opener is paired and state is known (if opener is enabled)

I do find the idea by @duhow usefull enough to implement something to tackle this as I find it annoying while pairing and/or restarting Nuki Hub that these values don't auto refresh, at least until a valid value is known.

Propose async javascript is a better solution than refreshing the entire page as the viewport won't reset and it can thus be set to refresh much more often/quickly without interupting the user.

@iranl iranl added the enhancement New feature or request label May 31, 2024
@iranl iranl added this to the 8.35 milestone May 31, 2024
@technyon
Copy link
Owner

technyon commented Jun 1, 2024

ok sure let't go for it then.

@iranl iranl marked this pull request as ready for review June 1, 2024 04:04
src/WebCfgServer.cpp Outdated Show resolved Hide resolved
Co-authored-by: David Girón <contacto@duhowpi.net>
@technyon
Copy link
Owner

technyon commented Jun 3, 2024

So this is ready to be merged?

@iranl
Copy link
Collaborator

iranl commented Jun 3, 2024

LGTM and tested without problems on my end.

@duhow You ok with the current state?

@duhow
Copy link
Contributor Author

duhow commented Jun 3, 2024

✅ As a first iteration looks good, web content gets updated.
⚠️ However, upon restarting, the second update gets undefined JS state...

Ideally you may want to fully change the main page content to be rendered with JS, but does not need to be on this PR.

Screenshot_20240603_082420_Chrome~2

@technyon technyon merged commit 71314ff into technyon:master Jun 3, 2024
2 checks passed
@duhow
Copy link
Contributor Author

duhow commented Jun 3, 2024

Thank you all! 😄

@duhow duhow deleted the refresh-main branch June 3, 2024 06:33
@iranl
Copy link
Collaborator

iranl commented Jun 4, 2024

✅ As a first iteration looks good, web content gets updated. ⚠️ However, upon restarting, the second update gets undefined JS state...

Fixed in #389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants