Antergos / web-greeter

A modern, visually appealing greeter for LightDM.
http://antergos.github.io/web-greeter
GNU General Public License v3.0
233 stars 57 forks source link

Domain name can not be resolved #97

Closed FallingSnow closed 7 years ago

FallingSnow commented 7 years ago

I have a call to a geo ip service in order to get the correct timezone in my theme but it runs before internet is available, thus triggering an error and and displaying the theme selector fail safe. Would it be reasonable to put some kind of hook into lightdm-webkit2-greeter or is this better off solved another way?

Also, here's the theme if you would like to test it out: https://github.com/FallingSnow/lightdm-webkit-material/releases/tag/v0.0.1

lots0logs commented 7 years ago

Hmm..by default the greeter will block external http requests. I don't recommend relying on having access to the internet from the theme. Most systems use wifi these days and it wont be connected while the greeter is running anyway. Why exactly do you need to determine the timezone?

FallingSnow commented 7 years ago

I use it for the clock in my theme.

The theme already has a catch if the request fails and the theme in no way depends upon the request. I was also going to check if external requests are enabled in the config. If not that will be made visible to the user.

I could just attempt to make the request every 5 seconds for like the first 60 seconds, but the fail safe is triggered every time it fails.

lots0logs commented 7 years ago

I guess I'm just confused as to why the timezone is needed when you can get the date and time using javascript and that will come from the system's clock.

lots0logs commented 7 years ago

With that being said, the only reliable way to do what you want is to use a recursive function call with setTimeout() that stops calling itself as soon as the connection is detected.

FallingSnow commented 7 years ago

Well, you got me there. Didn't think about getting it from the system clock. I'll be using moment.tz.guess() for the timezone variable for https://github.com/amine7536/react-clockwall from now on.

I suppose getting the timezone from IP would be more useful for people that do a lot of traveling and if it was updated every time the theme is loaded. But as it's setup now, the theme only requires the timezone during its first use and it is preserved from there on.

Thanks for the advice.