diff --git a/README.md b/README.md new file mode 100644 index 0000000..0a5eec6 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# SACN Comment + +使用 fastapi 开发的异步简易、快速、轻量的无后台外置帐号评论系统,UI使用 mdui2。需要配合 SACN Account System 使用。 + +> 这个系统可使用的功能十分少 + +## 如何安装 + +> 请先安装 SACN Account System + +要求:python >= 3.12 + +请先安装 `requirements.txt` 内的依赖 + +然后复制配置文件:`config/config.sample.toml` 到 `config/config.toml` + +编辑配置文件。 + +然后可以直接启动 `main.py`。 + +然后,访问 `你的IP/manager/init?key=配置文件中设置的key` 初始化数据库 + +## 配置文件 + +> 标 `!` 是为必填项 + +```toml +[db] +host = !数据库主机名 +port = 3306 数据库端口号 +user = !数据库用户 +passwd = !数据库密码 +db = !数据库名 +maxsize = 100 最大连接数 +minsize = 10 最小连接数 + +[common] +access_token_expire_minutes = 60 登录过期时长(min) +auth = !你的 SACN Account System 的本地地址,不包括末尾的斜杠 +clean_timeout = 3600 清理过期验证码的时长 +manage_key = !管理key,保留 + +[ui] +title = !网页标题 +link = !你的 SACN Account System 的域名,需要用户访问,包括 http(s),不包括末尾的斜杠 + +``` diff --git a/config/config.sample.toml b/config/config.sample.toml new file mode 100644 index 0000000..a18006c --- /dev/null +++ b/config/config.sample.toml @@ -0,0 +1,18 @@ +[db] +host = "192.168.10.119" +port = 3306 +user = "sacn" +passwd = "your_passwd" +db = "sacn_accout" +maxsize = 10 +minsize = 10 + +[common] +access_token_expire_minutes = 60 +clean_timeout = 3600 +key = "some_random_key_for_init" +auth = "You_account_system_link_on_local" + +[ui] +title = "Study Area CN comments" +link = "You_account_system_link_on_internet" diff --git a/config/config.toml b/config/config.toml deleted file mode 100644 index 477f510..0000000 --- a/config/config.toml +++ /dev/null @@ -1,19 +0,0 @@ -[db] -host = "192.168.10.119" -port = 3306 -user = "sacn" -passwd = "QFJRmEeacAfszJ42" -db = "sacn" -maxsize = 10 -minsize = 10 - -[common] -lang = "zh_cn" -access_token_expire_minutes = 60 -clean_timeout = 60 -key = "114514" -auth = "https://account.study-area.org.cn" - -[ui] -title = "test" -link = "https://account.study-area.org.cn" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a1843a5 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,26 @@ +aiohappyeyeballs==2.4.0 +aiohttp==3.10.5 +aiomysql==0.2.0 +aiosignal==1.3.1 +annotated-types==0.7.0 +anyio==4.4.0 +attrs==24.2.0 +click==8.1.7 +fastapi==0.114.0 +frozenlist==1.4.1 +h11==0.14.0 +idna==3.8 +Jinja2==3.1.4 +MarkupSafe==2.1.5 +multidict==6.0.5 +pydantic==2.9.0 +pydantic_core==2.23.2 +pygtrie==2.5.0 +PyMySQL==1.1.1 +python-multipart==0.0.9 +sniffio==1.3.1 +starlette==0.38.4 +typing_extensions==4.12.2 +tzdata==2024.1 +uvicorn==0.30.6 +yarl==1.10.0