lubien / sorteios

Prize draw system built using Phoenix (LiveView + Presence + PubSub)
https://sorteios.lubien.dev
42 stars 15 forks source link

Show ping #2

Open lubien opened 2 years ago

lubien commented 2 years ago

https://livebeats.fly.dev/ has a way to show your Fly region and ping. This would be a nice addon

rsolovjov commented 1 year ago

Can I do this?

I understand how to calculate ping for LiveView. Just use phx-hook like that: https://github.com/fly-apps/live_beats/blob/6233b438c23c74c21543a5a122816f5dc2f71974/assets/js/app.js#L185-L203

But I'm not sure for the geographic location. I am going to use geoip library: https://github.com/navinpeiris/geoip with free data provider - freegeoip (https://github.com/fiorix/freegeoip).

And the last one is country flags. -> From clone of this repository: https://github.com/hampusborgos/country-flags

It's ok?

lubien commented 1 year ago

But I'm not sure for the geographic location. I am going to use geoip library:

LiveBeats used an easy trick: they get the env variable FLY_REGION and show a flag for it. It's not perfect but works!