ecleese / plexWatchWeb

A web front-end for plexWatch.
254 stars 41 forks source link

User detail IP location changes #146

Closed hrrrsn closed 9 years ago

hrrrsn commented 9 years ago

Changes the database used for IP geolocation to ipinfo.io. Also shows ISP details as well as country flags in user detail view. screenshot-2015-06-26-20 25 42

hrrrsn commented 9 years ago

Flag images sourced from http://www.famfamfam.com/lab/icons/flags/

"These flag icons are available for free use for any purpose with no requirement for attribution."

Arcanemagus commented 9 years ago

There are a few issues with this:

ipinfo.io is limited to 1000 requests a day. A few reloads of the page could easily exhaust this for somebody using plexWatch that has many different addresses to look up. As far as I can see this outright prevents using this service unfortunately. It would be nice though as it is 3x faster on average compared to the current one :wink:.

This was done against the master branch, all current work is in the dev branch (The current state of this would have made this a lot easier :stuck_out_tongue:).

You never check for errors from your function calls, so you don't really have a way to know if the lookup failed. Also there isn't much point in leaving the old code in but commented out, that's what revision history is for.


At one point I had looked into switching to https://freegeoip.net/, but was running into issues with it occasionally timing out and other times being 5x slower than the current... on average though it's 1.5x faster. You can check out some benchmarking I just did here: https://docs.google.com/spreadsheets/d/11Nad_EVA38R5n1Af4bXg3DH5xoyjpRk-Ha0YUGH856U/edit?usp=sharing


If you want to take it on, I was at one point thinking of putting a cache of looked up IP addresses in the settings, or in a different file. If you want to write up something that caches (valid) responses, and limits requests properly that would be great.