mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
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.
43 lines
894 B
TypeScript
43 lines
894 B
TypeScript
export interface Filter {
|
|
type: "event" | "repo" | "actor" | "action" | "branch" | "keyword";
|
|
match: string | string[];
|
|
exclude?: boolean;
|
|
}
|
|
|
|
export interface Route {
|
|
id: string;
|
|
name: string;
|
|
enabled: boolean;
|
|
filters: Filter[];
|
|
target: {
|
|
channelId: string;
|
|
threadId?: string;
|
|
};
|
|
lang?: string;
|
|
}
|
|
|
|
export const FILTER_TYPES = ["event", "repo", "actor", "action", "branch", "keyword"] as const;
|
|
|
|
export const FILTER_LABELS: Record<string, string> = {
|
|
event: "Event",
|
|
repo: "Repo",
|
|
actor: "Actor",
|
|
action: "Action",
|
|
branch: "Branch",
|
|
keyword: "Keyword",
|
|
};
|
|
|
|
export function fmtMatch(match: string | string[]): string {
|
|
if (Array.isArray(match)) return match.join(", ");
|
|
return String(match ?? "");
|
|
}
|
|
|
|
export interface SendRecord {
|
|
ts: number;
|
|
routeId: string;
|
|
event: string;
|
|
repo?: string;
|
|
target: string;
|
|
ok: boolean;
|
|
error?: string;
|
|
}
|