Skip to content

Commit

Permalink
chore: Update project description, contributors and license
Browse files Browse the repository at this point in the history
  • Loading branch information
jim60105 committed Oct 23, 2023
1 parent e32bd3c commit 9743e43
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Aveek Saha
Copyright (c) 2022 Aveek Saha and 陳鈞

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
34 changes: 28 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
# View Counter Badge

<img src = "https://view-counter.aveek.workers.dev" alt="View counter badge">
![View counter badge](https://view-counter.jim60105.workers.dev)

Count how many visitors any page gets. A simple solution to add a view counter badge to your readme files or web page.

> [!Note]
> I have rewritten this worker from KV storage to D1 storage.
> The main reason is that the free plan **_limits KV to 1,000 write, delete, list operations per day_**, but **_allows D1 for 100,000 rows written per day_**, and the KV limit is lower than the daily views of my site.
>
> **The following are the differences from upstream**
>
> - Change from KV storage to D1 database.
> - Migrate project from JavaScript to TypeScript.
> - Migrate from Service Workers to ES Modules (D1 can only works with ES Modules).
> - Update CI workflow.
## Usage

The view counter badge is meant to be deployed individually for each profile/user. Click the button and then follow the steps below to deploy your own view counter in no time!

[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/aveek-saha/view-counter-badge)
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/jim60105/worker-view-counter-badge)

### Set your app name

Expand Down Expand Up @@ -98,10 +109,7 @@ Now if you push a new commit into `master` and you'll find your view counter dep
## Add counter to README

```html
<img
src="https://<Your-cloudflare-deployment>.workers.dev"
alt="View counter badge"
/>
<img src="https://<Your-cloudflare-deployment>.workers.dev" alt="View counter badge" />
```

OR
Expand Down Expand Up @@ -133,3 +141,17 @@ Example of a counter with parameters:
```text
https://<Your cloudflare deployment>.workers.dev?style=classic&labelColor=black&color=green
```

## Multiple Deployments

You can deploy multiple view counters under the same GitHub account and Cloudflare account.

1. Create a new git branch.
2. Change the `name` in `wrangler.toml` to deploy on a different subdomain.
3. Change the `CounterName` in `src/index.ts` to any other name you like.
4. Then trigger the GitHub workflow again.

## License

MIT License
Copyright (c) 2022 Aveek Saha and 陳鈞
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"private": true,
"name": "view-counter",
"name": "view-counter-badge",
"version": "1.0.0",
"description": "A template for kick starting a Cloudflare Workers project",
"description": "Count how many visitors any page gets. A simple solution to add a view counter badge to your readme files or web page.",
"scripts": {
"deploy": "wrangler deploy",
"dev": "wrangler dev",
"format": "prettier --check *.{json,js} src/**/*.{js,ts}"
},
"author": "Aveek Saha <[email protected]>",
"contributors": [
"Aveek Saha <[email protected]>",
"陳鈞 <[email protected]>"
],
"license": "MIT",
"devDependencies": {
"@cloudflare/workers-types": "^4.20231010.0",
Expand Down

0 comments on commit 9743e43

Please sign in to comment.