Code Monkey home page Code Monkey logo

antonkomarev / github-profile-views-counter Goto Github PK

View Code? Open in Web Editor NEW
3.8K 37.0 349.0 128 KB

It counts how many times your GitHub profile has been viewed. Free cloud micro-service.

Home Page: https://komarev.com/sources/github-profile-views-counter

License: MIT License

PHP 91.67% Dockerfile 3.60% Makefile 4.73%
github github-profile github-counter counter visitor-counter views-count view-counter gh analytics github-profile-counter

github-profile-views-counter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

github-profile-views-counter's Issues

[Feature suggestion] Add new style for social: `?style=social`

You currently have these styles, and they are very useful:

style demo
flat
flat-square
plastic
for-the-badge

However, shields.io has one other style available: social. See more info here.

For example:

style demo
flat
flat-square
plastic
for-the-badge
social

But when I try to use this for Profile Views:
![](https://komarev.com/ghpvc/?username=chrimaho&style=social)

Can you please also add this ?style=social function to your repo?

Thank you!

Error fetching resource

Is the link down?
Image not showing up?

<img src="https://komarev.com/ghpvc/?username=impratik7&label=Profile%20views&color=0e75b6&style=flat" alt="impratik7" />

profile views

for every refresh from same machine, i have seen profile views getting incremented,
not a big issue at all,
its maybe work as expected,
just want, you to know!!!
(we can check ip address and then only increment)

Thanks,
Ashish

Race condition vulnerability causes counter reset

A user's counter can be reset by spamming requests, this happens due to a race condition while truncating and writing to a file. The following NodeJS script can be used to reset a user's counter:

// Send requestsPerBulk requests in parallel (let's call that a bulk)
// Wait till they are done
// Repeat till a total of bulks * requestsPerBulk requests

// After each bulk, output the number of succeeded requests and the number of failed requests
(async () => {
  const url = process.argv[2];
  const bulks = parseInt(process.argv[3]);
  const requestsPerBulk = parseInt(process.argv[4]);
  const headers = new Headers();
  headers.append('User-Agent', 'github-camo');
  for (let i = 0; i < bulks; ++i) {
    const promises = [];
    console.time('bulk');
    for (let j = 0; j < requestsPerBulk; ++j) {
      promises.push(fetch(url, { headers }));
    }
    const results = await Promise.all(promises);
    const failed = results.filter((res) => res.status >= 400).length;
    console.log(`Bulk ${i}:- failed: ${failed}, succeeded: ${requestsPerBulk - failed}`);
    console.timeEnd('bulk');
    await new Promise((r) => setTimeout(r, 500));
  }
})();

Run it as

node script_name.js ghpvc_url 50 20

and observe the counter, it will reset at a certain point in time.

Here is an explanation of the race condition that happens according to my understanding:
Requests need to do the following:

  • Read file, increment number
  • Truncate file
  • Put incremented number

The following race can happen between two requests (A and B):

  • A: read file, increment number
  • A: truncate file
  • B: read file, increment number (oops read empty file, number is zero, incremented number is one!)
  • A: put incremented number
  • B: truncate file
  • B: put incremented number (oops put one!)

This can be fixed by using a lock on the views-count file or by migrating to using a database management system that automatically handles concurrency issues.

[Feature suggestion] Timeline counter view

It would be nice if their was a time line (like contributions timeline on Github repo) where a use could see a timeline of the number of visitors on a GitHub profile such as per month or per year.

This could be a better indication of profile traffic vs total view count all time.

If there is another free service let know otherwise :)

Adjust the font size

Thank you for this repo! Simple and professional. I am making my img tag larger to fit better with my readme, but I was wondering if it is possible to implement a font size feature.

Thanks again!

[Enhancement]Counts a person's own view as well.

Hi Anton,

You have made a great project but I think with one enhancement it would be perfect. The counter considers the user's own count as well. Would it be possible to clone this project to another repo and make a slight enhancement to it? Or if you can incorporate the enhancement in the same repo it would be very helpful.

I am a novice in programming so apologizing beforehand if this issue is laughable ๐Ÿก

Format number?

What do you think about the format number in the views counter?
Schermata 2020-07-22 alle 17 34 04

2938 => 2,938?

Condensed Counter View?

Noticed that the counter "shrunk" all of a sudden. I was at 2k views, nothing crazy big for the container to suddenly overflow. Attached screenshot below

Screenshot 2023-10-10 at 2 40 48 PM

Website down?

Badge doesn't show up for me and the website is not available aswell

Badge displays weirdly on Edge

When viewing the Profile Views badge in Edge is there a odd gap between the "e" and "w" of "views". (See image)

I doubt that it's a browser thing,

image

