Commit graph

133 commits

Author SHA1 Message Date
4edd468ace
ci: add workflow to auto-fix lint and formatting 2026-08-03 00:44:01 +08:00
1fc702ceb4
docs: add filter tutorial and clarify exact matching rules 2026-08-03 00:39:52 +08:00
8c9720b1b3
docs: document admin groups, OAuth redirect, and API renames 2026-08-03 00:33:18 +08:00
8c8cfbf211
fix: remove click prevent on route toggle switch 2026-08-03 00:12:50 +08:00
38daf7bc83
feat: ignore filters on fallback routes 2026-08-03 00:02:29 +08:00
bd33fa6835
fix: harden input validation, redirect safety, and error resilience 2026-08-02 23:56:58 +08:00
d419b9c940
feat: add fallback routes and repository event enrichment 2026-08-02 23:23:07 +08:00
44b8fead78
feat: add merge/close PR buttons to Discord PR notifications 2026-08-02 23:02:37 +08:00
d40f34cc4d
fix: skip validation for unchanged admin routes 2026-08-02 22:53:36 +08:00
9e0f21c538
feat(admin): add zh/en i18n to the config console
Introduce a lightweight useI18n composable (zh default, auto-detect via
navigator.language, manual toggle persisted to localStorage) with full
zh/en dictionaries, and wire translation keys through the console UI.
2026-08-02 08:40:01 +08:00
d3c1349d00
feat(admin): group-centric console navigation and group-scoped routes API
Add GET/PUT /api/groups/:groupId/routes endpoints that filter and merge
routes by group (backend forces groupId from the path param). Rework the
console so the top level lists groups; entering a group shows and manages
only that group's routes. Drop the route-level group selector and the
now-redundant group badge on route cards.
2026-08-02 08:39:46 +08:00
62985a2f3f
feat(admin): groups management UI in the console
Add a super-admin-only Groups tab to create, edit and delete groups
(name, admin ids, owner scope). Routes now require a group via a select
in the editor, group names are shown on route cards, and the new
useMe/useGroups composables back the UI.
2026-08-02 08:16:05 +08:00
537f4cbb84
feat(admin): scope groups to specific GitHub orgs/users
Add an optional owners[] field to groups (super-admin only). When set,
only webhook events whose repository owner or organization login matches
enter that group's routes; empty owners means no restriction, keeping
existing routes backward compatible.

