chore: auto-fix lint & formatting [skip ci]

This commit is contained in:
github-actions[bot] 2026-08-13 22:46:35 +00:00
parent 6f1a334150
commit 811f8646e0
26 changed files with 304 additions and 306 deletions

View file

@ -54,7 +54,7 @@ bunx wrangler dev # 启动本地开发服务器
### 密钥(本地用 `.dev.vars`,生产用 Worker Secrets
| 变量 | 说明 |
|-----------------------------|-----------------------------------------------------------------------------|
| --------------------------- | --------------------------------------------------------------------------- |
| `GITHUB_WEBHOOK_SECRET` | GitHub webhook 密钥 |
| `GITEA_WEBHOOK_SECRET` | Gitea webhook 密钥(仅接收 Gitea webhook 时需要) |
| `GITHUB_APP_ID` | GitHub App ID用于 App 安装流程解析安装所属账号) |

View file

@ -8,7 +8,7 @@
## 一、现状总览
| 文档 | 规模 | 状态 |
|---|---|---|
| -------------------------------------- | ----------------- | ------------------------------------------------------------------------------ |
| `docs/`VitePressen+zh 镜像) | 11 页 ×2约 75KB | 结构完整但存在事实错误、覆盖缺失、信息架构混乱 |
| `README.md` / `README.zh.md` | 363 行 | 与 docs 大量重复secrets、GitHub App 设置、部署),已出现漂移 |
| `AGENTS.md` | 222 行 | 基本同步,个别过时 |
@ -109,7 +109,7 @@
## 五、中英一致性zh 滞后)
| 严重度 | 文件 | 差异 |
|---|---|---|
| ------ | ------------------------ | ---------------------------------------------------------------------------------------------- |
| 高 | guide/introduction.md | zh 技术栈仍是"Nux3 静态 SPA"en 已为"Nuxt 4 (Vue 3 + Tailwind CSS v3)" |
| 高 | guide/getting-started.md | zh 脚本表缺 `bun run build``bun test` 两行;`bun run dev` 描述不一致wrangler vs Nuxt HMR |
| 中 | api/overview.md | zh 漏"or manage a group"准入条件;漏"空过滤器仅 fallback 路由允许" |

View file

@ -7,7 +7,7 @@ The console itself is served at `/admin`; its tabs are deep-linkable via the URL
## Endpoints
| Endpoint | Description |
|-------------------------------------------------|-------------------------------------------------------------------|
| ----------------------------------------------- | ----------------------------------------------------------------- |
| `GET /admin` | Config console UI |
| `GET /admin/login` | Start admin sign-in (GitHub OAuth) |
| `GET /admin/logout` | Sign out and destroy the session |

View file

