pujux / badge-it

An API serving useful badges for your GitHub Profile README 🚀🎉 Formerly known as git-badges.
http://pufler.dev/badge-it/
BSD 3-Clause "New" or "Revised" License
218 stars 24 forks source link

Page refresh counter #1

Closed jcubic closed 4 years ago

jcubic commented 4 years ago

It would be more useful to have visitors counter not page refresh counter. So save IP adres and if it's unique per instance then increase the counter.

pujux commented 4 years ago

I totally won't be saving IP addresses on my server. I thought about checking if the source IP is from one of GitHubs servers as they are the ones actually requesting the badge if you see it in GitHub READMEs, but I don't know if I will yet.

jcubic commented 4 years ago

You don't need to save IP address just the hash of the IP. like md5 or CRC if you need something shorter.

fabiocaccamo commented 4 years ago

I agree with @jcubic, just store the hash. A page refresh counter is not useful at all, this issue should be re-opened.

pujux commented 4 years ago

I agree with @jcubic, just store the hash. A page refresh counter is not useful at all, this issue should be re-opened.

well, it's a visit counter, I whitelisted the github cdn crawler ip subnet so people can't bot visits and the cache expiration is set to 10 minutes so you shouldn't be able to increase the counter by refreshing continously

jcubic commented 4 years ago

I think now it's ok, The original problem what the I was able to open https://badges.pufler.dev/visits/jcubic/jquery.terminal in browser and refresh I refreshed it 3 times this badge was never added anywere.

One note someone may publish the package to npm and npm don't use cache. I don't think it should be limited to GitHub repositories. Maybe there should be option to toggle: git only or IP limit.