mirror of
https://github.com/Elysola/WebHooker.git
synced 2026-11-20 17:13:49 +00:00
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.
This commit is contained in:
1 parent
1c4639b07d
commit
ce4be66bac
5 files changed
+48
-7
No files matched your search
@@ -18,7 +18,7 @@ Core pipeline: GitHub Webhook → Worker (verify + filter + format) → Discord
|
||||
- Per-group webhook ingress: optional `POST /webhook/{groupId}` with a per-group secret in KV (`tenant:{groupId}`) — Gitea/classic-GitHub/custom webhooks are verified against the group's secret instead of the operator's global ones; only that group's routes fire. The legacy `POST /webhook` (global secrets, all routes) stays untouched
|
||||
- GitHub App tenant isolation: `Group.installationId` binds a group to one GitHub App installation; events whose `payload.installation.id` differs are rejected at dispatch (hard isolation on top of the optional `owners` list). The App's Setup URL points at `GET /auth/github/install`, which renders a choice page (create `inst-{installationId}` or bind to a group the signed-in user owns, verified by role); `POST /auth/github/install/bind` performs the provisioning. `installation.created` webhook events auto-provision as a fallback (create `inst-{installationId}` or bind existing groups whose `owners` match the installing account)
|
||||
- GitHub OAuth: octokit (token is stored hashed for reverse lookup)
|
||||
- Admin WebUI: `/admin` config console, OAuth-session protected via `ADMIN_USER_IDS` whitelist (local-only `DEBUG_MODE=true` bypasses authentication); left sidebar navigation (Overview / Groups / Send Logs / Audit / Stats) + topbar, deep-linkable routes (`/admin` overview · `/admin/groups` · `/admin/groups/{groupId}` a group's routes, members and webhook · `/admin/logs` · `/admin/audit` · `/admin/metrics`, parsed by `app/utils/admin-path.ts`; the admin page's `validate` 404s any other path); every page is a history entry, so the browser's back button returns from a group to the list (no in-page back button) and leaving with an open editor or an unsaved route order asks first; the overview dashboard (`AdminHome.vue`) aggregates delivery KPIs, a routes table and recent send logs; the stats page (`MetricsPanel.vue`) renders KPI cards plus per-platform/per-event ok/failed bar legends and a per-status breakdown, and filters by group (`?groupId=`); the route/group editors (`RouteEditor.vue` / `GroupEditor.vue`) are centered, scrollable `RcDialog` forms with an eyebrow header and sectioned bodies
|
||||
- Admin WebUI: `/admin` config console, OAuth-session protected via `ADMIN_USER_IDS` whitelist (local-only `DEBUG_MODE=true` bypasses authentication); left sidebar navigation (Overview / Groups / Send Logs / Audit / Stats) + topbar, deep-linkable routes (`/admin` overview · `/admin/groups` · `/admin/groups/{groupId}` a group's routes, members and webhook · `/admin/logs` · `/admin/audit` · `/admin/metrics`, parsed by `app/utils/admin-path.ts`; the admin page's `validate` 404s any other path); every page is a history entry, so the browser's back button returns from a group to the list (no in-page back button) and leaving with an open editor or an unsaved route order asks first; sign-out asks for confirmation (sidebar, or a top-right button on narrow screens); the overview dashboard (`AdminHome.vue`) aggregates delivery KPIs, a routes table and recent send logs; the stats page (`MetricsPanel.vue`) renders KPI cards plus per-platform/per-event ok/failed bar legends and a per-status breakdown, and filters by group (`?groupId=`); the route/group editors (`RouteEditor.vue` / `GroupEditor.vue`) are centered, scrollable `RcDialog` forms with an eyebrow header and sectioned bodies
|
||||
- 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)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Trash2, TriangleAlert } from "lucide-vue-next";
|
||||
import { LogOut, Trash2, TriangleAlert } from "lucide-vue-next";
|
||||
import {
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
@@ -46,6 +46,7 @@ const { pending: request, settle, attachHost } = useConfirm();
|
||||
const KIND_ICONS = {
|
||||
delete: Trash2,
|
||||
leave: TriangleAlert,
|
||||
signOut: LogOut,
|
||||
} satisfies Record<NonNullable<ConfirmOptions["kind"]>, typeof Trash2>;
|
||||
|
||||
// Keep the last request on screen while the close animation plays.
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</button>
|
||||
</nav>
|
||||
<div class="console-sidebar-footer">
|
||||
<a href="/admin/logout"><LogOut :size="16" />{{ t("app.signOut") }}</a>
|
||||
<button type="button" @click="signOut"><LogOut :size="16" />{{ t("app.signOut") }}</button>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
@@ -45,6 +45,19 @@
|
||||
<RcButton variant="ghost" size="sm" @click="toggle"
|
||||
><Languages :size="15" class="console-lang-icon" />{{ t("app.langToggle") }}</RcButton
|
||||
>
|
||||
<!-- The sidebar (with its sign-out) is hidden on narrow screens. -->
|
||||
<RcButton
|
||||
v-if="!needLogin"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
class="console-topbar-signout"
|
||||
:title="t('app.signOut')"
|
||||
:aria-label="t('app.signOut')"
|
||||
@click="signOut"
|
||||
><LogOut :size="15" /><span class="console-signout-label">{{
|
||||
t("app.signOut")
|
||||
}}</span></RcButton
|
||||
>
|
||||
</div>
|
||||
<div class="console-actions">
|
||||
<RcButton v-if="view === 'overview'" variant="ghost" size="sm" @click="refreshOverview"
|
||||
@@ -645,6 +658,16 @@ function restoreShownEntry(): void {
|
||||
}
|
||||
}
|
||||
|
||||
async function signOut(): Promise<void> {
|
||||
const confirmed = await confirm({
|
||||
title: t("confirm.signOut"),
|
||||
confirmText: t("app.signOut"),
|
||||
kind: "signOut",
|
||||
});
|
||||
// A full page load: the server clears the session and redirects.
|
||||
if (confirmed) window.location.assign("/admin/logout");
|
||||
}
|
||||
|
||||
// A newer navigation supersedes one still waiting for an answer: that
|
||||
// question (like any other confirmation of this page) is cancelled first.
|
||||
function supersedePending(): void {
|
||||
@@ -986,16 +1009,20 @@ async function onDeleteGroup(group: Group): Promise<void> {
|
||||
padding: 0.9rem 0.55rem 0.25rem;
|
||||
border-top: 1px solid rgb(var(--wh-border));
|
||||
}
|
||||
.console-sidebar-footer a {
|
||||
.console-sidebar-footer button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
color: rgb(var(--wh-muted));
|
||||
font: inherit;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.console-sidebar-footer a:hover {
|
||||
.console-sidebar-footer button:hover {
|
||||
color: rgb(var(--wh-bad));
|
||||
}
|
||||
.console-main {
|
||||
@@ -1047,6 +1074,9 @@ async function onDeleteGroup(group: Group): Promise<void> {
|
||||
.console-status {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.console-topbar-signout {
|
||||
display: none;
|
||||
}
|
||||
.console-mobile-nav {
|
||||
display: none;
|
||||
}
|
||||
@@ -1184,6 +1214,9 @@ async function onDeleteGroup(group: Group): Promise<void> {
|
||||
.console-sidebar {
|
||||
display: none;
|
||||
}
|
||||
.console-topbar-signout {
|
||||
display: inline-flex;
|
||||
}
|
||||
.console-mobile-nav {
|
||||
display: block;
|
||||
border-bottom: 1px solid rgb(var(--wh-border));
|
||||
@@ -1229,9 +1262,14 @@ async function onDeleteGroup(group: Group): Promise<void> {
|
||||
}
|
||||
/* Keep the top-right tools compact so the title column stays readable. */
|
||||
.console-status,
|
||||
.console-signout-label,
|
||||
.console-lang-icon {
|
||||
display: none;
|
||||
}
|
||||
.console-topbar-signout {
|
||||
width: 2rem;
|
||||
padding-inline: 0;
|
||||
}
|
||||
.console-content {
|
||||
width: min(100% - 1.25rem, 1240px);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export interface ConfirmOptions {
|
||||
/** Label of the destructive button (defaults to "Delete"). */
|
||||
confirmText?: string;
|
||||
/** What the action does, shown as the dialog icon (defaults to "delete"). */
|
||||
kind?: "delete" | "leave";
|
||||
kind?: "delete" | "leave" | "signOut";
|
||||
}
|
||||
|
||||
interface ConfirmRequest extends ConfirmOptions {
|
||||
|
||||
@@ -446,6 +446,7 @@ const en: Dict = {
|
||||
"confirm.leaveUnsaved": "Leave this page?",
|
||||
"confirm.leaveUnsavedDesc": "Your unsaved changes will be lost.",
|
||||
"confirm.leave": "Leave",
|
||||
"confirm.signOut": "Sign out of the console?",
|
||||
};
|
||||
|
||||
const zh: Dict = {
|
||||
@@ -883,6 +884,7 @@ const zh: Dict = {
|
||||
"confirm.leaveUnsaved": "确定离开此页面吗?",
|
||||
"confirm.leaveUnsavedDesc": "尚未保存的修改将会丢失。",
|
||||
"confirm.leave": "离开",
|
||||
"confirm.signOut": "确定退出登录吗?",
|
||||
};
|
||||
|
||||
const messages: Record<Locale, Dict> = { en, zh };
|
||||
|
||||
Reference in new issue
Block a user