https://github.com/windvalley/traffic-clones-api
An apiserver for https://shields.io/endpoint. Get the total number of clones and the total number of unique clones of your github repo.
https://github.com/windvalley/traffic-clones-api
badge clones-badge shields shieldsio-endpoint
Last synced: 7 months ago
JSON representation
An apiserver for https://shields.io/endpoint. Get the total number of clones and the total number of unique clones of your github repo.
- Host: GitHub
- URL: https://github.com/windvalley/traffic-clones-api
- Owner: windvalley
- License: mit
- Created: 2021-12-15T07:33:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-19T08:52:24.000Z (almost 4 years ago)
- Last Synced: 2025-01-14T12:50:20.030Z (9 months ago)
- Topics: badge, clones-badge, shields, shieldsio-endpoint
- Language: Go
- Homepage:
- Size: 39.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# traffic-clones-api
[](https://github.com/windvalley/traffic-clones-api)
[](https://github.com/windvalley/traffic-clones-api)An apiserver for .
Get the total number of clones and the total number of unique clones of your github repo.## Description
Provides:
- traffic clones total count api:
`/v1/github/traffic/clones/total?git_user=&git_repo=&type=count&label=clones-total`
- traffic clones total uniques api:
`/v1/github/traffic/clones/total?git_user=&git_repo=&type=uniques&label=clones-uniques`
## Deployment Server
Login your cloud server(like aws EC2) first.
#### 1. Generate a github personal access token
Access this page ,
and press button `Generate new token` to generate your access token.For example, the generated access token is `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`.
#### 2. Deploy backend api server `traffic-clones-api`
```sh
$ git clone --depth 1 https://github.com/windvalley/traffic-clones-api$ cd traffic-clones-api
$ go build
# it will listening on :9000 port
$ nohup ./traffic-clones-api -t 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 &
```#### 3. Deploy https proxy server by [Caddy](https://github.com/caddyserver/caddy)
Assume that your domain name `api.sre.im` has been resolved to your cloud server IP.
```sh
$ wget https://github.com/caddyserver/caddy/releases/download/v2.4.6/caddy_2.4.6_linux_amd64.tar.gz$ tar zxf caddy_2.4.6_linux_amd64.tar.gz
$ mv ./caddy /usr/local/bin/
$ mkdir api.sre.im
$ cd api.sre.im
$ cat > Caddyfile < in browser explorer
#### 2. Generate the final badge url
Add the url `https://api.sre.im/v1/github/traffic/clones/total?git_user=your-github-username&git_repo=your-github-repo&type=count-or-uniques&label=clones-xxx` in `url` blank.
Then click `Copy Badge URL` to copy it to system clipboard.
Finally, add your badge link `` to the `README.md` of your github repo.
The badge will be shown as:
[](https://github.com/windvalley/traffic-clones-api)
## License
This project is under the MIT License.
See the [LICENSE](LICENSE) file for the full license text.