jcorporation / myMPD

myMPD is a standalone and mobile friendly web mpd client with a tiny footprint and advanced features.
https://jcorporation.github.io/myMPD/
GNU General Public License v3.0
419 stars 65 forks source link

Javascript error for v8.2.0 on centos7 #630

Closed jcorporation closed 2 years ago

jcorporation commented 2 years ago

While it works on my CentOS8 testsystem, on CentOS7 I cannot get it to work. I disabled selinux temporarily but no avail. The Java script errors are: combined.js:8 ERROR: Locale denot defined logLog @ combined.js:8 combined.js:8 ERROR: JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'dispose') (http://mpd.hal9000.at:8080/js/combined.js: 8)

Originally posted by @GK-774 in https://github.com/jcorporation/myMPD/discussions/438#discussioncomment-1780969

jcorporation commented 2 years ago

It seems the compiled javascript is erroneous.

GK-774 commented 2 years ago

This is from a build this afternoon.

I will try the new current devel in a few minutes and attach the combined.js if the error is still present. (I did not keep the one from this afternoon, it was a build of a rpm package).

I used the devtoolset-10 (gcc (GCC) 10.2.1) if this is of any importance, but on the other system (centos 8) I use gcc 10 as well and there it works. I did not see any errors (except notifications about some translations which are not relevant, I think) while building.

This was the error I got on the screen when connecting:

JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'dispose') (http://192.168.22.129/js/combined.js: 8)

(and a red Reload button - reload did not help)

And the browser (Chrome) Java Console:

[DOM] Password field is not contained in a form: (More info: https://goo.gl/9p2vKq) <input id=​"inputPinModal" class=​"form-control" type=​"password">​ combined.js:8 ERROR: Locale denot defined logLog @ combined.js:8 logError @ combined.js:8 setLocale @ combined.js:8 parseSettings @ combined.js:8 (anonymous) @ combined.js:8 ajaxRequest.onreadystatechange @ combined.js:8 XMLHttpRequest.send (async) sendAPI @ combined.js:8 appInitStart @ combined.js:8 (anonymous) @ combined.js:8 combined.js:8 ERROR: JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'dispose') (http://192.168.22.129/js/combined.js: 8) logLog @ combined.js:8 logError @ combined.js:8 window.onerror @ combined.js:8 error (async) (anonymous) @ combined.js:8

The log is attached.

I will try the new devel now. mympd_log.zip

GK-774 commented 2 years ago

Still the same error, please find attached the combined.js file. combined.js.gz mympd_log-2.zip

jcorporation commented 2 years ago

The javascript source should be OK.

combined.js:8 ERROR: Locale denot defined

It seems your state file webui_settings is corrupt. Locale should be de-DE not de. But this is not causing your error.

Can you please attach your state files? Default under /var/lib/mympd/state/.

I tried with the default v8.1.6 state files and v8.2.0 works properly in my env.

Alternatively try the debug build. This can help narrow down this javascript error.

./build.sh debug
sudo debug/mympd

For the debug build the mympd user must have access to the htdocs directory in the source tree.

GK-774 commented 2 years ago

It was a completely fresh install, so the webui_settings was freshly generated and all it contains is {} I now tried to replace it with the one from a working 8.1.6 installation but got the same error.

Besides that it is mysterious how the de-DE locale is popping up, because the Linux machine with mympd is English and my company laptop which I used is completely in English as well (Windows, Browser, just everything). The webui_settings taken from the working 8.1.6 installation had uiLocale default, I tried en-US, no change, changed to de-DE, only change that I get "JavaScript Fehler" and "Neu laden".

I can try the debug build tomorrow. What has exactly to be done to collect the required information with the debug build?

jcorporation commented 2 years ago

This issue is going stranger and stranger...

webui_settings with {} is completely ok.

The debug build does not combine and minify the javascript files and does not trim debug statements in the javascript source.

You should set the browser log to debug. The error in the browser should be then more meaningful.

jcorporation commented 2 years ago

I think I found the error. You have scripting disabled (compiled without lua). There was an undefined reference to the old mainmenu in exact this codepath.

jcorporation commented 2 years ago

Is fixed with e3f5fbd, please test again.

GK-774 commented 2 years ago

Many thanks, works great!