display flag of current local IP address

Any feedback, suggestion, bug reports, problems....
Locked
ericjung
Posts: 5
Joined: Wed Mar 06, 2013 3:31 pm

display flag of current local IP address

Post by ericjung » Wed Mar 06, 2013 3:35 pm

Hi, is it possible to display the flag of the country for *my* IP address rather than the flag of the country whose domain I'm visiting?

thanks,
eric

Advertisements

 

User avatar
DaveG
Flagfox Developer
Posts: 722
Joined: Wed Oct 03, 2007 9:06 pm
Location: Philadelphia, USA

Re: display flag of current local IP address

Post by DaveG » Wed Mar 06, 2013 7:16 pm

You can right-click on the flag and select "My Info" to do a Geotool lookup of yourself. You can set a keyboard or mouse shortcut for this in the Flagfox options if you wish.

There is no built-in way to have Flagfox show an additional flag for yourself in the main UI, though. Geotool will give you a flag and a bit more info. If you really wanted a flag for yourself somewhere, I guess you could pin a self lookup on Geotool to an app-tab as the flag will also be its favicon, though it doesn't auto refresh. You could remedy this with the ReloadEvery extension. So, I guess a Geotool app-tab + ReloadEvery would work to do what you want here. Note that Geotool would be doing this lookup so it wouldn't be a local lookup like Flagfox does for sites, though this would make sure to get the correct IP address exposed on the Internet if you're using a proxy.

ericjung
Posts: 5
Joined: Wed Mar 06, 2013 3:31 pm

Re: display flag of current local IP address

Post by ericjung » Wed Mar 06, 2013 9:18 pm

Thanks for the suggestion, Dave. so it's doable, but not quite user-friendly.

With that in mind, I'd like to add this to the FoxyProxy addon. Would you be willing to let us use your flag imagemap? I see you release FlagFox under a custom license. I'm assuming this imagemap is something you created?

thanks,
eric
http://getfoxyproxy.org

User avatar
DaveG
Flagfox Developer
Posts: 722
Joined: Wed Oct 03, 2007 9:06 pm
Location: Philadelphia, USA

Re: display flag of current local IP address

Post by DaveG » Wed Mar 06, 2013 10:29 pm

ericjung wrote:I'm assuming this imagemap is something you created?
I've made some updates and substitutions but the original image sets themselves are not of my own creation. Both are credited in the Flagfox about dialog and both are free to use.

The primary set is from flags.blogpotato.de and is Creative Commons (attribution-sharealike). The secondary set is from famfamfam.com (as are our other icons) and they are free to use with no attribution needed (with Creative Commons 2.5 (attribution) for the silk general icons set).

I really should have kept a list of what modifications I have done to these sets... but I didn't. Mine are mixed in there, and they're in some cases based on flag images from Wikipedia released into the public domain. The files themselves have also all been recompressed to reduce file sizes, and the famfamfam flag set (but not other icons) have been rescaled up a little bit to match the needed dimensions. One of the creators of the famfamfam set is also our Italian translator and has provided us with some updates in the past, if I remember correctly.
ericjung wrote:Would you be willing to let us use your flag imagemap? I see you release FlagFox under a custom license.
You can use these flag icons, as well as any future updates I make to them, in other works if you wish. An attribution buried away in an about dialog/page would be more than enough.

The next time I update these sets I think I'll sit down and properly re-license the combined set of flag icons (original Creative commons + public domain + my modifications) to make this less of a mess, probably under the same Creative Commons license as the flags.blogpotato.de set. It should be easier for people to know they can reuse my derivative work, because neither of the original sets receive updates so they're both out of date by themselves.

I've also been considering replacing them all with a new set that I was working on based entirely on Wikipedia flags, but I haven't worked on that recently.

ericjung
Posts: 5
Joined: Wed Mar 06, 2013 3:31 pm

Re: display flag of current local IP address

Post by ericjung » Wed Mar 06, 2013 10:39 pm

You can use these flag icons, as well as any future updates I make to them, in other works if you wish. An attribution buried away in an about dialog/page would be more than enough.
Great! Thank you! We add credits typically to http://getfoxyproxy.org/credits.html. There is a link to that in the About dialog.

We also use famfamfam silk icons for a bunch of our icons.

Eric

ericjung
Posts: 5
Joined: Wed Mar 06, 2013 3:31 pm

Re: display flag of current local IP address

Post by ericjung » Wed Mar 06, 2013 10:43 pm

While trying to find the image files in the source, I noticed ipdb/ip4.db and ip6.db. Are those the MaxMind geoIP databases?

Why did you choose to package the geoIP databases internally rather than use something like this server-side generated JSON?

I'm asking because perhaps you can persuade us to package the DB internally rather than making a server call. Note that we wouldn't actually make very many server calls, unlike FlagFox.

thanks,
eric

User avatar
DaveG
Flagfox Developer
Posts: 722
Joined: Wed Oct 03, 2007 9:06 pm
Location: Philadelphia, USA

Re: display flag of current local IP address

Post by DaveG » Wed Mar 06, 2013 11:56 pm

ericjung wrote:We also use famfamfam silk icons for a bunch of our icons.
They are absolutely everywhere these days. :)
ericjung wrote:While trying to find the image files in the source, I noticed ipdb/ip4.db and ip6.db. Are those the MaxMind geoIP databases?
They are the Maxmind IP country free databases compiled into a custom format I designed for Flagfox. It's more compact than Maxmind's binary formats.
ericjung wrote:Why did you choose to package the geoIP databases internally rather than use something like this server-side generated JSON?
Simplicity, speed, and privacy. If Flagfox were to ask a server for the info on every single page visited, that server would know your entire browsing history. There are a few other geolocation tools out there that do this and they're basically spyware. Doing everything locally is also simpler to set up and faster to do. Also, when Flagfox was first devised I don't think JSON really existed yet and when I took over the original abandoned Flagfox extension (which was getting IP updates from Richard at the time) I was just porting from a horribly performing JS array lookup.
ericjung wrote:I'm asking because perhaps you can persuade us to package the DB internally rather than making a server call. Note that we wouldn't actually make very many server calls, unlike FlagFox.
Well, if you can get the actual IP reliably then that might be an option. Near as I can tell, there's not really a good way to get the external IP if you're behind a proxy without using a separate server. That being said, if the proxy was set up entirely by FoxyProxy, then it could know for sure without an external server, and this might work. There are some big caveats though, namely the need for updates to avoid getting stale, the added file size (around 1 MiB uncompressed, half that compressed), and the need to extract the XPI to read the IPDBs (a current design limitation).

Personally, I think the simplest route would be to ask the user and just do a server call, but maybe also have support for asking Flagfox directly if it's installed. Asking Flagfox would be as simple as:

Code: Select all

// Get the country code (also the icon file name)
Components.utils.import("resource://flagfox/ipdb.jsm");
var countryCode = ipdb.lookupIP(ip);

// Get the localized country name for showing in the tooltip
Components.utils.import("resource://flagfox/flagfox.jsm");
var countryName = Flagfox.countrynames.GetStringFromName(countryCode);
I think you'd just need to encapsulate those imports in a try/catch block to know whether or not Flagfox is installed and loaded. Just don't do the name lookup until you need to show it as I've written it to be automatically loading on first use, so the file never actually gets fully loaded until a user actually sees a tooltip for the first time. Just a sneaky little startup optimization. ;)

Locked