diff --git a/AGENTS.md b/AGENTS.md
index a260bdf..24713c9 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -9,7 +9,7 @@ Core pipeline: GitHub Webhook → Worker (verify + filter + format) → Discord
## Key Decisions
- Runtime: Cloudflare Workers via the Nitro `cloudflare_module` preset (`_worker.js`), H3 event handlers in `server/routes/`
-- UI: Vue 3 + Tailwind CSS v4 (`@tailwindcss/vite`) + `@elysola/ui` (Nuxt module, `Rc` prefix); admin console is a client-side SPA (`routeRules: "/admin/**": { ssr: false }`), home/legal pages render server-side
+- UI: Vue 3 + Tailwind CSS v4 (`@tailwindcss/vite`) + `@elysola/ui` (Nuxt module, `Rc` prefix); admin console is a client-side SPA (`routeRules: "/admin/**": { ssr: false }`), home/legal pages render server-side; app-level composites (`ConfirmDialog`) are built on the reka-ui primitives that `@elysola/ui` ships (same copy, pre-bundled via `vite.optimizeDeps.include` so dev keeps a single instance and dialogs/popovers stack correctly) and styled like their Rc counterparts
- Styling: Elysola UI supplies semantic components and blue theme tokens; `app/assets/css/main.css` retains `--wh-*` RGB-triplet aliases for app-specific Tailwind utilities and bespoke layouts (avoiding collision with Elysola's `--surface`/`--text`/`--border` hex tokens); theme switching supports auto/light/dark via `useTheme` / `ThemeToggle`, toggling `.dark` with inline anti-flash head script
- Discord interactions: HTTPS Interactions Endpoint (`POST /discord/interactions`, Ed25519-signed) — no Discord Gateway / Durable Object; bot stays offline, messages always sent via REST
- Storage: D1 is the source of truth for config (routes/groups via `d1_routes`/`d1_groups`, see `server/lib/storage/config-store.ts`; each route's per-group order lives in `d1_routes.position` — migration 0012 — and routes load ordered by `group_id, position, id`, falling back to id order on an unmigrated database), send/audit logs, dedup (`dedup_keys`), delivery state (`delivery_state`) and message tracking (`message_tracking` via `server/lib/storage/d1.ts` `canUseD1` gate). KV keeps only cache + short-lived/ephemeral state (tokens, OAuth state, admin sessions, `msg:*`-adjacent locks, per-group secrets `tenant:*`, invites, i18n overrides) with explicit TTLs. R2 parks oversized queue payloads (`webhooks/YYYY/MM/DD/*.json`, `server/lib/storage/payload.ts`) instead of KV. A `storage-prune` scheduled task cleans up expired dedup/delivery/message-tracking rows
@@ -39,8 +39,10 @@ app/ # Vue 3 UI (Nuxt app dir)
├── components/ # ConsolePage (sidebar shell + topbar), AdminHome (overview dashboard),
│ # RouteCard/Editor (RouteEditor has FilterNodeEditor AST builder + TagInput chips),
│ # GroupEditor, MembersPanel, WebhookPanel,
-│ # SendLogs, AuditLog, MetricsPanel, AppToasts, LegalLayout
-├── composables/ # useI18n, useToasts, useGroups, useGroupRoutes, useFilterNode (AST helpers), useFragments, useLogs, useAudit, useInvites, useWebhook
+│ # ConfirmDialog (app-wide destructive-action confirm), SendLogs, AuditLog, MetricsPanel,
+│ # AppToasts, LegalLayout
+├── composables/ # useI18n, useToasts, useConfirm (promise-based confirm), useGroups, useGroupRoutes, useFilterNode (AST helpers), useFragments, useLogs,
+│ # useAudit, useInvites, useWebhook
├── types.ts # shared client types (Route, Group, Filter, ...)
└── utils/legal.ts # terms/privacy HTML bodies (zh/en)
server/ # Nitro server
diff --git a/app/components/ConfirmDialog.vue b/app/components/ConfirmDialog.vue
new file mode 100644
index 0000000..a212930
--- /dev/null
+++ b/app/components/ConfirmDialog.vue
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
{{ shown?.title }}
+
+ {{ shown.description }}
+
+
+
+
+
+ {{ t("confirm.cancel") }}
+
+
+ {{ shown?.confirmText || t("confirm.delete") }}
+
+
+
+
+
+
+
+
+
+
diff --git a/app/components/ConsolePage.vue b/app/components/ConsolePage.vue
index a6181eb..861af20 100644
--- a/app/components/ConsolePage.vue
+++ b/app/components/ConsolePage.vue
@@ -315,6 +315,8 @@
@close="groupEditorOpen = false"
@save="onSaveGroup"
/>
+
+
@@ -343,6 +345,7 @@ import AdminHome from "~/components/AdminHome.vue";
const { t, toggle } = useI18n();
const { push } = useToasts();
+const { confirm } = useConfirm();
const route = useRoute();
const router = useRouter();
@@ -582,7 +585,8 @@ async function onToggle(route: Route): Promise {
async function onDelete(route: Route): Promise {
const group = selectedGroup.value;
if (!group) return;
- if (!window.confirm(t("confirm.deleteRoute", { name: route.name || route.id }))) return;
+ if (!(await confirm({ title: t("confirm.deleteRoute", { name: route.name || route.id }) })))
+ return;
try {
await saveGroupRoutes(
group.id,
@@ -665,8 +669,11 @@ async function onDeleteGroup(group: Group): Promise {
} catch {
// Count is best-effort; proceed without the warning.
}
- const warn = used ? t("confirm.deleteGroupWarn", { n: used }) : "";
- if (!window.confirm(t("confirm.deleteGroup", { name: group.name || group.id }) + warn)) return;
+ const confirmed = await confirm({
+ title: t("confirm.deleteGroup", { name: group.name || group.id }),
+ description: used ? t("confirm.deleteGroupWarn", { n: used }).trim() : undefined,
+ });
+ if (!confirmed) return;
try {
await saveGroups(groups.value.filter((g) => g.id !== group.id));
push(t("toast.groupDeleted"));
diff --git a/app/composables/useConfirm.ts b/app/composables/useConfirm.ts
new file mode 100644
index 0000000..2196bcd
--- /dev/null
+++ b/app/composables/useConfirm.ts
@@ -0,0 +1,63 @@
+export interface ConfirmOptions {
+ /** The question, shown as the dialog title. */
+ title: string;
+ /** Optional consequence text under the title. */
+ description?: string;
+ /** Label of the destructive button (defaults to "Delete"). */
+ confirmText?: string;
+}
+
+interface ConfirmRequest extends ConfirmOptions {
+ resolve: (confirmed: boolean) => void;
+}
+
+/**
+ * Promise-based destructive-action confirmation shared by the whole console.
+ * (mounted once by ConsolePage) renders the pending request;
+ * `confirm()` resolves true on confirm and false on cancel / Escape.
+ */
+export function useConfirm() {
+ const pending = useState("wh-confirm", () => null);
+ const hosts = useState("wh-confirm-hosts", () => 0);
+ // The component that asks; a request it makes after unmounting is refused,
+ // and one still on screen when it unmounts is cancelled.
+ const owner = getCurrentInstance();
+ let asked: ConfirmRequest | null = null;
+ if (owner) {
+ onBeforeUnmount(() => {
+ // Only our own request: another component's newer one stays open.
+ if (asked && toRaw(pending.value) === asked) settle(false);
+ asked = null;
+ });
+ }
+
+ function confirm(options: ConfirmOptions): Promise {
+ // Nobody can answer, or the asker is gone (the console was left while the
+ // request was being prepared): never resume a stale destructive action.
+ if (!hosts.value || owner?.isUnmounted) return Promise.resolve(false);
+ // A newer request supersedes (and cancels) one still on screen.
+ pending.value?.resolve(false);
+ return new Promise((resolve) => {
+ asked = { ...options, resolve };
+ pending.value = asked;
+ });
+ }
+
+ function settle(confirmed: boolean): void {
+ const request = pending.value;
+ if (!request) return;
+ pending.value = null;
+ request.resolve(confirmed);
+ }
+
+ /** Register the dialog that renders requests; the returned detach cancels any pending one. */
+ function attachHost(): () => void {
+ hosts.value++;
+ return () => {
+ hosts.value--;
+ settle(false);
+ };
+ }
+
+ return { pending, confirm, settle, attachHost };
+}
diff --git a/app/composables/useI18n.ts b/app/composables/useI18n.ts
index 8dc5a2a..22c6dcd 100644
--- a/app/composables/useI18n.ts
+++ b/app/composables/useI18n.ts
@@ -394,6 +394,8 @@ const en: Dict = {
"confirm.deleteRoute": 'Delete route "{name}"?',
"confirm.deleteGroup": 'Delete group "{name}"?',
"confirm.deleteGroupWarn": " {n} route(s) reference it and will lose their group.",
+ "confirm.cancel": "Cancel",
+ "confirm.delete": "Delete",
};
const zh: Dict = {
@@ -782,6 +784,8 @@ const zh: Dict = {
"confirm.deleteRoute": "确定删除路由“{name}”吗?",
"confirm.deleteGroup": "确定删除分组“{name}”吗?",
"confirm.deleteGroupWarn": " 有 {n} 条路由引用它,将失去所属分组。",
+ "confirm.cancel": "取消",
+ "confirm.delete": "删除",
};
const messages: Record = { en, zh };
diff --git a/docs/guide/configuration.md b/docs/guide/configuration.md
index 3db6f6b..1ce2802 100644
--- a/docs/guide/configuration.md
+++ b/docs/guide/configuration.md
@@ -65,6 +65,8 @@ For local debugging only, set `DEBUG_MODE=true` to bypass GitHub OAuth and grant
The console is served as an SPA at `/admin`; its tabs are deep-linkable via the URL path (`/admin/groups`, `/admin/logs`, `/admin/audit`). URLs outside `/admin` that do not match an endpoint return a plain `404` instead of the console.
+Destructive actions — deleting routes or groups — ask for confirmation in an in-app dialog.
+
All management endpoints (`/admin/api/*`) are documented in the [Admin API](../api/admin). Saved routes and groups are persisted to D1 (`d1_routes` / `d1_groups`) immediately, the KV cache is invalidated and the config cache is refreshed so the webhook pipeline picks them up on the next run.
## Filter Types
diff --git a/docs/zh/guide/configuration.md b/docs/zh/guide/configuration.md
index aac3f24..fcacb35 100644
--- a/docs/zh/guide/configuration.md
+++ b/docs/zh/guide/configuration.md
@@ -64,6 +64,8 @@ WebHooker 在 `/admin` 提供内置配置控制台,可在浏览器中管理路
控制台以 SPA 形式在 `/admin` 提供;其标签页可通过 URL 路径直达(`/admin/groups`、`/admin/logs`、`/admin/audit`)。`/admin` 之外未匹配到端点的 URL 直接返回 `404`,而不会展示控制台。
+删除类操作——删除路由或分组——都会先弹出应用内确认框。
+
所有管理端点(`/admin/api/*`)见 [Admin API](../api/admin)。保存的路由和分组会立即持久化到 D1(`d1_routes` / `d1_groups`),并使 KV 缓存失效、刷新配置缓存,下一次 webhook 处理即会生效。
## 过滤器类型
diff --git a/nuxt.config.ts b/nuxt.config.ts
index f119cb6..373cd64 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -37,11 +37,15 @@ export default defineNuxtConfig({
},
vite: {
plugins: [tailwindcss()],
+ // App components use reka-ui primitives directly, alongside the copy
+ // @elysola/ui imports. Pre-bundling it up front keeps both on one
+ // dev instance; otherwise a mid-session discovery splits them and dialogs
+ // and popovers stop stacking (Escape / outside clicks reach the wrong layer).
// `debug` and `extend` are CommonJS packages @elysola/ui's markdown stack
// (micromark, unified) imports; served unbundled in dev they lack a default
// export and the console fails to start.
optimizeDeps: {
- include: ["debug", "extend"],
+ include: ["reka-ui", "debug", "extend"],
},
},
devtools: { enabled: false },