Moe-Counter/README.md
2024-11-21 22:17:00 +08:00

343 lines
9.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# *Moe Counter!*
多种风格可选的萌萌计数器
<p align="center">
<a href="https://count.getloli.com" target="_blank">
<img alt="Moe Counter!" src="https://count.getloli.com/@Moe-counter.github?name=Moe-counter.github&theme=booru-lewd&padding=7&offset=0&align=top&scale=1&pixelated=1&darkmode=auto">
</a>
</p>
<p align="center">
<a href="https://hellogithub.com/repository/ed741b376efe46789ce9bb140ac19a52" target="_blank">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=ed741b376efe46789ce9bb140ac19a52&claim_uid=NyJh2Vejq3984f5&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=ed741b376efe46789ce9bb140ac19a52&claim_uid=NyJh2Vejq3984f5&theme=neutral" />
<img src="https://api.hellogithub.com/v1/widgets/recommend.svg?rid=ed741b376efe46789ce9bb140ac19a52&claim_uid=NyJh2Vejq3984f5&theme=neutral" alt="FeaturedHelloGitHub" style="width: 250px; height: 54px;" width="250" height="54" />
</picture>
</a>
</p>
<details>
<summary><h2>More theme</h2></summary>
### *[Contribute themes is welcome!](https://github.com/journey-ad/Moe-Counter/issues/new?assignees=&labels=theme&projects=&template=contribute-theme.yml&title=%5BTheme%5D%3A+)*
##### 3d-num
![3d-num](https://count.getloli.com/@demo?theme=3d-num)
##### ai-1
![ai-1](https://count.getloli.com/@demo?theme=ai-1)
##### asoul
![asoul](https://count.getloli.com/@demo?theme=asoul)
##### booru-ffsr
![booru-ffsr](https://count.getloli.com/@demo?theme=booru-ffsr)
##### booru-helltaker
![booru-helltaker](https://count.getloli.com/@demo?theme=booru-helltaker)
##### booru-huggboo
![booru-huggboo](https://count.getloli.com/@demo?theme=booru-huggboo)
##### booru-jaypee
![booru-jaypee](https://count.getloli.com/@demo?theme=booru-jaypee)
##### booru-koe
![booru-koe](https://count.getloli.com/@demo?theme=booru-koe)
##### booru-lewd
![booru-lewd](https://count.getloli.com/@demo?theme=booru-lewd)
##### booru-lisu
![booru-lisu](https://count.getloli.com/@demo?theme=booru-lisu)
##### booru-mjg
![booru-mjg](https://count.getloli.com/@demo?theme=booru-mjg)
##### booru-mof
![booru-mof](https://count.getloli.com/@demo?theme=booru-mof)
##### booru-nandroid
![booru-nandroid](https://count.getloli.com/@demo?theme=booru-nandroid)
##### booru-qualityhentais
![booru-qualityhentais](https://count.getloli.com/@demo?theme=booru-qualityhentais)
##### booru-r6gdrawfriends
![booru-r6gdrawfriends](https://count.getloli.com/@demo?theme=booru-r6gdrawfriends)
##### booru-rfck
![booru-rfck](https://count.getloli.com/@demo?theme=booru-rfck)
##### booru-smtg
![booru-smtg](https://count.getloli.com/@demo?theme=booru-smtg)
##### booru-snyde
![booru-snyde](https://count.getloli.com/@demo?theme=booru-snyde)
##### booru-the-collection
![booru-the-collection](https://count.getloli.com/@demo?theme=booru-the-collection)
##### booru-touhoulat
![booru-touhoulat](https://count.getloli.com/@demo?theme=booru-touhoulat)
##### booru-townofgravityfalls
![booru-townofgravityfalls](https://count.getloli.com/@demo?theme=booru-townofgravityfalls)
##### booru-twifanartsfw
![booru-twifanartsfw](https://count.getloli.com/@demo?theme=booru-twifanartsfw)
##### booru-ve
![booru-ve](https://count.getloli.com/@demo?theme=booru-ve)
##### booru-vivi
![booru-vivi](https://count.getloli.com/@demo?theme=booru-vivi)
##### booru-vp
![booru-vp](https://count.getloli.com/@demo?theme=booru-vp)
##### booru-yuyuyui
![booru-yuyuyui](https://count.getloli.com/@demo?theme=booru-yuyuyui)
##### capoo-1
![capoo-1](https://count.getloli.com/@demo?theme=capoo-1)
##### capoo-2
![capoo-2](https://count.getloli.com/@demo?theme=capoo-2)
##### e621
![e621](https://count.getloli.com/@demo?theme=e621)
##### food
![food](https://count.getloli.com/@demo?theme=food)
##### gelbooru
![gelbooru](https://count.getloli.com/@demo?theme=gelbooru)
##### green
![green](https://count.getloli.com/@demo?theme=green)
##### kasuterura-1
![kasuterura-1](https://count.getloli.com/@demo?theme=kasuterura-1)
##### kasuterura-2
![kasuterura-2](https://count.getloli.com/@demo?theme=kasuterura-2)
##### kasuterura-3
![kasuterura-3](https://count.getloli.com/@demo?theme=kasuterura-3)
##### kasuterura-4
![kasuterura-4](https://count.getloli.com/@demo?theme=kasuterura-4)
##### kyun
![kyun](https://count.getloli.com/@demo?theme=kyun)
##### love-and-deepspace
![love-and-deepspace](https://count.getloli.com/@demo?theme=love-and-deepspace)
##### minecraft
![minecraft](https://count.getloli.com/@demo?theme=minecraft)
##### moebooru
![moebooru](https://count.getloli.com/@demo?theme=moebooru)
##### morden-num
![morden-num](https://count.getloli.com/@demo?theme=morden-num)
##### nixietube-1
![nixietube-1](https://count.getloli.com/@demo?theme=nixietube-1)
##### nixietube-2
![nixietube-2](https://count.getloli.com/@demo?theme=nixietube-2)
##### normal-1
![normal-1](https://count.getloli.com/@demo?theme=normal-1)
##### normal-2
![normal-2](https://count.getloli.com/@demo?theme=normal-2)
##### original-new
![original-new](https://count.getloli.com/@demo?theme=original-new)
##### original-old
![original-old](https://count.getloli.com/@demo?theme=original-old)
##### rule34
![rule34](https://count.getloli.com/@demo?theme=rule34)
##### shimmie2
![shimmie2](https://count.getloli.com/@demo?theme=shimmie2)
##### sketch-1
![sketch-1](https://count.getloli.com/@demo?theme=sketch-1)
##### sketch-2
![sketch-2](https://count.getloli.com/@demo?theme=sketch-2)
</details>
## Demo
[https://count.getloli.com](https://count.getloli.com)
## How to use
For information on counter usage and configuration, refer to the [demo website](https://count.getloli.com).
## Usage
### Install
#### Run on Glitch
- Open [Glitch project](https://glitch.com/~moe-counter-api)
- Just hit the **Remix your own** button
- That's it!
#### Deploying on your own server
```shell
$ git clone https://github.com/journey-ad/Moe-Counter.git
$ cd Moe-Counter
$ pnpm install
$ pnpm run start
```
### Configuration
Set `.env` file to specify the environment variables. *[.env.example](./.env.example)*
```dosini
# Specify your website URL
# APP_SITE=https://count.getloli.com
# Application port
APP_PORT=3000
# Database type: either 'sqlite' or 'mongodb'
DB_TYPE=sqlite
# If using MongoDB, provide the connection string
# DB_URL=mongodb://127.0.0.1:27017
# Database write interval in seconds (0 for real-time)
DB_INTERVAL=60
# Log level: either 'debug' | 'info' | 'warn' | 'error' | 'none'
LOG_LEVEL=debug
# Google Analytics `G-Tag` ID
# GA_ID=G-XXXX
```
### Deploy to Render & MongoDB Atlas
Note 1: Visa/Mastercard credit card needed to use two free tier services.
Note 2: Render free tier has a timeout of 15 min. Please use some monitoring program to keep it alive.
1. Register and create a MongoDB Atlas M0 (Free tier) Database
Choose these zones to minimize latency (the left column):
| MongoDB Atlas Location | Render Location |
| :----: | :----: |
| AWS: us-east-1 / Azure: eastus2 | Virginia, USA |
| AWS: us-west-2 | Oregon, USA |
| AWS: ap-southeast-1 / GCP: asia-southeast1 | Singapore |
| AWS: eu-central-1 | Frankfurt, Germany |
After creating the database, you will be redirected to security instruction page.
Please choose to allow all ips. And take a note of created user/pass.
After instruction process, go to Connect--Drivers, copy the connection string and replace pass with yours.
2. Register and create the Render Service
Choose New--"Web service"
Source code: Choose "Public Git Repository", and paste this repo's url `https://github.com/journey-ad/Moe-Counter`, then click Connect
Choose your own name
Language: Choose Node
Branch: default (Master)
Region: Choose the according location on the right column of the table above
Instance type: Choose Free
Environments: Just copy your configuration set before, and just paste into it. It will automatically parse the values.
Finally click Deploy.
(Optional) set your own custom domain. (Don't forget to change environment value as well)
(Optional) set free monitoring using any monitor system. (Most services offer free monitoring per 5 minutes, which is enough.)
## Credits
* [Glitch](https://glitch.com/)
* [A-SOUL_Official](https://space.bilibili.com/703007996)
* [moebooru](https://github.com/moebooru/moebooru)
* gelbooru.com NSFW
* [Icons8](https://icons8.com/icon/80355/star)
* *And all booru site...*
## License
[MIT License](./LICENSE), excluding all themes
---
<a href="https://star-history.com/?repos=journey-ad/Moe-Counter&type=Date#journey-ad/Moe-Counter&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=journey-ad/Moe-Counter&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=journey-ad/Moe-Counter&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=journey-ad/Moe-Counter&type=Date" />
</picture>
</a>