@ -11,7 +11,7 @@ https://your-worker.workers.dev
## Endpoints
| Method | Path | Auth | Description |
|----------|---------------------------------|-------------------|--------------------------------------------------------------------|
| -------- | --------------------------- | ----------------- | ------------------------------------------------------------------ |
| `GET` | `/health` | None | Health check |
| `POST` | `/webhook` | HMAC signature | GitHub / Gitea / custom webhook ingestion (provider auto-detected) |
| `POST` | `/webhook/:groupId` | Per-group secret | Per-group webhook ingress (only that group's routes fire) |
@ -63,7 +63,7 @@ Accepts GitHub webhook payloads. Requires valid `X-Hub-Signature-256` header.
**Headers:**
| Header | Required | Description |
|-------------------------|------------|----------------------------------------------------|
| --------------------- | -------- | ------------------------------------------------ |
| `X-Hub-Signature-256` | Yes | HMAC-SHA256 signature |
| `X-GitHub-Event` | Yes | Event type name |
| `X-GitHub-Delivery` | No | Unique delivery ID (used for dedup when present) |
@ -83,7 +83,7 @@ When `X-GitHub-Delivery` is present and the same delivery was already processed
**Error Responses:**
| Status | Body | Cause |
|----------|------------------------------------|------------------------------------------|
| ------ | -------------------------------- | -------------------------------------- |
| `401` | `{"error": "Invalid signature"}` | Signature verification failed |
| `400` | `{"error": "Invalid event"}` | Missing event header or malformed body |
| `413` | `{"error": "Request too large"}` | Body exceeds 1MB limit |
@ -103,7 +103,7 @@ Any JSON payload signed with `X-WebHooker-Signature: sha256=<hex>` (HMAC-SHA256
The primary flow is the App's **Setup URL** — set it to `{BASE_URL}/auth/github/install`. After a user installs the App, the browser lands on:
| Method | Path | Description |
|----------|-------------------------------|--------------------------------------------------------------------------------------------------|
| ------ | --------------------------- | ---------------------------------------------------------------------------------------------- |
| `GET` | `/auth/github/install` | Choice page: bind the installation to a new group or an existing group the signed-in user owns |
| `POST` | `/auth/github/install/bind` | Provisions the binding (owner role re-checked) and redirects to `/admin?install=ok` |

View file

@ -5,7 +5,7 @@ WebHooker supports 28 GitHub webhook event types, each with a dedicated formatte
## Events Table
| Event | Description | Embed Highlights |
|---------------------------------|----------------------------------|--------------------------------------------------------------------------------------------------------------------------|
| ----------------------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| `push` | Code pushed to a branch | Commit list, branch, author, diff stats |
| `pull_request` | PR opened/closed/merged/edited | PR title, branch, diff stats, labels |
| `issues` | Issue opened/closed/edited | Issue title, labels, assignees |
@ -41,7 +41,7 @@ WebHooker supports 28 GitHub webhook event types, each with a dedicated formatte
Each event type uses a distinct color in the Discord embed (from `server/lib/formatters/colors.ts`):
| Color | Events |
|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Green (`#2da44e`) | push, PR opened / ready for review, issue opened, workflow success, release published, check success, review approved, deployment success, member added, milestone closed, discussion answered |
| Red (`#f85149`) | PR closed, issue closed, workflow failure, release deleted, delete, check failure, review changes requested, deployment failure, member removed, code scanning / dependabot critical & high |
| Purple (`#8957e5`) | PR merged, label, discussion |
@ -67,7 +67,7 @@ Any event type without a dedicated formatter falls through to the generic format
See the [Filter Tutorial](../guide/filters) for a hands-on guide with worked examples.
| Filter | Works With |
|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event` | All events |
| `repo` | All events |
| `actor` | All events |

View file

@ -7,7 +7,7 @@ After [linking your GitHub account](#linking-your-account), you can act on GitHu
You must link your GitHub account once before using any command:
| Platform | Command | Effect |
|----------|-----------------------------------|------------------------------------------------------------------|
| -------- | --------------------------------- | ---------------------------------------------------------------- |
| Discord | `/gh login` | Returns an ephemeral OAuth link to authorize your GitHub account |
| Discord | `/gh logout` | Unlinks your GitHub account |
| Telegram | `/gh login` (reply to a message) | Returns an OAuth link |
@ -44,7 +44,7 @@ Notifications for open PRs include **合并 / 关闭** (merge/close) buttons:
### Requirements
| Item | How |
|--------------|----------------------------------------------------------------------------------------------------|
| ------------ | -------------------------------------------------------------------------------------------------- |
| Public key | `DISCORD_PUBLIC_KEY` set + Interactions Endpoint URL configured |
| Invite scope | Bot invited with `applications.commands` (see [Discord Bot Setup](./deployment#discord-bot-setup)) |
| OAuth | `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET` and `BASE_URL` configured |

View file

@ -21,7 +21,7 @@ Routes belong to groups. Groups scope admin access and can restrict which events
```
| Field | Type | Required | Description |
|------------------|----------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ---------------- | -------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id` | string | Yes | Lowercase id (`a-z0-9`, `-`); referenced by each route's `groupId`. Editable: renaming a group re-points its routes, per-group webhook secret and pending invites |
| `name` | string | Yes | Human-readable group name |
| `members` | object[] | No | `{ login, role }` entries; role is `owner`, `admin`, or `viewer` |
@ -38,7 +38,7 @@ Routes belong to groups. Groups scope admin access and can restrict which events
Every group member has one of three roles. Super admins (`ADMIN_USER_IDS`) always bypass them.
| Role | View routes/logs | Edit routes | Manage members & invites | Edit group settings |
|----------|------------------|-------------|--------------------------|---------------------|
| -------- | ---------------- | ----------- | ------------------------ | ------------------- |
| `owner` | ✓ | ✓ | ✓ | ✓ (except `owners`) |
| `admin` | ✓ | ✓ | ✗ | ✗ |
| `viewer` | ✓ (read-only) | ✗ | ✗ | ✗ |

View file

@ -13,7 +13,7 @@ Translation overrides are merged from KV under the key `i18n:<lang>` as a flat J
```jsonc
// KV key: i18n:zh
{
"events.push.title": "{repo}: 推送了 {count} 个提交到 {ref}"
"events.push.title": "{repo}: 推送了 {count} 个提交到 {ref}",
}
```

View file

@ -5,7 +5,7 @@
WebHooker ingests webhooks from multiple forges through the same `POST /webhook` endpoint; the provider is auto-detected from the request headers, so point every forge's webhook at `{BASE_URL}/webhook`.
| Provider | Event header | Signature header | Signature format | Secret |
|----------|------------------|-----------------------|----------------------------|-------------------------|
| -------- | ---------------- | --------------------- | -------------------------- | ----------------------- |
| GitHub | `X-GitHub-Event` | `X-Hub-Signature-256` | `sha256=<hex>` HMAC-SHA256 | `GITHUB_WEBHOOK_SECRET` |
| Gitea | `X-Gitea-Event` | `X-Gitea-Signature` | plain hex HMAC-SHA256 | `GITEA_WEBHOOK_SECRET` |
@ -51,7 +51,7 @@ Payload schema:
```
| Field | Type | Description |
|---------------|----------|------------------------------------------------------------------------------------------------------------------|
| ------------- | -------- | ---------------------------------------------------------------------------------------------------------------- |
| `title` | string | Message title (falls back to "Custom message") |
| `description` | string | Optional message body |
| `color` | string | Optional embed color: a word (`red`, `green`, `yellow`, `blue`, `purple`, `orange`, `cyan`, `gray`) or `#rrggbb` |

View file

@ -5,7 +5,7 @@
Every dispatch attempt is recorded in the D1 `send_logs` table and browsable in the console (**Logs** tab). Fields:
| Field | Meaning |
|--------------|-------------------------------------------------------------------------|
| ------------ | ---------------------------------------------------------------- |
| `routeId` | Route that matched |
| `groupId` | Route's group |
| `event` | Event type (e.g. `push`, `pull_request`, `custom`) |

View file

@ -32,7 +32,7 @@ There are **no default routes** — each route must define its own target. If no
Each entry of `targets` is a push destination, so one route can forward to several channels at once (e.g. a Discord channel **and** a Telegram group). `target.platform` selects the platform: `discord` (default) or `telegram`. For **Discord**, `target.channelId` is required (a thread in `target.threadId` is optional). For **Telegram**, `target.chatId` (the group/supergroup chat id, e.g. `-1001234567890`) is required and `target.topicId` (the `message_thread_id` of a topic, equivalent of a Discord thread) is optional. There is no fallback to a default channel.
| Field | Type | Required | Description |
|------------------|----------|----------|-------------------------------------------------------------------------------------------------|
| ---------------- | -------- | -------- | ----------------------------------------------------------------------------------------------- |
| `groupId` | string | Yes | Id of the [group](./groups) this route belongs to |
| `fallback` | boolean | No | When `true`, fires only if no non-fallback route matched the event; its own filters are ignored |
| `stop` | boolean | No | When `true` and this route matches, no further routes are evaluated for this event |

View file

@ -3,7 +3,7 @@
## KV Storage Layout
| Key Pattern | Value | TTL |
|--------------------------------|-------------------------------------------------------------------------------|--------------------|
| ------------------------------ | ----------------------------------------------------------------------------- | ------------------ |
| `config:routes` | JSON array of routes | Permanent |
| `config:groups` | JSON array of groups | Permanent |
| `session:{id}` | Admin session `{ userId, login }` | 7 days |
@ -26,7 +26,7 @@
The D1 database (`DB` binding, database `webhooker`) holds four tables:
| Table | Purpose |
|------------------|------------------------------------------------------------------------------------------------|
| ---------------- | ---------------------------------------------------------------------------------------------- |
| `send_logs` | One row per dispatch attempt (route id, event, target, ok/error, duration, error code, detail) |
| `audit_logs` | One row per admin operation (login/logout, group/route/member/invite changes) |
| `discord_links` | Maps `discord_user_id``github_user_id` for `/gh` Discord commands |

View file

@ -3,7 +3,7 @@
WebHooker runs three maintenance tasks on the scheduled trigger (`*/5 * * * *`, every 5 minutes). They only run on the deployed worker (Cloudflare cron); local `wrangler dev` runs them when triggered via `wrangler dev --test-scheduled`.
| Task | Purpose |
|-----------------|------------------------------------------------------------------------------------------------------------------|
| --------------- | ---------------------------------------------------------------------------------------------------------------- |
| `discord-sync` | Registers the Discord slash/context-menu commands: per-guild (instant) and globally (24h dedup, ~1h propagation) |
| `telegram-sync` | Calls `setWebhook` to `{BASE_URL}/telegram/webhook` (with `TELEGRAM_WEBHOOK_SECRET` as `secret_token` when set) |
| `audit-prune` | Deletes `audit_logs` entries older than `AUDIT_RETENTION_DAYS` (default 90) |

View file

@ -7,7 +7,7 @@
## 端点
| 端点 | 说明 |
|-------------------------------------------------|-------------------------------------------------------------------|
| ----------------------------------------------- | -------------------------------------------------------- |
| `GET /admin` | 配置控制台页面 |
| `GET /admin/login` | 开始管理员登录GitHub OAuth |
| `GET /admin/logout` | 退出登录并销毁会话 |

View file

@ -11,7 +11,7 @@ https://your-worker.workers.dev
## 端点
| 方法 | 路径 | 鉴权 | 说明 |
|------------|----------------------------------------------|----------------|--------------------------------------------------------|
| -------- | --------------------------- | ------------ | ---------------------------------------------------- |
| `GET` | `/health` | 无 | 健康检查 |
| `POST` | `/webhook` | HMAC 签名 | GitHub / Gitea / 自定义 webhook 接入(自动识别来源) |
| `POST` | `/webhook/:groupId` | 分组 secret | 分组级 webhook 入口(只触发该分组的路由) |
@ -63,7 +63,7 @@ POST /webhook
**请求头:**
| 头部 | 必需 | 说明 |
|-------------------------|--------|---------------------------------|
| --------------------- | ---- | ----------------------------- |
| `X-Hub-Signature-256` | 是 | HMAC-SHA256 签名 |
| `X-GitHub-Event` | 是 | 事件类型名称 |
| `X-GitHub-Delivery` | 否 | 唯一投递 ID存在时用于去重 |
@ -83,7 +83,7 @@ POST /webhook
**错误响应:**
| 状态码 | 响应体 | 原因 |
|----------|------------------------------------|--------------------------------|
| ------ | -------------------------------- | ---------------------------- |
| `401` | `{"error": "Invalid signature"}` | 签名验证失败 |
| `400` | `{"error": "Invalid event"}` | 缺少事件头或格式错误的请求体 |
| `413` | `{"error": "Request too large"}` | 请求体超过 1MB 限制 |
@ -103,7 +103,7 @@ POST /webhook
主要流程是 App 的 **Setup URL** —— 将其设置为 `{BASE_URL}/auth/github/install`。用户安装 App 后浏览器会跳转到:
| 方法 | 路径 | 说明 |
|----------|-------------------------------|-----------------------------------------------------------------|
| ------ | --------------------------- | ------------------------------------------------------------- |
| `GET` | `/auth/github/install` | 选择页:将安装绑定到新分组或登录用户拥有 owner 权限的已有分组 |
| `POST` | `/auth/github/install/bind` | 执行绑定(再次校验 owner 角色)并跳转 `/admin?install=ok` |

View file

@ -5,7 +5,7 @@ WebHooker 支持 28 种 GitHub webhook 事件类型,每种都有专用的格
## 事件表
| 事件 | 说明 | 嵌入亮点 |
|---------------------------------|-----------------------------|------------------------------------------------------------------------------------------------------------------|
| ----------------------------- | ------------------------- | -------------------------------------------------------------------------------------------------------- |
| `push` | 代码推送到分支 | 提交列表、分支、作者、差异统计 |
| `pull_request` | PR 打开/关闭/合并/编辑 | PR 标题、分支、差异统计、标签 |
| `issues` | 议题打开/关闭/编辑 | 议题标题、标签、指派人 |
@ -41,7 +41,7 @@ WebHooker 支持 28 种 GitHub webhook 事件类型,每种都有专用的格
每种事件类型在 Discord 嵌入中使用不同的颜色(来自 `server/lib/formatters/colors.ts`
| 颜色 | 事件 |
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| 绿色 (`#2da44e`) | push、PR 打开/可审查、issue 打开、工作流成功、发布已发布、检查成功、审查已批准、部署成功、成员添加、里程碑关闭、讨论已回答 |
| 红色 (`#f85149`) | PR 关闭、issue 关闭、工作流失败、发布已删除、delete、检查失败、审查请求修改、部署失败、成员移除、代码扫描/Dependabot 严重与高危 |
| 紫色 (`#8957e5`) | PR 合并、label、discussion |
@ -67,7 +67,7 @@ WebHooker 支持 28 种 GitHub webhook 事件类型,每种都有专用的格
实操指南见[过滤器教程](../guide/filters),包含完整示例。
| 过滤器 | 适用事件 |
|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `event` | 所有事件 |
| `repo` | 所有事件 |
| `actor` | 所有事件 |

View file

@ -7,7 +7,7 @@
使用任何命令前,需先绑定一次 GitHub 账号:
| 平台 | 命令 | 效果 |
|----------|----------------------------------|-------------------------------------------------------------|
| -------- | ---------------------------- | --------------------------------------------------- |
| Discord | `/gh login` | 返回一条仅你可见的 OAuth 链接,用于授权 GitHub 账号 |
| Discord | `/gh logout` | 解除绑定 |
| Telegram | `/gh login`(引用一条消息) | 返回 OAuth 链接 |
@ -44,7 +44,7 @@ Discord 命令为**斜杠命令**与**消息右键菜单命令**,由定时任
### 前置条件
| 项目 | 如何满足 |
|--------------|-----------------------------------------------------------------------------------------------------|
| ---------- | --------------------------------------------------------------------------------------------------- |
| 公钥 | 设置 `DISCORD_PUBLIC_KEY` 并配置 Interactions Endpoint URL |
| 邀请 scope | 机器人以 `applications.commands` scope 邀请(见 [Discord Bot 设置](./deployment#discord-bot-设置) |
| OAuth | 配置 `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET``BASE_URL` |

View file

@ -63,7 +63,7 @@ curl http://localhost:8787/health
## 可用脚本
| 脚本 | 说明 |
|------------------------|--------------------------------------|
| ---------------------- | ------------------------------------ |
| `bun run dev` | 启动 Nuxt 开发服务器 (HMR) |
| `bun run build` | 生产构建cloudflare_module preset |
| `bun run deploy` | 部署到 Cloudflare |

View file

@ -21,7 +21,7 @@
```
| 字段 | 类型 | 必需 | 说明 |
|------------------|----------|------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ---------------- | -------- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `id` | string | 是 | 小写 id`a-z0-9``-`);被每条路由的 `groupId` 引用。可编辑:重命名分组会同步其路由、分组 webhook secret 与待处理邀请 |
| `name` | string | 是 | 人类可读的分组名 |
| `members` | object[] | 否 | `{ login, role }` 条目;角色为 `owner``admin``viewer` |
@ -38,7 +38,7 @@
每个分组成员拥有三种角色之一。超级管理员(`ADMIN_USER_IDS`)始终绕过这些限制。
| 角色 | 查看路由/日志 | 编辑路由 | 管理成员与邀请 | 编辑分组设置 |
|----------|---------------|----------|----------------|------------------|
| -------- | ------------- | -------- | -------------- | ---------------- |
| `owner` | ✓ | ✓ | ✓ | ✓(除 `owners` |
| `admin` | ✓ | ✓ | ✗ | ✗ |
| `viewer` | ✓(只读) | ✗ | ✗ | ✗ |

View file

@ -13,7 +13,7 @@
```jsonc
// KV 键i18n:zh
{
"events.push.title": "{repo}: 推送了 {count} 个提交到 {ref}"
"events.push.title": "{repo}: 推送了 {count} 个提交到 {ref}",
}
```

View file

@ -5,7 +5,7 @@
WebHooker 通过同一个 `POST /webhook` 端点接收多个 forge 的 webhook按请求头自动识别来源只需把各 forge 的 webhook 指向 `{BASE_URL}/webhook` 即可。
| 提供方 | 事件请求头 | 签名请求头 | 签名格式 | 密钥 |
|--------|------------------|-----------------------|----------------------------|-------------------------|
| ------ | ---------------- | --------------------- | -------------------------- | ----------------------- |
| GitHub | `X-GitHub-Event` | `X-Hub-Signature-256` | `sha256=<hex>` HMAC-SHA256 | `GITHUB_WEBHOOK_SECRET` |
| Gitea | `X-Gitea-Event` | `X-Gitea-Signature` | 纯 hex HMAC-SHA256 | `GITEA_WEBHOOK_SECRET` |
@ -51,7 +51,7 @@ Gitea 载荷会被归一化为与 GitHub 事件相同的内部结构,因此路
```
| 字段 | 类型 | 说明 |
|---------------|----------|----------------------------------------------------------------------------------------------------------|
| ------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `title` | string | 消息标题(缺省时为 "Custom message" |
| `description` | string | 可选消息正文 |
| `color` | string | 可选嵌入颜色:颜色词(`red``green``yellow``blue``purple``orange``cyan``gray`)或 `#rrggbb` |

View file

@ -5,7 +5,7 @@
每次分发尝试都会记录到 D1 `send_logs` 表,并可在控制台(**日志**标签页)查看。字段:
| 字段 | 含义 |
|--------------|-------------------------------------------------------------|
| ------------ | -------------------------------------------------------- |
| `routeId` | 匹配的路由 |
| `groupId` | 路由所属分组 |
| `event` | 事件类型(如 `push``pull_request``custom` |

View file

@ -32,7 +32,7 @@
`targets` 的每一项都是一个推送目标,因此一条路由可同时转发到多个频道(例如一个 Discord 频道**和**一个 Telegram 群组)。`target.platform` 选择平台:`discord`(默认)或 `telegram`。**Discord** 目标要求 `target.channelId`(可选 `target.threadId` 指定子区);**Telegram** 目标要求 `target.chatId`(群组/超级群组 id`-1001234567890`),可选 `target.topicId`(话题的 `message_thread_id`,相当于 Discord 子区)。没有默认频道回退。
| 字段 | 类型 | 必需 | 说明 |
|------------------|----------|------|-----------------------------------------------------------------------------|
| ---------------- | -------- | ---- | ------------------------------------------------------------------------ |
| `groupId` | string | 是 | 路由所属[分组](./groups)的 id |
| `fallback` | boolean | 否 | 为 `true` 时仅在没有其他非 fallback 路由匹配时才触发;其自身过滤器被忽略 |
| `stop` | boolean | 否 | 为 `true` 且该路由匹配时,不再评估后续路由 |

View file

@ -3,7 +3,7 @@
## KV 存储布局
| 键模式 | 值 | TTL |
|---------------------------------|--------------------------------------------------------------------------------|--------------------|
| ------------------------------ | ----------------------------------------------------------------------------- | ------------------ |
| `config:routes` | 路由 JSON 数组 | 永久 |
| `config:groups` | 分组 JSON 数组 | 永久 |
| `session:{id}` | 管理员会话 `{ userId, login }` | 7 天 |
@ -26,7 +26,7 @@
D1 数据库(`DB` 绑定,数据库 `webhooker`)包含四张表:
| 表 | 用途 |
|-------------------|--------------------------------------------------------------------------------------------------|
| ---------------- | ---------------------------------------------------------------------- |
| `send_logs` | 每次分发尝试一行(路由 id、事件、目标、ok/error、耗时、错误码、详情 |
| `audit_logs` | 每次管理员操作一行(登录/登出、分组/路由/成员/邀请变更) |
| `discord_links` | 映射 `discord_user_id``github_user_id`,供 `/gh` Discord 命令使用 |

View file

@ -3,7 +3,7 @@
WebHooker 通过定时触发器(`*/5 * * * *`,每 5 分钟)运行三个维护任务。它们只在部署后的 Worker 上运行Cloudflare cron本地 `wrangler dev` 可用 `wrangler dev --test-scheduled` 触发。
| 任务 | 用途 |
|-----------------|---------------------------------------------------------------------------------------------------------------------|
| --------------- | ------------------------------------------------------------------------------------------------------------------- |
| `discord-sync` | 注册 Discord 斜杠/右键菜单命令按服务器即时注册并全局注册24h 去重,约 1 小时传播) |
| `telegram-sync` | 调用 `setWebhook` 指向 `{BASE_URL}/telegram/webhook`(设置了 `TELEGRAM_WEBHOOK_SECRET` 时作为 `secret_token` 传入) |
| `audit-prune` | 删除早于 `AUDIT_RETENTION_DAYS`(默认 90天的 `audit_logs` 记录 |

View file

@ -284,9 +284,7 @@ export function validateGroups(
if (
g.providers !== undefined &&
(!Array.isArray(g.providers) ||
!g.providers.every(
(p) => typeof p === "string" && ["github", "gitea"].includes(p),
))
!g.providers.every((p) => typeof p === "string" && ["github", "gitea"].includes(p)))
) {
return {
ok: false,