ChatComment
ChatComment 0.3.0 是 Python/SQLite 留言服务和轻量 JavaScript 组件。支持多站点隔离、长 Markdown 留言、回复、点赞、分页、审核和软删除;旧留言按纯文本显示。邮箱、IP 与迁移原始记录仅向有管理授权的接口及导出开放,不进入普通留言响应。默认私有站点可由签名网关、旧 token 网关或可选同主机登录委托模式保护。
python -m pip install ChatComment
chatcomment --version
chatcomment --tree
chatcomment site register personal-blog --origin https://blog.example.com --page /post/one --public
chatcomment serve --token-file ~/.chatarch/chatcomment/admin-token
--token-file 属于保留的单网关模式,必须指向仅部署者可读的现有文件(建议随机 32 字节以上);命令不生成或打印密钥。默认数据库为 $CHATARCH_HOME/chatcomment/comments.sqlite3(未设置时 ~/.chatarch/chatcomment/comments.sqlite3),监听 127.0.0.1:10196。公网接入必须使用 HTTPS 反向代理。私有站点可选择签名网关或同主机登录委托;旧 token 模式则由网关验证登录后附加服务器 Bearer token,不能把该 token 交给浏览器。
<div id="comments"></div>
<script src="https://comments.example.com/widget.js" defer
data-chatcomment data-target="#comments"
data-api="https://comments.example.com" data-site="personal-blog"
data-page="/post/one"></script>
组件自动读取字段策略、显示安全的 Markdown/导入 HTML、提供预览、回复、点赞和分页。必填校验由服务器执行。默认不记住访客信息,也不加载第三方头像。公开模式的匿名留言不代表可信实名;关闭匿名时要求已验证作者身份。使用 site max-content SITE 0 可关闭指定站点的字符数限制;HTTP 请求正文仍限制为 1 MiB。其他站点保持 5000 字默认值。
既有站点可以明确切换公开或私有,不需要重新注册,也不会覆盖留言、字段设置或来源:
chatcomment site visibility personal-blog --public
chatcomment site visibility personal-blog --private
Python 对应 Store.set_visibility(site_id, private=False)。这是本地部署者命令;HTTP 对应 POST /api/sites/{id}/visibility、正文 {"private":false},签名平台模式要求当前已认证的站点 owner 与写 CSRF。此项属于所有者发布策略;字段设置、审核和导出等留言管理仍须密码再认证。注册默认仍为私有;公开托管平台应显式使用 --public,或在已有站点上使用上述切换。
迁移示例:chatcomment twikoo import SITE comments.json 默认只报告差异;核对后使用 --apply。twikoo parity SITE comments.json 复核差异;twikoo export SITE rollback-business.json 导出包括新留言的业务数据。Loki 结构化存储的稳定副本可用 twikoo snapshot SNAPSHOT_DIR business.json 提取 comment/counter,不读取 config。导出含邮箱/IP 等私有数据,需按备份保护。详情见 docs/deployment.md。
API、签名网关接入、原生服务、备份与恢复见 docs/api.md、docs/platform.md、docs/deployment.md。本包不自动开放防火墙或注册 DNS,也不包含云服务凭据。
多用户平台接入使用 平台服务协议:--gateway-key-env 启用按主体/session/站点校验的签名上下文,所有非 health 路由均拒绝未签名访问,兼容独立 Coolify 资源。AccessContext.from_chatlogin() 复用已验证的 ChatLogin Session;项目 ACL 与密码二次验证由平台拥有,账户全局 admin 不能自动获得站点权限。旧 --token-file 模式仅保留给已有单网关部署迁移使用。
独立留言板为 /board?site=personal-blog&page=%2Fpost%2Fone,与嵌入表单读写同一留言流。签名/旧网关保留原邮箱提示与再认证流程。委托模式由固定 loopback 认证适配器校验当前站点会话,owner 可进入 /login 再认证,短时管理权限绑定当前会话和站点。未登录的公开访客没有管理入口。
旧 token 网关模式为普通成员设置 X-ChatComment-Role: reader,仅经服务端验证的 owner 使用 admin;管理接口另行验证权限。公开浏览器不能靠昵称、邮箱或伪造角色 header 获得权限,因为缺少服务器 Bearer token。服务器可为受信 owner 请求附加 X-ChatComment-Admin-Email,只用于入口提示。签名模式不接受未签名角色头,登录委托模式只相信上游验证结果,不相信浏览器的身份头。完整验证合约见部署文档。
Metadata
Release files for ChatComment 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chatcomment-0.3.0.tar.gz | 74.1 kB | With provenance | Details for chatcomment-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chatcomment-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for chatcomment-0.3.0-py3-none-any.whl |
Total release size: 123.9 kB
Release files / chatcomment-0.3.0.tar.gz
| Download URL | chatcomment-0.3.0.tar.gz |
|---|---|
| Size | 74.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6126a5ad4d7306052354f9f55290dc993faf84efaa2ae2cc73f7e969c39a11b3
|
|
BLAKE2b-256 checksum How to use checksums |
6b51d03bb23cd936a560d956c209c22ad40ac85a22aa3b0add7ea6ba86f2c4ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logRelease files / chatcomment-0.3.0-py3-none-any.whl
| Download URL | chatcomment-0.3.0-py3-none-any.whl |
|---|---|
| Size | 49.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd5b42790543167c5256d2a70a8e706f8e8d56ef2484eb5367643184e292ac66
|
|
BLAKE2b-256 checksum How to use checksums |
519a1cc0c1b8c479849a331e363df440c25af8ab8a0bf5bd55c545499622f788
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logSecurity for ChatComment 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for chatcomment-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.