- types: Group.owners?, groups.ts groupAcceptsOwners()
- webhook.ts eventOwners() extracts repo owner + org login
- discord.ts dispatch skips routes whose group rejects the event owner
- admin-routes.ts validateGroups() validates owners list
2026-08-02 08:15:49 +08:00
667b8038af
feat(web): auto dark mode for terms and privacy pages
Tokenize the legal page palette into CSS variables and add a
prefers-color-scheme:dark override so /terms and /privacy follow the
device theme, matching the landing page and admin console.
2026-08-02 08:14:03 +08:00
c2b78bef69
feat(web): link landing docs button to the docs site
Point the homepage Documentation card at the hosted docs site
(https://webhooker.docs.worldexecute.me), language-aware: /zh for
Chinese and / for English. Still overridable via DOCS_URL.
2026-08-02 07:51:50 +08:00
83794c251f
feat(web): auto dark mode for admin console
Add a prefers-color-scheme dark palette to the Nuxt console so it
follows the device/OS theme automatically. Tokenize the previously
hardcoded dot-grid, sticky header, switch knob and overlay scrim so
they invert correctly, and set color-scheme: dark for native controls.
2026-08-02 07:51:46 +08:00
c3e22de4e6
fix(ci): build admin SPA during wrangler deploy
Cloudflare Workers Build runs "wrangler deploy" on a fresh checkout,
where admin/dist (a gitignored symlink) does not exist, so the deploy
failed with a missing assets.directory.

- add build.command to generate the Nuxt SPA before bundling
- point assets.directory at the real ./admin/.output/public output
  instead of the gitignored admin/dist symlink
2026-08-02 07:43:11 +08:00
81d21ffb08
feat(web): add public landing page and move console to /admin
Serve a public landing page at / with buttons to the docs, GitHub repo,
Terms, Privacy and the admin login. Relocate the Nuxt admin console from
/ to /admin so the root is no longer the private console.

- add home-routes.ts (bilingual landing, auto dark mode, configurable
  DOCS_URL / GITHUB_REPO_URL) mounted at /
- move console to admin/pages/admin.vue; redirect / and unknown SPA
  routes to /admin
- point admin login/logout redirects at /admin
2026-08-02 07:40:14 +08:00
fc243811f0
feat(admin): add group-based access scoping for routes and logs
Introduce optional route groups so non-super admins can be delegated
edit/view access to a subset of routes and their send logs.

- add Group model and Route.groupId
- add groups.ts (load/save groups, resolveScope, permission helpers)
- scope /api/routes and /api/logs by the caller's accessible groups;
  add /api/me and /api/groups (group management is super-admin only)
- require a groupId on every route in validateRoutes
- allow group admins (not just super admins) to sign in to the console
2026-08-02 07:39:35 +08:00
225d5b015e
feat(legal): serve Terms of Service and Privacy Policy pages
Add bilingual (zh/en) /terms and /privacy pages served by the Worker for
configuring the Discord application's Terms of Service and Privacy Policy
URLs. Contact line is configurable via optional LEGAL_CONTACT env var.
2026-08-02 07:12:54 +08:00
fcf3413634
fix(deps): bump @cloudflare/workers-types to v5 to match wrangler peer
wrangler@4.118 requires @cloudflare/workers-types@^5, so a fresh
`npm install` (Cloudflare Workers Build CI) failed with ERESOLVE against
the old ^4 pin. Align to ^5; typecheck, lint and tests still pass.
2026-08-02 07:06:23 +08:00
d996dbe45d
docs: align VitePress site with REST send, optional gateway and slash commands
- deployment: drop DISCORD_CHANNEL_ID, add ADMIN_USER_IDS, PKCS#8 key note,
  applications.commands invite scope, and an optional Gateway section
- getting-started: PKCS#8 .dev.vars example, remove channel ID
- introduction: REST delivery, optional DiscordGateway DO, delivery dedup,
  /admin Web UI in architecture and data flow
- index: refresh Workers feature, add Web UI & slash commands feature
2026-08-02 07:02:40 +08:00
f456c979f7
docs: replace !gh command with slash/context-menu commands
Document the /gh login, /gh logout and /gh comment add|edit|del
commands plus the right-click message context-menu equivalents, and
require the applications.commands invite scope. Comments are posted as
the linked user's own GitHub account, so the old GitHub App identity,
Message Content intent and Read Message History requirements are gone.
2026-08-02 06:55:48 +08:00
4349b24d2a
docs: document WebUI, optional gateway, routes-only config and slash commands 2026-08-02 06:51:41 +08:00
d68aeb20d5
test: cover admin, discord REST, send logs, token-store links and dedup 2026-08-02 06:51:32 +08:00
befed0267a
fix(webhook): dedup duplicate deliveries, cache HMAC key, pass ExecutionContext
Skip re-processing when the same X-GitHub-Delivery id is seen (KV, 300s TTL)
to stop double pushes when both an org and an App webhook target the worker.
Pass ExecutionContext through so dispatch runs via waitUntil instead of a
fire-and-forget that gets frozen. Cache the imported HMAC key per secret.
2026-08-02 06:51:20 +08:00
c75cc058fc
feat(discord): comment on GitHub as the linked user via slash/context commands
Replace the App-identity !gh text command with native slash and message
context-menu commands. /gh login|logout link a Discord user to their GitHub
account; /gh comment add|edit|del and the right-click 'GitHub' commands open
a modal and create/edit/delete comments using the user's own OAuth token,
delegating permission checks to GitHub (surfacing 401/403/404). The gateway
registers guild commands on connect and handles interactions in the DO.
2026-08-02 06:50:53 +08:00
407514f3c9
feat(admin): GitHub OAuth login, admin whitelist and Nuxt WebUI
Add an admin WebUI (Nuxt static SPA in admin/, served via the ASSETS
binding) for managing routes and viewing send logs. Access is gated by
GitHub OAuth plus an ADMIN_USER_IDS whitelist with cookie sessions
(admin-session.ts). Expose routes/logs CRUD API (admin-routes.ts), add a
discord-link mapping in token-store.ts, and mount admin routes with an
SPA assets fallback in the server.
2026-08-02 06:50:41 +08:00
cfdf37e273
feat(discord): make gateway optional with REST send path and send logs
Gateway is now an opt-in feature (DISCORD_GATEWAY_ENABLED); when disabled,
messages are delivered via the Discord REST API (discord-rest.ts) instead of
the Durable Object. Record per-route delivery results (send-log.ts) for the
WebUI. Configure assets binding, DO sqlite migration and cron trigger.
2026-08-02 06:50:09 +08:00
4d5c90773d
feat(config): switch to routes-only config, drop default channel
Remove hardcoded DEFAULT_ROUTES and Config.discord.defaultChannelId so
forwarding is driven entirely by user-defined routes (empty KV = no
forwarding). Add ADMIN_USER_IDS, DISCORD_GATEWAY_ENABLED and ASSETS to Env.
2026-08-02 06:49:56 +08:00
ccab01d23a
chore(dev): update Nix env, gitignore and dependencies 2026-08-02 06:48:49 +08:00
114776d5af
feat(nix): add dev environment 2026-07-24 23:42:12 +08:00
512d4b01d5
initial commit 2026-07-24 21:48:50 +08:00