diff --git a/AGENTS.md b/AGENTS.md index e8f9bd9..50b0678 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,6 +19,7 @@ Core pipeline: GitHub Webhook → Worker (verify + filter + format) → Discord - Access control: every group has role-based members (`owner` / `admin` / `viewer`); super admins bypass; legacy `adminIds` are read as owners (backward compatible); owners manage members + invites; `owners` field stays super-only - Invites: single-use 7-day links (`invite:{token}`) for joining a group as admin/viewer; `ALLOW_SELF_SIGNUP=1` gives access-less users a personal group on first login (self-service SaaS entry) - Audit log: every admin operation (logins, group/route/member/invite changes) recorded in D1 `audit_logs`; pruned by the scheduled trigger after `AUDIT_RETENTION_DAYS` (default 90) +- Group webhook log channel: optional `Group.logTarget` (Discord channel/thread or Telegram chat/topic) receives one summary message per webhook the group's routes dispatched (event, repo, delivery id, per route×target ✅/❌ outcome, green/red color); best-effort, not recorded in `send_logs` - Local dev: wrangler + Miniflare ## Architecture @@ -30,7 +31,7 @@ src/ ├── config.ts # loadRoutes/saveRoutes (KV config:routes, cache w/ 60s TTL), loadConfig from env ├── server.ts # Hono app: /health, /webhook, /discord/interactions, /telegram/webhook, mounts /auth, /admin + / ├── core/ -│ └── dispatch.ts # Platform-neutral dispatch: match routes → formatEvent → driver.send/edit (recordSend + group filter) +│ └── dispatch.ts # Platform-neutral dispatch: match routes → formatEvent → driver.send/edit (recordSend + group filter + per-group webhook log) ├── events/ # Provider-agnostic route matching │ └── match.ts # matchRoute, eventOwners, extractBranch, keyword regex filtering ├── providers/ # Forge webhook providers (verify + parse/normalize to GitHub-shaped events) @@ -106,6 +107,7 @@ src/__tests__/ # bun test unit tests (webhook, formatter, discord, te - Route messages to Discord channels/threads and Telegram chats/topics via REST - Edit already-sent messages in place for `workflow_run` / `check_run` progress (stable `updateKey`, KV `msg:*` tracking) - Record every dispatch attempt to D1 `send_logs` (route id, event, target, ok/error, duration, error code) +- Send a per-event summary (event, repo, delivery id, per route×target ✅/❌ outcome) to the group's `logTarget` when configured - Serve `/gh` slash commands + message context-menu commands + PR merge/close buttons + comment modals - Serve Telegram `/gh` commands (login/logout/comment/merge/close) via reply-message parsing - Sync application commands from the scheduled trigger (global ~1h propagation + per-guild instant) diff --git a/README.md b/README.md index d0c0fe2..46deb5b 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ GitHub / Gitea webhook → Discord / Telegram dispatcher. Receives webhook event - Rich messages with color coding, author avatars, fields, and timestamps — rendered as Discord embeds and Telegram HTML - Route to Discord channels/threads and Telegram chats/topics (multi-target routes) - `workflow_run` / `check_run` progress is edited **in place** (single message updated as the run advances) on both platforms +- **Per-group webhook log channel** — point a group at a Discord channel/thread or Telegram chat/topic and every webhook the group's routes dispatch is summarized there (✅/❌ per route × target) - GitHub OAuth for user actions (comment, edit comment, delete comment, merge, close, react) - **Web UI config console** (`/admin`) — manage routes and groups with GitHub OAuth + admin whitelist, view send logs - **Discord Interactions Endpoint** (Ed25519-verified) for `/gh` slash commands, message context-menu commands, PR merge/close buttons, and comment modals diff --git a/README.zh.md b/README.zh.md index 2eaa02f..750bc41 100644 --- a/README.zh.md +++ b/README.zh.md @@ -11,6 +11,7 @@ GitHub / Gitea webhook → Discord / Telegram 分发服务。通过 Cloudflare W - 富消息:颜色编码、作者头像、字段、时间戳——渲染为 Discord embed 与 Telegram HTML - 路由到 Discord 频道/子区与 Telegram 群组/话题(一条路由可多目标) - `workflow_run` / `check_run` 进度**原地编辑**同一条消息(运行推进时更新),两个平台均支持 +- **分组级 Webhook 日志频道** —— 为分组指定一个 Discord 频道/子区或 Telegram 群组/话题,该分组路由每次分发 webhook 都会向其中发送摘要(每条「路由 × 目标」一行,✅/❌ 结果) - GitHub OAuth 用户授权(评论、编辑评论、删除评论、合并、关闭、反应) - **Web 配置控制台**(`/admin`)— 通过 GitHub OAuth + 管理员白名单管理路由与分组、查看发送日志 - **Discord Interactions Endpoint**(Ed25519 验签)支持 `/gh` 斜杠命令、消息右键菜单命令、PR 合并/关闭按钮与评论 modal diff --git a/admin/assets/css/main.css b/admin/assets/css/main.css index 950d763..bd35559 100644 --- a/admin/assets/css/main.css +++ b/admin/assets/css/main.css @@ -689,6 +689,29 @@ main { box-shadow: 0 0 0 3px var(--accent-dim); } +.field select { + width: 100%; + padding: 10px 12px; + background: var(--surface); + border: 1px solid var(--border-strong); + border-radius: var(--radius-sm); + color: var(--text); + font-family: var(--ui); + font-size: 13.5px; + cursor: pointer; + outline: none; +} + +.field select:focus { + border-color: var(--accent); + box-shadow: 0 0 0 3px var(--accent-dim); +} + +.field select + input[type="text"], +.field input[type="text"] + input[type="text"] { + margin-top: 8px; +} + .field .hint { font-size: 11px; color: var(--faint); diff --git a/admin/components/GroupEditor.vue b/admin/components/GroupEditor.vue index 23922de..02b56d5 100644 --- a/admin/components/GroupEditor.vue +++ b/admin/components/GroupEditor.vue @@ -106,6 +106,42 @@