[Feature suggestion] Ability to change label color

As far as I know there is no way to change the label color (left part).

I think it might be a great feature to be able to add &label_color=FFFFFF to further customize the counter.
FFFFFF: the value of the color in hex.

[BUG] The counter resets?

1 - A week ago I had the counter around 2000-2250 views, then for some reason it appeared with only 2, I think this started when I changed the style to for-the-badge

2 - I have also noticed that when you refresh the page with the counter it increases x2, that is, if you have 2 views, and you update you will then have 4, then 6, and so on...
dung3

Adding a way for people to reset their own badge

Would it be possible to add a way for people to reset their badge? Authentication could be done using OAuth2 to make sure people only can reset their own badges.

This would be useful for example if you edit your readme a lot, and go back and fourth between the editor and preview tab. Each time you then go to the preview tab it increases the counter. That's why my counter is approaching 100, even though im likely only at like 5 (10 if im lucky)

Visitors are not unique

image
After refresh
image
Adding a session style system would be great! I have worked on it, but since i have no clue which file is the one every user goes too i added session_start to every file ! Please tell me if some of the files don't require this , and thanks to you and the great PHP community!
The best of luck

view count reset to zero

A few days ago, the view count was still 8k, but today I found that it has been reset, and I have not changed any settings and styles

500 SERVER ERROR

When attempting to access the page of https://yhype.me/, I frequently encounter a "500 Server Error." This issue seems to be occurring consistently in these two days.

image

Server error while trying to sign up

Hi,

I'm trying to sign up but get a SERVER ERROR message displayed
image

I'm not sure what to do from there. I tried incognito mode, without browser extension but the same happens.

Thanks in advance

Opt-out of hit count

As a normal visitor, I would like to be given the choice to opt-out from getting hits I made counted

SSL Certificate Invalid/Expired

GitHub no longer displays view counter badges due to a problem with komarev.com's SSL certificate. Chrome throws the NET::ERR_CERT_DATE_INVALID error. Pretty sure the certificate expired.

Free public hosting

Does anybody knows a good stable free public cloud database which can hold this service data? Right now it requires 40GB+.

Typo!

"lightgrey" is not valid but "lightgray" does work.

Please rename the colour, thanks :)

Image Not Showing

https://camo.githubusercontent.com/d623505e1cfd15c17382a974e808708e996776ed7cabc5780ca50600cc5df7c1/68747470733a2f2f6b6f6d617265762e636f6d2f67687076632f3f757365726e616d653d72697a6b797465676172266c6162656c3d72697a6b7974656761722b70726f66696c652b76697369746f72

Is it an error?

when I open the url above it will display a message like this.

Error Fetching Resource

it also doesn't show up on my profile

   <img src="https://komarev.com/ghpvc/?username=rizkytegar&label=rizkytegar+profile+visitor">

Only showing broken image icon

There occurs a problem with the display of the icon

Description

I have been using github-profile-views-counter to count my page views for a long time. Yesterday I discovered that there was an error in the icon display.

Detail

image

The code I use

<p align="center">
  <a href="https://github.com/lim-yoona">
    <img src="https://komarev.com/ghpvc/?username=limyoona&color=blue&style=flat)" />
  </a>
</p>

and using markdown code also has the same effect.

Write console command to re-calculate counter aggregate value

After fix (by @Brikaa) of counter reset because of the race condition (#66) we need to create console command which will re-calculate correct counter values. It should count lines in storage/{username}-views file and store them to storage/{username}-views-count.

Something like:

cat storage/{username}-views | wc -l | tr -d ' ' > storage/{username}-views-count

But we should iterate thru all the usernames in the storage directory. There are many counter files, so ls -la is hanging for a long time.

One more thing to ensure: we need to make -1 from wc -l, because of the empty line at the end of file.

How to ignore own profile views?

Currently, the GitHub profile view counter increases counter by one when a user reloads his GitHub profile page. For more accurate counter it should exclude profile views by the owner of the GitHub repository.

Profile views increment on visiting other links as well

The profile views are incrementing when a person himself/herself visit their own profile. Even apart from that, the profile views are incrementing when you are opening any other link on your account like explore, issues etc. So basically, everytime when you click on your mouse to visit any link on github, the views are incrementing. I think, they should only increment when someone visit the profile only.

Profile viewed zeroed

after the yesterdays issue my view count resetted. is anyone else experienced same issue?

YHYPE Website down?

I've tried visiting https://yhype.me on many devices and it doesn't seem to be online whenever I try. My browser keeps saying the server took too long to respond. Do you have any insight or am I missing anything?

How to set the initial value

As I am migrating from another service, I would appreciate having an initial value set up.
Does it support this feature?
Thanks~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.