EdddieN / machinon-domoticz_theme

GNU General Public License v3.0
46 stars 21 forks source link

Modified webroot causes theme to be poorly rendered #256

Closed CV8R closed 5 years ago

CV8R commented 5 years ago

Using Linux on x64 (not Pi) and running Domoticz with a modified webroot (for reverse proxy) the themes web page is rendered poorly. When I remove the modified webroot the page loads correctly.

To reproduce: Modify Domoticz to use a webroot by modifying /etc/init.d/domoticz.sh to add -webroot with path ha

eg. DAEMON_ARGS="$DAEMON_ARGS -www 8080 -webroot ha" DAEMON_ARGS="$DAEMON_ARGS -sslwww 443 -webroot ha"

davidlb commented 5 years ago

Thanks for your report. I cannot reproduce it, can you add screenshots and console with errors?

CV8R commented 5 years ago

No console errors to report (other than cert stuff below) and nothing really significant to report in the console log using a compare. Happy to share if required.

Here is the first start up snippet when running the -webroot ha

Apologies for the formatting, can't figure out the carriage returns...

2019-05-14 10:07:08.847 Status: Domoticz V4.10717 (c)2012-2019 GizMoCuz 2019-05-14 10:07:08.848 Status: Build Hash: b38b49e5, Date: 2019-05-09 21:04:08 2019-05-14 10:07:08.866 Status: Startup Path: /home/domoticz/domoticz/ 2019-05-14 10:07:08.903 Sunrise: 06:49:00 SunSet: 17:09:00 2019-05-14 10:07:08.903 Day length: 10:20:00 Sun at south: 11:59:00 2019-05-14 10:07:08.903 Civil twilight start: 06:22:00 Civil twilight end: 17:36:00 2019-05-14 10:07:08.903 Nautical twilight start: 05:52:00 Nautical twilight end: 18:06:00 2019-05-14 10:07:08.903 Astronomical twilight start: 05:22:00 Astronomical twilight end: 18:37:00 2019-05-14 10:07:09.009 Status: PluginSystem: Started, Python version '3.6.7'. 2019-05-14 10:07:09.021 Active notification Subsystems: email, gcm (2/13) 2019-05-14 10:07:09.023 Status: WebServer(HTTP) started on address: :: with port 8080 2019-05-14 10:07:09.027 Error: [web:443] missing SSL certificate chain file ./server_cert.pem! 2019-05-14 10:07:09.027 Error: [web:443] missing SSL certificate file ./server_cert.pem! 2019-05-14 10:07:09.027 Error: [web:443] missing SSL private key file ./server_cert.pem! 2019-05-14 10:07:09.027 Error: [web:443] missing SSL DH parameters file ./server_cert.pem! 2019-05-14 10:07:09.028 Status: WebServer(SSL) started on address: :: with port 443 2019-05-14 10:07:09.032 Starting shared server on: :::6144 2019-05-14 10:07:09.032 Status: TCPServer: shared server started... 2019-05-14 10:07:09.032 Status: RxQueue: queue worker started... 2019-05-14 10:07:11.034 Status: Pinger: Worker started... 2019-05-14 10:07:11.035 Status: AppLamp: Worker Started... 2019-05-14 10:07:11.035 Status: YeeLight Worker started... 2019-05-14 10:07:11.036 Status: Kodi: Started 2019-05-14 10:07:11.037 Status: MySensors: trying to connect to: 14.78.5.61:5003 2019-05-14 10:07:11.038 Status: MySensors: trying to connect to: 14.78.5.62:5003 2019-05-14 10:07:11.038 Status: MySensors: connected to: 14.78.5.61:5003 2019-05-14 10:07:11.039 Status: MySensors: trying to connect to: 14.78.5.63:5003 2019-05-14 10:07:11.040 Status: (Panasonic Ducted AC) Started. 2019-05-14 10:07:11.040 Status: EventSystem: reset all events... 2019-05-14 10:07:11.040 Status: MySensors: connected to: 14.78.5.63:5003 2019-05-14 10:07:11.043 MySensors: Gateway Ready... 2019-05-14 10:07:11.045 MySensors: Gateway Ready... 2019-05-14 10:07:11.047 Status: dzVents: Write file: /home/domoticz/domoticz/scripts/dzVents/generated_scripts/DuoSw1.lua

Image 1. Cleared the browser cache, ran domoticz from command line with no mod webroot

sudo /home/domoticz/domoticz/domoticz -www 8080 -sslwww 443 > StdWebroot.txt

Note, the Machinon banner was not present.

Machinon_1

Image 2, reset theme settings and banner appeared on browser refresh

Machinon_2

Image 3. ran domoticz from command line with webroot sudo /home/domoticz/domoticz/domoticz -www 8080 -sslwww 443 -webroot ha > ModWebroot.txt Machinon_3

Image 4. Reset theme.

Machinon_4

DewGew commented 5 years ago

Looks like machinon settings is not loaded correct. Try to delete machinon uservariables and clear localstorage in your browser. Then clear appcache and reload page

CV8R commented 5 years ago

Hi DewGew,

I have cleared the cache (many times). How do I clear the machinon uservariables? I have tried multiple browsers and incognito modes. Not sure if it explains why it loads correctly 100% when using the standard www path (no webroot).

DewGew commented 5 years ago

You delete then in Domoticz settings - uservariables. Look for machinon-folder-custom and machinon-folder-settings and delete them

boscorelly commented 5 years ago

i had the same problem with default configuration.

boscorelly commented 5 years ago

there is a big bug : when you enable icons + text at the same time, nothing is saved !

i had to enable icons, save, then enable text.

boscorelly commented 5 years ago

