howardjones / network-weathermap

Network Weathermap draws diagrams from data
http://www.network-weathermap.com/
MIT License
426 stars 94 forks source link

React user app should use API to get HTML #163

Closed howardjones closed 5 years ago

howardjones commented 5 years ago

The output/ directory should not be web-accessible. There should be an API command like viewimage for fetching the HTML too. That way, it goes through the Cacti authentication system.

(This would go in WeatherMapCactiUserPlugin.php)

pautiina commented 5 years ago

Checked several recent commits - this is not fixed yet. Tested on this commit bb4b06c9a6e1f117095f9fc044d043628ae11b34

howardjones commented 5 years ago

Interesting. It works for me on a fresh Vagrant box... did you do a hard-refresh in the browser after updating? This new javascript-based stuff makes it easier to accidentally not see updates.

pautiina commented 5 years ago

No, I don't make hard reset. I try do it tomorrov

netniV commented 5 years ago

@howardjones you may want to utilise a feature we did of adding a hash to query parameters part of the URI so that browsers realise there is a change made. If the hash is based on file contents, it would ensure it only changes when the file is changed.

howardjones commented 5 years ago

I will look into something like that. This is actually what the ETag feature in Apache does for you (and also the default build system for npm - I'm actually taking out a hash from the filename to avoid having to change the code all the time :-) )

netniV commented 5 years ago

We just do it on the URI : https://cacti/include/layout.js?hash= . Not looked at the ETag feature.

pautiina commented 5 years ago

I have updated composer and bower and clear browser cache. Now it's working. We can close this issue.

howardjones commented 5 years ago

Cool. I'll also look into the various options for hashes to try and remove that requirement.

(it's only the browser you need to do anything with usually - on Chrome, it's right click on the Reload button)

netniV commented 5 years ago

I think on Chrome, you can hit Ctrl-Refresh, though sometimes I found pressing F12 to invoke the developer tools first works better since Chrome seems to realise you may need fresher copies when you hit refresh.

pautiina commented 5 years ago

I'm use ctrl+F5, it's working for many browser