Closed mpvader closed 2 weeks ago
Interesting, I have quickly cross-checked that it still works as expected, and it indeed does not work on Furuno while working on other MFDs... but it was not like this before, so this must have been broken during one of the recent builds, and if I curl http://A.B.C.D/gui-v1/
I can indeed see some new JS logic that was not there before... and that is probably confusing the old WebKit browser in Furuno...
Furuno left, Simard right...
nice find, pls see if you can fix that.
Either let us know what needs fixing, or do it directly by making a PR to where we have that in git, which is most likely here:
https://github.com/victronenergy/javascript-vnc-client/blob/master/index.php
or here:
Although I could not yet confirm precisely the root cause, as it is a bit tricky to install window.onerror
handlers inside iframe
that HTML5 app uses to load remote console, from my existing experience I speculate that with very high probability this is the root cause:
The async function
syntax very probably causes syntax error on Furuno, thus stopping the window.onscriptload
handler from executing, thus getting frozen.
Introduced by this commit a month ago: https://github.com/victronenergy/javascript-vnc-client/commit/4923727ba2c745e97d2fef1285caea7ac6549a48
Solution: those two methods need to be rewritten to plain old promise based JS syntax.
Just to confirm, if I mount -o remount,rw /
and modify /var/www/venus/gui-v1/index.php
to revert the commit introducing the async function
it works again.
Here is the fix: the method async function isGuiv2Running
can be dropped entirely, and the other method can be rewritten like this:
Although I am not entirely sure what the purpose of that method is so I could not test whether it works as expected. But it definitely can be compiled by WebKit on Furuno and allows the classic console to load again.
function checkGuiv2() {
fetch(location.protocol + "//" + location.hostname, {cache: "no-cache"})
.then(function(response) {
if (response.ok) {
if (response.redirected && response.url.includes("gui-v2")) {
location.replace(response.url)
}
}
})
.catch(function(error) {})
}
The fix is included in master and backported to v3.52~2.
~next step: await reply.~ next step: review the PR by Jeroen
Report: https://community.victronenergy.com/t/v3-50-confusion-with-the-marine-mfd-app/10355
How it looks on a Furuno:
Further details below.