humm... maybe i'm wrong, it seems the problem is when you check more than 2 boxes.

EdddieN commented 5 years ago

I used to have that issue many version back when some odd full URL addresses were not working behind a proxy but I believe those were fixed many revisions back.

Can you check on Chrome inspector on the network tab if it is failing to load anything?

boscorelly commented 5 years ago

I will Check.

But no proxy, it’s a pure nat.

CV8R commented 5 years ago

Theme settings says Machinon theme V.1.7.2

I deleted uservariables, cleared cache, reloaded page - still broken.

I couldn't get it to re-enter any uservariables - tried a reboot, reset theme.

These were status 400 in the network monitor: http://14.78.0.30:8080/json.htm?type=command&param=getuservariables http://14.78.0.30:8080/ha/images/custompage.png http://14.78.0.30:8080/ha/images/notify.png http://14.78.0.30:8080/ha/images/searchicon.png

boscorelly commented 5 years ago

jquery-3.3.1.min.js:2 Uncaught ReferenceError: checkSettingsHTML is not defined at HTMLDocument. (custom.js:69) at l (jquery-3.3.1.min.js:2) at c (jquery-3.3.1.min.js:2) (index):126 Uncaught TypeError: generate_noty is not a function at NotifyCacheRefresh ((index):126) at ApplicationCache. ((index):321) (index):169 Uncaught TypeError: generate_noty is not a function at ShowUpdateNotification ((index):169) at Object.success (app.js:655) at u (jquery-3.3.1.min.js:2) at Object.fireWith [as resolveWith] (jquery-3.3.1.min.js:2) at k (jquery-3.3.1.min.js:2) at XMLHttpRequest. (jquery-3.3.1.min.js:2) at Object.send (jquery-3.3.1.min.js:2) at Function.ajax (jquery-3.3.1.min.js:2) at app.js:632 at Object.invoke (angular.min.js:44) custom.js:37 Uncaught ReferenceError: DelRow is not defined at custom.js:37 at Array.forEach () at MutationObserver. (custom.js:29) custom.js:37 Uncaught ReferenceError: DelRow is not defined at custom.js:37 at Array.forEach () at MutationObserver. (custom.js:29) Application Cache Error event: Resource fetch failed (404) https://*****.org/acttheme/Compact

davidlb commented 5 years ago

DelRow function have been removed in the code for many weeks (months?), it's really a cache issue or you didn't update the theme to the last version.

It seems you are using Firefox, here are the steps to follow: https://support.mozilla.org/en-US/kb/storage#w_delete-site-storage-for-individual-websites

CV8R commented 5 years ago

Not sure who the DelRow comment is for. But I will try cache clear again, but that is what I have been doing. Removed all sites and cleared all information each test.

I'll also try a machine that has never connected to Domoticz before.

If I remove -webroot ha and restart Domoticz it works fine. As a test I will try another webroot like -webroot domoticz.

CV8R commented 5 years ago

I just tried running domoticz from the command line with

sudo /home/domoticz/domoticz/domoticz -www 8080 -webroot domoticz

Opened the page on my regular machine and a fresh machine (different hardware not VM) and the page was rendered the same as the broken images above.

Used this URL http://14.78.0.30:8080/domoticz/

I then stopped and restarted domoticz with

sudo /home/domoticz/domoticz/domoticz -www 8080

Used this URL http://14.78.0.30:8080/ in the same tab using the delete key to remove domoticz/ hit refresh and both machines loaded the page as expected.

Interestingly and only listed for completeness - the machinon banner was present on both machines on initial load of the page but i was using chrome this time on the fresh machine. Earlier when testing on Firefox the banner didn't load first time until i reset the theme settings.

davidlb commented 5 years ago

I fixed several issues today regarding Firefox, can you update to beta and give it a new try (click on reset theme button should be enough now).

CV8R commented 5 years ago

Unfortunately no change for me. I Stopped Domoticz service, deleted old beta folder, installed new beta using github Checking beta guide, restarted Domoticz service,, changed theme to beta, cleaned browser cache & reset theme. Also tried clearing cache after reset of theme. No diff for Chrome BTW, same result.

davidlb commented 5 years ago

I finally manage to reproduce it. It should be good now.

boscorelly commented 5 years ago

Je teste ça demain.

HS : un moyen de te DM ?

CV8R commented 5 years ago

Fixed! With one minor exception. Tried on three browsers and all worked.

I found that my custom icons were not displayed in Dashboard or Switches tab. I thought they may not be supported by Machinon so went to Switches to edit them and change the icon back to default. However, in the drop down list in the edit screen they are rendered correctly.

Should I log a new issue?

Thank you for so much for sticking with it!

davidlb commented 5 years ago

@boscorelly par le forum Domoticz https://www.domoticz.com/forum/memberlist.php?mode=viewprofile&u=12098 ou sinon par mail david (at) trucs (dot) org

davidlb commented 5 years ago

@CV8R in fact, it's a domoticz issue, I'll check if I can spot it to fix it and submit a patch to the domoticz repo (in order to remove my ugly patch in the machinon theme).

boscorelly commented 5 years ago

i reverted to default theme, and deleted custom variables. i have updated the theme, and activated it. I went to settings, and seen previous settings were still here. I tried to save a change : disabling iframe (only this and nothing else). Nothing happened. Tested again with 2 more boxes checked, and it worked.

Really strange. (chrome cache was emptied before)

davidlb commented 5 years ago

Patch submitted to Domoticz, I keep you informed when it's fixed and I will remove my dirty patch from machinon theme

davidlb commented 5 years ago

PR merged, update Domoticz to last development version. Temporary patch removed from Machinon theme.