KenDB3 / syncWXremix

Weather application/external program (door) written in javascript for Synchronet BBS
ISC License
9 stars 7 forks source link

Non-geolocation? #1

Open k5jat opened 8 years ago

k5jat commented 8 years ago

Is there another way to pull the info? My VPS isn't located in the area and I'd be hard-pressed to find an IP that is.

Kirkman commented 8 years ago

According to the weather underground API docs, you can query by U.S. city and state, or by ZIP code instead of IP address.

So, as a quick fix you could change the code to something like this:

    var current = req.Get("http://api.wunderground.com/api/" + wungrndAPIkey + "/conditions/forecast/astronomy/alerts/q/YOURZIPCODEHERE.json");

or

    var current = req.Get("http://api.wunderground.com/api/" + wungrndAPIkey + "/conditions/forecast/astronomy/alerts/q/STATEABBREVIATION/CITYNAME.json");

Longer-term, Ken might want to consider somehow incorporating SBBS's system.location property into the query as a fallback if IP-based queries fail.

KenDB3 commented 8 years ago

I am definitely open to that. I've been thinking of other ways to fall back to a location. I think my concern with system.location is that anyone can set that to something non-standard. For example, I don't use my City in that setting for my BBS, it just comes up as "Rhode Island". I made a few changes based on suggestions, one of which (from digital man) is configuring options in ctrl/modopts.ini. Maybe setting up variables for something like 'fallback_state' and 'fallback_city' would be a good way to catch this sort of problem.

KenDB3 commented 8 years ago

I think I have a fix for you, k5jat. Make sure to check out the sysop.txt file for setup instructions. You should be able to choose a default fallback location based on either US Postal ZIP Code or (if you are not in the US) by ICAO or IATA Airport Code (I recommend ICAO). Let me know how it goes so I can close this.

k5jat commented 8 years ago

Ohhh ok. I see it uses the geo-location of who logged in and not the server. Sadly, my IP seems to be in a completely different geo-location spot than I am, so it's not local weather I'm getting. This is common with DSL and cell "hot spot" devices.

I would propose this:

Allow the sysop to set a location and that's what's shown as default. Prompt the user for either the full alert and/or to enter their location (using the codes above) for local weather.

Of course keep the current geo-location defaults for the lazy sysop as well. ;) lol

KenDB3 commented 8 years ago

The default locale to display is something that could work. Basically, you are thinking of a permanent override to what user's see at first? Like, they always get the weather of the BBS Location (by IP or ZIP or Airport)?

The prompt for input is a good idea too, and I have been thinking about it for a while, but... 1) I need to read up on how to do that stuff (this actually is my first rodeo, lol). I'm learning as I go. I got into this for fun and because I really wanted an app to this on my own board, and then I got some interest from other sysops so I thought it would be a good idea to release it. And... 2) I need to think about how best to approach this. Digital Man made a good suggestion that the prompt for input should come up only if GeoIP and the user's own configured ZIP code (in their user profile) fails. But it might be better if this is configurable - aka prompt always vs. prompt on failure.

Again, lots to learn to get to that stage.

Kirkman commented 8 years ago

Maybe the best approach is to ask the user on their very first login what they want to see. So the user would go thru a simple flowchart like this:

Do you want to see the weather forecast for your city, or for the BBS's city? -> Your city Is your ZIP code 55555? (show the user the zip code stored in their BBS profile) -> No Type in your ZIP code -> 75757

Then the BBS would store the user's choices into the JSON DB, and recall them every time he/she used the app.

tracker1 commented 8 years ago

+1 for asking/storing the zip code/location... having an option to update it would be a good idea too.