* fix(nuxt): pre-bundle the CommonJS deps of the markdown stack
`debug` and `extend` are imported by micromark and unified through
@elysola/ui. Served unbundled by the dev server they have no default
export, so the console page failed with a 500 in `nuxt dev`.
* docs(deployment): list the fragments and feishu link migrations
The manual `d1 execute` fallback stopped at 0008, and AGENTS.md named
0001..0010 although 0011 already exists.
* feat(storage): persist the per-group route order
Routes used to load in id order, so the order saved from the console
was lost on the next read. Migration 0012 adds `d1_routes.position`:
saving writes each route's index within its own group (saving one group
never shifts another), and routes load by `group_id, position, id`.
A database without the column keeps working: only a "no such column" /
"has no column named" error falls back to the legacy statements, and
nothing is cached, so a later migration is picked up on the next call.
* feat(console): add in-app destructive-action confirmation
Deleting a route or a group used `window.confirm`, which blocks the page
and ignores the console theme. A promise-based `useConfirm()` now drives
one <ConfirmDialog /> built on the reka-ui AlertDialog that
@elysola/ui ships; reka-ui is pre-bundled so dev keeps a single copy and
the dialog stacks with the Rc dialogs.
A request never outlives its asker: one made after the asking component
unmounted resolves false, and one still open when it unmounts is
cancelled.
* feat(console): confirm member and webhook removal
Removing a member, revoking an invite link and disabling a group's
webhook endpoint took effect on the first click. They now ask first;
disabling the webhook explains that senders still using the secret will
be rejected, and its button is styled as destructive.
* feat(console): confirm removing filled editor rows
Filter conditions and groups, delivery targets, saved fragments and forge
hosts vanished on a single click, taking whatever had been typed with
them. Rows holding content now ask first, while empty, never-filled
rows (`isBlankNode`: default operator, no path, no values, not negated)
are still removed directly.
* fix(i18n): remove duplicate button glyphs
"New Route", "New Group" and the group cards' "Open" link render a Plus
or ArrowRight icon next to their label, so the "+" and "→" baked into
the strings appeared twice.
* style(console): redesign route cards for narrow screens
The card was one flex row whose badges, filter chips, targets and five
hand-drawn icon buttons squeezed the route name on small screens. It is
now a grid driven by a container query: name and actions share the top
line, the filter summary (clamped to two lines) and targets follow, and
the tags wrap below; from 40rem the tags move up beside the title.
Targets of the same platform collapse into one tag with a count, long
ids truncate instead of widening the page, and the actions use lucide
icons with accessible labels.
* feat(console): reorder a group's routes by drag or keyboard
The per-card up/down arrows saved after every single step, so moving a
route five places took five writes. A Reorder mode on the group page now
swaps each card's switch for a drag handle: pointer drags (mouse and
touch) slide the neighbours out of the way and auto-scroll near the
viewport edges, Arrow Up/Down on a focused handle moves a card by one
and is announced to screen readers, and nothing is written until Save
order. Cancel or Escape (unless a dialog or list owns it) drops the
draft.
The cards move into a new RouteList component that owns the drag state.
* style(members): align member cards and invite actions
* style(group-editor): size forge and log target controls
Keep source hosts, platform selectors and remove actions aligned without stretching short controls across the dialog. Wrap component roots explicitly so their internal markup cannot break the grid.
* style(route-editor): group options and delivery target fields
Give each target labeled fields and a compact platform header, widen the filter workspace, and align fragment controls. Scroll failed validation into view when the footer is far from the affected section.
* feat(filters): add bilingual suggestions and value validation
Catalog forge events, actions, payload paths and known values with searchable English and Chinese descriptions. Match-value validation mirrors the server and only rejects inputs that cannot match.
* feat(filters): add searchable creatable value inputs
Build a theme-aligned combobox on the shared reka-ui primitives. Rank stored keys before bilingual descriptions, allow validated custom values, and preserve unconfirmed multi-value drafts instead of silently committing them.
* feat(filter-editor): integrate searchable condition inputs
Replace chip-only values with context-aware bilingual inputs and a compact condition grid. Preserve drafts across tree changes, block saves and tests until drafts are resolved, and keep keyword filters free of hidden operators.
* feat(filters): split pasted values without breaking regexes
Accept multiple values separated by commas or lines while retaining commas inside wrapped expressions and raw regex patterns. Pasting replaces the selected range and keeps rejected values as an explicit draft.
* fix(filters): adapt suggestions to the selected operator
Offer literal prefixes and suffixes for substring operators, escaped anchored patterns for regex, and numeric suggestions only for comparisons. Suggestion syntax must mean what the selected matcher actually reads.
* fix(filters): preserve regex meaning when changing operators
Swap wrapped and raw regex sources only when both compile identically after saving. Leave literal, glob, multiline and Unicode-sensitive comparisons unchanged rather than inventing non-equivalent conversions.
* a11y(filter-editor): label type and operator controls
Associate each fixed select with a stable per-condition label while keeping the compact visual layout unchanged.
* fix(editors): ignore accidental backdrop dismissal
Do not discard unsaved route or group edits when the user clicks outside the dialog. Preserve Escape, Cancel and explicit close, including popovers and confirmation dialogs stacked above the editor.
* feat(dispatch)!: scope stop and fallback to each group
A match in one group must not suppress delivery in another group. Track regular matches and stopped scopes independently, and document the routing-table boundary.
BREAKING CHANGE: stop and fallback no longer apply globally across
groups. Put mutually exclusive routes in the same group and define
fallback routes in each group that needs its own catch-all.
* fix(dispatch): honor stop on a matching fallback route
Once a fallback matches with stop enabled, skip later routes of the same group without affecting other groups. Cover multiple fallback routes in the group-isolation regression test.
* style(console): pin theme and language controls to the right
Separate utility controls from page actions so narrow screens retain a readable title column and right-aligned actions below. Wrap long headings without letting them push controls out of view.
* style(groups): place creation beside the aligned group count
Keep the new-group action inside the group list at every width and align the label and count on one baseline with a consistent type scale.
* style(groups): align card footers and keep role badges intact
Give long names two lines, show the current role in its own non-wrapping row, and anchor every card footer to the grid-row bottom regardless of optional source metadata.
* style(logs): prevent filter labels and metadata overflow
Keep filter labels on one line and allow long channel, thread and repository identifiers to wrap instead of widening the page.
* style(console): scale the sidebar and hide mobile tab tracks
Narrow the sidebar proportionally while retaining enough room for both locales. Keep mobile navigation swipeable without a visible horizontal scrollbar.
* feat(console): give each group its own routes URL
Resolve the selected group from /admin/groups/{groupId}, validate console paths, and use browser history for back navigation. Keep Groups active and let an active mobile-tab tap return to the list. Scope pending route loads to their group and retain the count beside long headings.
* feat(console): confirm leaving unsaved page work
Guard route changes when an editor or changed order draft is open. Cancel superseded questions and restore the shown history entry when repeated Back or Forward navigation is refused; only completed navigation resets page work.
* feat(console): confirm sign-out from desktop and mobile
Expose sign-out in the mobile topbar when the sidebar is hidden. Both entry points use the in-app confirmation before navigating to the server logout endpoint.
* fix(console): keep topbar tools clear of very narrow headings
Below 360px, place the full-width heading beneath the breadcrumb and utility row so the three top-right buttons cannot overlap it.
* feat(console): prioritize group titles over actions
Place New Route after Reorder in the group bar. Measure available space and remove the reorder label first, then the creation label, before truncating the group title; remeasure on resize, locale and font changes.
* fix(editors): focus the dialog without selecting its name field
Cancel the non-bubbling FocusScope mount event in the capture phase and focus the dialog itself. Keep keyboard navigation working without highlighting the name or opening the touch keyboard automatically.
* perf(console): preserve one instance across admin navigation
Use a fixed page key instead of remounting the whole console for each URL. Refresh each view when shown and isolate overview metrics and logs so page filters cannot leak into the dashboard.
* fix(console-data): discard superseded load responses
Only the latest request may update a list, its error or loading state. Invalidate pending group loads after a save so an older response cannot restore stale configuration during persistent-console navigation.
* fix(routes): serialize writes and reject unloaded route lists
Whole-list saves must start from loaded data and wait for other route writes. Lock switches and actions during saves, recheck deletion after confirmation, and rebuild saved ordering from the newest route objects.
* fix(editors): scope async results and fragment writes to sessions
A completed save or dry run must not close or overwrite a newer editor. Keep fragment state scoped by group, reject writes until the real list is ready, and retain in-flight fragment locks across navigation.
* fix(groups): serialize edits and isolate group detail panels
Prevent overlapping whole-list writes, avoid duplicate ids after rename, and discard delete confirmations prepared on a page that has since been left. Key member and webhook panels by group so local state cannot cross tenants.
* fix(console): omit the empty action row outside overview
Render the refresh-action container only where it has content so narrow layouts do not reserve a blank row after creation controls move into their page bars.
* perf(metrics): send all seven queries in one D1 batch
Avoid seven sequential network round trips and read totals, breakdowns and recent failures in one consistent transaction. Reuse the failed-send statement and row mapping while retaining group scoping.
* fix(admin-api): bypass browser cache locks for live requests
Use no-store on both client requests and admin responses. Personalized live data must not be reused, and one stalled same-URL cache entry must not block later log requests behind the browser cache lock.
* docs(routes): Clarify fallback hints and document group-scoped stop and fallback upgrade behavior
13 KiB
Deployment
Cloudflare Setup
1. Create KV Namespace
bunx wrangler kv namespace create KV
This outputs a namespace ID. Update wrangler.jsonc with the ID:
{
"kv_namespaces": [
{
"binding": "KV",
"id": "your-namespace-id",
},
],
}
2. Set Secrets
bunx wrangler secret put GITHUB_WEBHOOK_SECRET
bunx wrangler secret put GITHUB_CLIENT_ID
bunx wrangler secret put GITHUB_CLIENT_SECRET
bunx wrangler secret put DISCORD_TOKEN
bunx wrangler secret put DISCORD_PUBLIC_KEY # Discord app public key (Developer Portal) — required for interactions
bunx wrangler secret put TELEGRAM_TOKEN # Telegram bot token (BotFather) — required for Telegram routes
bunx wrangler secret put FEISHU_APP_ID # Feishu app ID — required for Feishu routes
bunx wrangler secret put FEISHU_APP_SECRET # Feishu app secret — required for Feishu routes
bunx wrangler secret put ADMIN_USER_IDS # comma-separated GitHub IDs/logins allowed into the Web UI
::: tip Target channels are configured per route
There is no global channel secret. Each route in the Web UI declares its own target channel (and optional thread), so DISCORD_CHANNEL_ID is not needed.
:::
::: tip GitHub App ID / private key are optional
GITHUB_APP_ID + GITHUB_PRIVATE_KEY (PKCS#8 PEM) are used by the App install flow to resolve the installing account's login on the post-install choice page, and to mint installation tokens for API enrichment — fetching workflow_run job lists and check-suite build logs. You can skip them — the install page then shows an anonymous inst-{installationId} group, workflow job lists still load for public repositories (unauthenticated), and private-repo build logs are omitted. The OAuth flow only needs GITHUB_CLIENT_ID / GITHUB_CLIENT_SECRET.
:::
Discord interactions arrive via the HTTPS Interactions Endpoint, so set DISCORD_PUBLIC_KEY and point the Interactions Endpoint URL at https://your-domain/discord/interactions. See Interactions Endpoint below.
3. Create D1 Database and Run Migrations
bunx wrangler d1 create webhooker
Copy the returned database ID into wrangler.jsonc:
{
"d1_databases": [
{
"binding": "DB",
"database_name": "webhooker",
"database_id": "your-database-id",
},
],
}
Then apply the migrations:
bun run db:migrate:prod # apply migrations to the remote D1 database
bun run db:migrate # apply migrations to the local (Miniflare) database
The db:migrate scripts run wrangler d1 migrations apply webhooker (see package.json), which applies each SQL file in migrations/ and records applied versions in the d1_migrations table.
::: tip Databases previously migrated with d1 execute
If the database already has these tables/columns (e.g. previously migrated with wrangler d1 execute --file), the d1_migrations tracking table may be missing and db:migrate:prod will try to re-run every migration. The ALTER TABLE ... ADD COLUMN statements in 0002_log_detail.sql then fail because the columns already exist. In that case run the files directly instead:
bunx wrangler d1 execute webhooker --remote --file ./migrations/0001_init.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0002_log_detail.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0003_telegram_links.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0004_add_group_id.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0005_audit_logs.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0006_config_d1.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0007_send_logs_index.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0008_storage_d1.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0010_fragments.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0011_feishu_links.sql
bunx wrangler d1 execute webhooker --remote --file ./migrations/0012_route_position.sql
:::
4. Create R2 Bucket (Optional)
The PAYLOAD binding parks oversized webhook payloads in R2 (webhooker-payloads) instead of KV. Without it, oversized payloads fall back to the KV key queue:payload:*. See Storage for the layout.
bunx wrangler r2 bucket create webhooker-payloads
The bucket is already declared in wrangler.jsonc (r2_buckets), so no binding change is needed.
5. Create Queues (Optional)
The QUEUE binding routes webhook delivery through Cloudflare Queues (async dispatch with retry backoff and a dead-letter queue). Skip this step to keep dispatch inline (synchronous).
bunx wrangler queues create webhooker-delivery
bunx wrangler queues create webhooker-delivery-dlq
The queues are already declared in wrangler.jsonc (queues.producers / queues.consumers), so no binding change is needed. The webhooker-delivery consumer retries retryable failures with exponential backoff (5s/30s/2m/10m) up to max_retries, after which the message is moved to webhooker-delivery-dlq and marked dead.
6. Deploy
bunx wrangler deploy
Your worker is now live at https://webhooker.<your-subdomain>.workers.dev.
7. Configure GitHub Webhook
- Go to your GitHub App settings
- Set Webhook URL to
https://webhooker.<your-subdomain>.workers.dev/webhook - Set Webhook secret to match
GITHUB_WEBHOOK_SECRET
8. (Optional) Configure Gitea Webhook
- In your Gitea repo, go to Settings → Webhooks → Add Webhook → Gitea
- Set Target URL to
https://webhooker.<your-subdomain>.workers.dev/webhook - Set HTTP Method to
POSTand Content Type toapplication/json - Set Secret to match
GITEA_WEBHOOK_SECRET - Choose the events to trigger (push, issues, pull requests, releases, ...)
GitHub App Setup
1. Create App
- Go to https://github.com/settings/apps/new
- Fill in:
- GitHub App name:
WebHooker(or your choice) - Homepage URL: your domain
- Webhook URL:
https://your-domain/webhook - Webhook secret: generate and copy to
GITHUB_WEBHOOK_SECRET
- GitHub App name:
- Set permissions:
- Repository permissions: Contents (read), Issues (write), Pull requests (write), Metadata (read), Checks (read), Actions (read), Deployments (read), Discussions (read), Code scanning alerts (read), Dependabot alerts (read)
- Organization permissions: Members (read) — if needed
- Subscribe to events (all 28 supported):
- Push, Pull request, Issues, Issue comment, Workflow run, Workflow job, Status, Deployment, Deployment status, Ping, Release, Create, Delete, Star, Fork, Check run, Check suite, Pull request review, Pull request review comment, Commit comment, Member, Label, Milestone, Discussion, Discussion comment, Repository, Code scanning alert, Dependabot alert
- Generate private key — optional; set
GITHUB_APP_ID+GITHUB_PRIVATE_KEYto show the installing account's login on the post-install page and to authenticate API enrichment (workflow job lists, build logs) for private repositories (see the tip above).
2. Install App
- After creation, go to the App settings page
- Click "Install App" → select org/user
- Choose repositories to monitor
3. Configure OAuth
- Go to App → OAuth settings
- Set Callback URL:
https://your-domain/auth/github/callback - Copy Client ID and Client Secret to env
Discord Bot Setup
-
Create a new application → go to Bot section
-
Copy the bot token to
DISCORD_TOKEN -
Invite the bot with the
botandapplications.commandsscopes and theView Channels+Send Messages+Send Messages in Threadspermissions (combined integer274877910016):https://discord.com/oauth2/authorize?client_id=YOUR_BOT_CLIENT_ID&permissions=274877910016&scope=bot+applications.commands -
Configure target channels per route in the Web UI (
/admin) — no global channel ID is required.
Interactions Endpoint
Messages are sent via the Discord REST API, so pushing works with just DISCORD_TOKEN. Interactions (slash commands, buttons, modals) arrive through the HTTPS Interactions Endpoint:
- Copy the application Public Key (Developer Portal → General Information) to
DISCORD_PUBLIC_KEY. - Set the Interactions Endpoint URL to
https://your-domain/discord/interactions. - Every interaction request is verified with Ed25519 signatures (
X-Signature-Ed25519overX-Signature-Timestamp + body).
The /gh slash command and the GitHub: 添加/编辑/删除评论 message commands are synced by the scheduled trigger (every 5 minutes): per-guild for instant availability, plus a global registration (24h dedup, ~1h propagation). The bot never connects to the Discord Gateway, so it shows as offline — messaging is unaffected (always REST).
Users run /gh login to link their GitHub account and can then comment on issues/PRs as themselves. See the Bot Commands page for the full command reference.
Telegram Bot Setup
- Create a bot with @BotFather and copy its token to
TELEGRAM_TOKEN. - (Optional) Set
TELEGRAM_WEBHOOK_SECRET; the webhook registration passes it to Telegram assecret_token, andPOST /telegram/webhookverifies it with a timing-safe compare. - The worker syncs the webhook from the scheduled trigger (
setWebhookto{BASE_URL}/telegram/webhook), so no manualsetWebhookcall is needed — just make sureBASE_URLis set. - Add the bot to a group (or enable topics) and route events to
chatId/topicIdin the route config.
In Telegram, /gh commands (/gh login, /gh logout, /gh comment <text>, /gh merge, /gh close) work by replying to a notification message — see the Bot Commands page.
Avatars are rendered as a link-preview card using the built-in GET /api/richheader (overridable with TELEGRAM_RICH_HEADER_HOST).
Feishu Bot Setup
- Go to Feishu Open Platform → Create App → choose Custom App → give it a name.
- In Credentials & Basic Info, copy App ID and App Secret to
FEISHU_APP_IDandFEISHU_APP_SECRET. - In Permissions & Scopes, add at least one of the following message scopes so the app can send (and read) messages:
im:message(read and send direct messages and group chat messages)im:message:send_as_bot(send messages as an app)im:message:send(historical version)
- In Bot tab, turn on the bot capability. Add the bot to the target group chat (or create a new group) and copy the Chat ID from the group settings.
- In WebHooker
/admin, create or edit a route and add a target withplatform: "feishu",chatIdset to the Feishu Chat ID, and optionaltopicIdfor a topic inside the chat.
WebHooker uses the app-level credentials (FEISHU_APP_ID / FEISHU_APP_SECRET) to request a tenant_access_token, caches it until expiry, and sends messages as an interactive card (interactive message type). The same token is used to edit messages in place for workflow_run / check_run progress updates.
Inbound: commands & buttons
WebHooker can receive Feishu events and let users act on PRs/Issues from chat, the same way as Discord and Telegram:
/gh login— link your GitHub account (opens an OAuth page)./gh logout— unlink your GitHub account./gh comment <PR/Issue 链接> <内容>— comment as your linked GitHub user./gh merge <PR 链接>//gh close <PR 链接>— merge / close the PR as your linked user.- The Merge / Close buttons on a card trigger the same actions.
To enable inbound:
- In the app Events & Callbacks → Event Subscriptions, set the Request URL to
https://<your-worker>/feishu/webhook(Feishu will send aurl_verificationchallenge, which WebHooker answers automatically). - Subscribe to the events:
im.message.receive_v1— receive/ghcommands (requires theim:messagescope).card.action.trigger— receive button clicks on cards.
- In Credentials & Basic Info, set the App Secret (already used for
FEISHU_APP_SECRET) — it also signs the inbound callback via theX-Lark-Signatureheader, and WebHooker verifies it.
Required permissions
| Permission | Purpose |
|---|---|
im:message |
Read and send direct messages and group chat messages. |
im:message:send_as_bot |
Send messages as an app bot (alternative to im:message). |
im:message:send |
Send messages V2 (historical version, alternative). |
Note
Custom bots (group-level webhook URL) are not supported. WebHooker uses an app bot so message editing, token caching, multi-group routing, and inbound commands work the same way as Discord and Telegram.
Custom Domain (Optional)
To use a custom domain instead of *.workers.dev:
- Go to your Cloudflare Worker settings
- Add a custom domain or route
- Update
BASE_URLto match
Note
This project is a Cloudflare Worker. It requires the KV and D1 bindings declared in
wrangler.jsonc, so it cannot run as a standalone Node/container process. The Queues binding (QUEUE) is optional — without it, webhook dispatch stays inline.