danielperna84 / hass-configurator

Configuration UI for Home Assistant
MIT License
306 stars 168 forks source link

Data isn't showing when using a custom domain name in Vivaldi #218

Closed Timmiej93 closed 2 years ago

Timmiej93 commented 2 years ago

Browser: Vivaldi 4.2.2406.52 Installation method: Docker Version: Latest

When using a local domain name (homeassistant.lan i.e.), no data shows up when using Vivaldi. If I click the folder in the top left, a window opens that only shows <- /. When I open this window in HA in Vivaldi through localIP:8123, or in Chrome on either the local IP or the local domain name, data does show.

I can also see that listdir?path=/ returns the correct data in Vivaldi, it just doesn't show it.

Summary: Data does show in:

Data doesn't show in:

danielperna84 commented 2 years ago

The last path accessed by the configurator is stored within the browser, and I believe it's tied to the hostname used for access. In this case it may happen that when BASEPATH and / or ENFORCE_BASEPATH are set in a certain way, that no data is returned for security reasons. Please try to temporarily adjust those settings so you're not prohibited from accessing any paths, restart the configurator, browse to the path where you want to be, and then reset the settings to the values from before. Once you're at the correct location data should be visible.

Timmiej93 commented 2 years ago

Both BASEPATH and ENFORCE_BASEPATH were left to the default setting in the example settings.conf file. I tried changing them, but that didn't seem to affect anything.

To be clear: It's not like only the last path or something like that doesn't show, when using Vivaldi on URL homeassistant.lan, no files or folders at all will show up in the configurator. Also, how would that explain that everything works fine in Chrome, but not in Vivaldi?

danielperna84 commented 2 years ago

To be clear: It's not like only the last path or something like that doesn't show, when using Vivaldi on URL homeassistant.lan, no files or folders at all will show up in the configurator. Also, how would that explain that everything works fine in Chrome, but not in Vivaldi?

That's exactly what I mean. Let's say with Chrome you have navigated to /home/homeassistant/.homeassistant, and you have BASEPATH configured accordingly. With this setup you shouldn't be able to navigate somewhere else above that path. Now if you hadn't set the basepath before, accessed the configurator with Vivaldi, then browsed to f. ex. /etc, then enabled the basepath setting afterwards, then it will fail to load because it remembers it was at /etc before, but access to that folder is denied. In this case you would either have to clear the browser data to make Vivaldi forget about that inaccessible path, or you have to loosen the basepath security shortly so Vivaldi can load the old path, navigate to where it actually should be, and then enable the enforcing again.

So in any case, disable ENFORCE_BASEPATH. That should allow Vivaldi to display the content for whatever directory it is trying to access.

Timmiej93 commented 2 years ago

Alright, so I did some troubleshooting, turns out I had multiple errors in my settings file, preventing that from loading properly 🤦‍♂️. Anyway, those are fixed now, the settings file loads as it should (including the BASEPATH and ENFORCE_BASEPATH settings). The same thing still happens though: On the webpage using the IP address, I can see all files in the hass-config folder. On the webpage using the URL, I don't see any files in the hass-config folder. Any suggestions?

danielperna84 commented 2 years ago

No. The only thing you can do is to monitor the dev-tools in Vivaldi to see if there are any Java Script errors or failing requests.

Timmiej93 commented 2 years ago

There are two errors that confuse me. One's related to localStorage. I figured this only had something to do with the editor storing its preferences in localStorage, but since a new localStorage error pops up when I try to navigate, I guess it may have something to do with it:

image

The other is a CORB issue (CORB, not CORS, although they seem to be pretty much the same thing). It mentions that a response from accounts.google.com/blabla...%3Dhttp://192.168.0.253:3128/&ltmpl=drive was blocked. I'm not sure what it's trying to do there though.

In the network tab, there's only 200 and 100 range status codes to be found, no errors at all.

Timmiej93 commented 2 years ago

Finally found out the cause of this issue. As is often the case, it had nothing to do with this software, the browser was causing the issue. The setting that was causing the issue was the Third-Party Cookies setting in Vivaldi. For those that have the same issue, but want to keep blocking third party cookies: Go to your HomeAssistant page, open the iFrame with the configurator. Click the circle with the i in it to the left of the URL. Click Cookies. Go to the Blocked tab. Find the URL OR the IP address of your homeassistant installation, select them, and click Allow. That's all.