feat: add server-sent events for logging and activity tracking
- Implemented a custom tracing layer (`AppLogLayer`) to capture log events and broadcast them to SSE clients. - Created admin routes for streaming server logs and listing recent activity logs. - Added an activity log repository interface and SQLite implementation for persisting activity events. - Integrated activity logging into user authentication and channel CRUD operations. - Developed frontend components for displaying server logs and activity logs in the admin panel. - Enhanced the video player with a stats overlay for monitoring streaming metrics.
This commit is contained in:
@@ -14,6 +14,7 @@ import type {
|
||||
MediaFilter,
|
||||
TranscodeSettings,
|
||||
TranscodeStats,
|
||||
ActivityEvent,
|
||||
} from "@/lib/types";
|
||||
|
||||
const API_BASE =
|
||||
@@ -175,6 +176,11 @@ export const api = {
|
||||
request<void>("/files/transcode-cache", { method: "DELETE", token }),
|
||||
},
|
||||
|
||||
admin: {
|
||||
activity: (token: string) =>
|
||||
request<ActivityEvent[]>("/admin/activity", { token }),
|
||||
},
|
||||
|
||||
schedule: {
|
||||
generate: (channelId: string, token: string) =>
|
||||
request<ScheduleResponse>(`/channels/${channelId}/schedule`, {
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
// API response and request types matching the backend DTOs
|
||||
|
||||
export interface ActivityEvent {
|
||||
id: string;
|
||||
timestamp: string;
|
||||
event_type: string;
|
||||
detail: string;
|
||||
channel_id?: string;
|
||||
}
|
||||
|
||||
export interface LogLine {
|
||||
level: string;
|
||||
target: string;
|
||||
message: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export type ContentType = "movie" | "episode" | "short";
|
||||
|
||||
export type AccessMode = "public" | "password_protected" | "account_required" | "owner_only";
|
||||
|
||||
Reference in New Issue
Block a user