2022-09-02 20:56:16 +08:00
|
|
|
# py 版访问次数计数器
|
|
|
|
|
|
|
|
|
|
> 翻自 [journey-ad](https://github.com/journey-ad/Moe-counter) 的计数器
|
|
|
|
|
|
|
|
|
|
# 预览
|
|
|
|
|
|
2022-09-11 11:40:59 +08:00
|
|
|
<img src="https://counter-main.run.goorm.io/test" alt="preview">
|
2022-09-02 20:56:16 +08:00
|
|
|
|
|
|
|
|
# 新特性
|
|
|
|
|
|
|
|
|
|
* 使用了异步Web框架`FastAPI`来提高效率 ***注:数据库部分使用了同步***
|
|
|
|
|
* 可以自定义显示图片的数量(长度)
|
|
|
|
|
* 支持API接口以便自行开发
|
2022-09-18 09:18:11 +08:00
|
|
|
* 支持MySQL数据库链接 ***程序内有默认的MySQL数据库请不要随意注水***
|
|
|
|
|
> sql 文件下载地址 https://pac.rtst.tech/static_file_hosting/counter/sql/
|
2022-09-02 20:56:16 +08:00
|
|
|
|
|
|
|
|
# 失去的特性
|
|
|
|
|
|
2022-09-18 09:18:11 +08:00
|
|
|
* 暂未支持`MongoDB`
|
2022-09-02 20:56:16 +08:00
|
|
|
|
|
|
|
|
# 安装&运行
|
2022-09-11 10:29:20 +08:00
|
|
|
|
2022-09-02 20:56:16 +08:00
|
|
|
```bash
|
|
|
|
|
$ pip3 install -r requirements.txt
|
|
|
|
|
$ uvicorn src:create_app --factory or
|
2022-09-18 09:18:11 +08:00
|
|
|
$ sh run.sh or
|
2022-09-02 20:56:16 +08:00
|
|
|
$ python3 main.py # 两条命令等价
|
|
|
|
|
```
|
|
|
|
|
|
2022-09-03 09:12:29 +08:00
|
|
|
# 使用
|
2022-09-11 10:29:20 +08:00
|
|
|
|
2022-09-18 09:18:11 +08:00
|
|
|
* 访问`http://127.0.0.1:8000/<any name you want>`
|
|
|
|
|
> 示例: http://127.0.0.1:8000/_redirect?length=10&theme=moebooru
|
2022-09-11 11:34:57 +08:00
|
|
|
## 参数
|
|
|
|
|
* `length`
|
2022-09-18 09:18:11 +08:00
|
|
|
> length: 1 ≤ x ≤ 10
|
2022-09-11 11:34:57 +08:00
|
|
|
* `theme`
|
2022-09-18 09:18:11 +08:00
|
|
|
> theme: `blacked` `lewd` `lisu` `moebooru`
|
2022-09-11 11:34:57 +08:00
|
|
|
|
2022-09-02 20:56:16 +08:00
|
|
|
# 单元测试
|
2022-09-11 10:29:20 +08:00
|
|
|
|
2022-09-02 20:56:16 +08:00
|
|
|
* 没有单元测试(没写)
|
|
|
|
|
|
|
|
|
|
# 开源
|
|
|
|
|
|
|
|
|
|
- 本项目以[Apache-2.0](./LICENSE)许可开源, 即:
|
|
|
|
|
- 你可以直接使用该项目提供的功能, 无需任何授权
|
|
|
|
|
- 你可以在**注明来源版权信息**的情况下对源代码进行任意分发和修改以及衍生
|