{"id":31698702,"url":"https://github.com/nfachenxi/doc-notify","last_synced_at":"2026-04-17T06:32:27.059Z","repository":{"id":318473420,"uuid":"1071434037","full_name":"nfachenxi/doc-notify","owner":"nfachenxi","description":"一个轻量级的文档更新通知服务，当用户点击特定链接时自动发送 webhook 通知。","archived":false,"fork":false,"pushed_at":"2025-10-07T11:03:13.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-07T12:30:30.582Z","etag":null,"topics":["anti-scan","automation","chinese-detection","collaboration","document","flask","notification","python","webhook"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nfachenxi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-07T10:47:16.000Z","updated_at":"2025-10-07T11:02:08.000Z","dependencies_parsed_at":"2025-10-07T12:30:33.628Z","dependency_job_id":null,"html_url":"https://github.com/nfachenxi/doc-notify","commit_stats":null,"previous_names":["nfachenxi/doc-notify"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nfachenxi/doc-notify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfachenxi%2Fdoc-notify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfachenxi%2Fdoc-notify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfachenxi%2Fdoc-notify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfachenxi%2Fdoc-notify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfachenxi","download_url":"https://codeload.github.com/nfachenxi/doc-notify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfachenxi%2Fdoc-notify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31918479,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anti-scan","automation","chinese-detection","collaboration","document","flask","notification","python","webhook"],"created_at":"2025-10-08T19:10:10.808Z","updated_at":"2026-04-17T06:32:27.027Z","avatar_url":"https://github.com/nfachenxi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📄 Doc Notify - 文档更新通知服务\n\n\u003cdiv align=\"center\"\u003e\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Python 3.7+](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)\n[![Flask](https://img.shields.io/badge/flask-3.0.0-green.svg)](https://flask.palletsprojects.com/)\n\n一个轻量级的文档更新通知服务，当用户点击特定链接时自动发送 webhook 通知。\n\n[功能特性](#-功能特性) • [快速开始](#-快速开始) • [部署指南](#-部署指南) • [配置说明](#️-配置说明) • [API 文档](#-api-文档)\n\n\u003c/div\u003e\n\n---\n\n## 🎯 应用场景\n\n适用于团队协作文档更新通知，例如：\n\n- ✅ 在腾讯文档中插入链接，点击后通知相关人员\n- ✅ 在飞书文档中分享链接，触发团队通知\n- ✅ 在任何文档系统中创建通知触发器\n\n## ✨ 功能特性\n\n### 🔔 核心功能\n- **智能通知**: 点击链接即发送 webhook 通知\n- **中文检测**: 自动过滤扫描器，只处理包含中文的路径\n- **防刷机制**: 同一 IP 在指定时间内不重复通知\n- **自定义配置**: 灵活的文档与 webhook 映射\n\n### 🛡️ 安全防护\n- **黑名单过滤**: 自动拦截常见的扫描路径\n- **扩展名检测**: 过滤 `.php`、`.asp` 等扫描文件\n- **特殊字符检测**: 识别并拦截可疑路径\n- **IP 记录**: 记录所有访问者 IP\n\n### 🎨 用户体验\n- **美观界面**: 现代化的响应式 Web UI\n- **友好反馈**: 清晰的操作结果提示\n- **实时日志**: 完整的访问和错误日志\n\n## 🚀 快速开始\n\n### 环境要求\n\n- Python 3.7+\n- Debian/Ubuntu 服务器（推荐）\n- 域名（可选，用于 HTTPS）\n\n### 安装步骤\n\n1. **克隆项目**\n\n```bash\ngit clone https://github.com/nfachenxi/doc-notify.git\ncd doc-notify\n```\n\n2. **配置文件**\n\n编辑 `config.yaml`：\n\n```yaml\n# 开启中文检测（推荐）\nchinese_only: true\n\n# 配置 webhook\nwebhooks:\n  \"产品需求文档\": \"https://your-webhook-url.com/notify\"\n  \"技术方案\": \"https://your-webhook-url.com/notify\"\n```\n\n3. **一键部署**\n\n```bash\nsudo bash deploy.sh\n```\n\n4. **验证安装**\n\n```bash\ncurl http://127.0.0.1:5000/health\n```\n\n## 📖 使用方法\n\n### 1. 配置 Webhook\n\n在 `config.yaml` 中添加文档与 webhook 的映射：\n\n```yaml\nwebhooks:\n  \"产品需求文档\": \"https://your-webhook-url.com/notify\"\n```\n\n### 2. 创建链接\n\n在腾讯文档或其他平台插入链接：\n\n```\nhttps://your-domain.com/产品需求文档\n```\n\n### 3. 点击触发\n\n当有人点击链接时，系统会：\n- 识别文档名称\n- 发送 POST 请求到配置的 webhook\n- 返回友好的通知页面\n\n### 4. Webhook 数据格式\n\n接收端会收到以下 JSON 数据：\n\n```json\n{\n  \"doc_name\": \"产品需求文档\",\n  \"access_time\": \"2025-10-07 14:30:00\",\n  \"ip_address\": \"192.168.1.100\"\n}\n```\n\n## 🔧 部署指南\n\n### Debian/Ubuntu 服务器\n\n使用提供的自动化部署脚本：\n\n```bash\n# 1. 上传项目到服务器\ncd /opt\ngit clone https://github.com/nfachenxi/doc-notify.git\ncd doc-notify\n\n# 2. 运行部署脚本\nsudo bash deploy.sh\n\n# 3. 配置反向代理（使用 1Panel 或 Nginx）\n```\n\n### 使用 1Panel 面板\n\n1. 创建反向代理网站\n2. 域名：`notice.your-domain.com`\n3. 代理地址：`http://127.0.0.1:5000`\n4. 启用 HTTPS（推荐使用 Let's Encrypt）\n\n### 使用 Nginx\n\n```bash\n# 复制配置文件\nsudo cp nginx.conf /etc/nginx/sites-available/doc-notify\nsudo ln -s /etc/nginx/sites-available/doc-notify /etc/nginx/sites-enabled/\n\n# 修改域名\nsudo nano /etc/nginx/sites-available/doc-notify\n\n# 重启 Nginx\nsudo nginx -t\nsudo systemctl restart nginx\n```\n\n## ⚙️ 配置说明\n\n### config.yaml\n\n```yaml\n# 全局配置\nenable_rate_limit: true    # 启用防刷机制\nrate_limit_seconds: 60     # 防刷间隔（秒）\nchinese_only: true         # 只允许包含中文的路径\n\n# 默认 webhook\ndefault_webhook: https://your-default-webhook.com/notify\n\n# 黑名单（可选）\nblocked_paths:\n  - \"sitemap.xml\"\n  - \"robots.txt\"\n  - \"admin\"\n\n# 文档映射\nwebhooks:\n  \"产品需求文档\": \"https://webhook1.com/notify\"\n  \"技术方案\": \"https://webhook2.com/notify\"\n```\n\n### 配置项说明\n\n| 配置项 | 类型 | 默认值 | 说明 |\n|--------|------|--------|------|\n| `enable_rate_limit` | boolean | true | 是否启用防刷机制 |\n| `rate_limit_seconds` | int | 60 | 同一IP的通知间隔（秒） |\n| `chinese_only` | boolean | false | 是否只允许包含中文的路径 |\n| `default_webhook` | string | null | 默认 webhook 地址 |\n| `blocked_paths` | array | [] | 自定义黑名单路径 |\n| `webhooks` | object | {} | 文档与 webhook 的映射 |\n\n## 📡 API 文档\n\n### 健康检查\n\n```bash\nGET /health\n```\n\n**响应**：\n```json\n{\n  \"status\": \"healthy\",\n  \"timestamp\": \"2025-10-07T14:30:00\"\n}\n```\n\n### 访问统计\n\n```bash\nGET /api/stats\n```\n\n**响应**：\n```json\n{\n  \"status\": \"success\",\n  \"total_visits\": 123,\n  \"active_rate_limits\": 5\n}\n```\n\n### 文档通知\n\n```bash\nGET /{doc_name}\n```\n\n**参数**：\n- `doc_name`: 文档名称（支持中文）\n\n**行为**：\n1. 检查路径是否合法\n2. 查找对应的 webhook\n3. 发送 POST 请求\n4. 返回结果页面\n\n## 🛠️ 服务管理\n\n### 查看状态\n\n```bash\nsudo systemctl status doc-notify\n```\n\n### 启动/停止/重启\n\n```bash\nsudo systemctl start doc-notify\nsudo systemctl stop doc-notify\nsudo systemctl restart doc-notify\n```\n\n### 查看日志\n\n```bash\n# 应用日志\ntail -f logs/app.log\n\n# 系统日志\nsudo journalctl -u doc-notify -f\n```\n\n## 🔒 安全建议\n\n1. **使用 HTTPS**: 配置 SSL 证书保护数据传输\n2. **IP 白名单**: 在 Nginx 中配置允许的 IP 范围\n3. **定期更新**: 及时更新依赖包修复安全漏洞\n4. **监控日志**: 定期检查异常访问\n\n## 🧪 测试工具\n\n### 测试 Webhook\n\n```bash\npython test_webhook.py \u003cwebhook_url\u003e [文档名称]\n```\n\n**示例**：\n```bash\npython test_webhook.py https://your-webhook.com/notify 产品需求文档\n```\n\n### 本地测试\n\n```bash\n# 测试健康检查\ncurl http://127.0.0.1:5000/health\n\n# 测试文档路由\ncurl http://127.0.0.1:5000/测试文档\n\n# 测试扫描过滤\ncurl http://127.0.0.1:5000/admin  # 应该返回 404\n```\n\n## 📊 工作原理\n\n```\n用户点击链接\n    ↓\nhttps://notice.your-domain.com/产品需求文档\n    ↓\nNginx/1Panel 反向代理\n    ↓\nFlask 应用 (Port 5000)\n    ↓\n1. 中文检测 ✓\n2. 黑名单过滤 ✓\n3. 防刷检查 ✓\n    ↓\n发送 POST 到 Webhook\n    ↓\n{\n  \"doc_name\": \"产品需求文档\",\n  \"access_time\": \"2025-10-07 14:30:00\",\n  \"ip_address\": \"192.168.1.100\"\n}\n    ↓\n返回友好页面\n```\n\n## 🤝 贡献指南\n\n欢迎提交 Issue 和 Pull Request！\n\n1. Fork 本仓库\n2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)\n3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)\n4. 推送到分支 (`git push origin feature/AmazingFeature`)\n5. 提交 Pull Request\n\n## 📄 开源协议\n\n本项目采用 [MIT](LICENSE) 协议开源。\n\n## 🙏 致谢\n\n- [Flask](https://flask.palletsprojects.com/) - Web 框架\n- [Gunicorn](https://gunicorn.org/) - WSGI HTTP 服务器\n- [PyYAML](https://pyyaml.org/) - YAML 解析器\n\n## 📮 联系方式\n\n- 提交 Issue: [GitHub Issues](https://github.com/nfachenxi/doc-notify/issues)\n- 邮箱: nfachenxi@163.com\n\n## ⭐ Star History\n\n如果这个项目对您有帮助，请给它一个 Star ⭐\n\n---\n\n\u003cdiv align=\"center\"\u003e\nMade with ❤️ by Your Name\n\u003c/div\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfachenxi%2Fdoc-notify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfachenxi%2Fdoc-notify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfachenxi%2Fdoc-notify/lists"}