feat: admin provider UI (types, hooks, guard, settings panel, conditional admin nav)
This commit is contained in:
@@ -15,6 +15,8 @@ import type {
|
||||
TranscodeSettings,
|
||||
TranscodeStats,
|
||||
ActivityEvent,
|
||||
ProviderConfig,
|
||||
ProviderTestResult,
|
||||
} from "@/lib/types";
|
||||
|
||||
const API_BASE =
|
||||
@@ -179,6 +181,36 @@ export const api = {
|
||||
admin: {
|
||||
activity: (token: string) =>
|
||||
request<ActivityEvent[]>("/admin/activity", { token }),
|
||||
|
||||
providers: {
|
||||
getProviders: (token: string) =>
|
||||
request<ProviderConfig[]>("/admin/providers", { token }),
|
||||
|
||||
updateProvider: (
|
||||
token: string,
|
||||
type: string,
|
||||
payload: { config_json: Record<string, string>; enabled: boolean },
|
||||
) =>
|
||||
request<ProviderConfig>(`/admin/providers/${type}`, {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(payload),
|
||||
token,
|
||||
}),
|
||||
|
||||
deleteProvider: (token: string, type: string) =>
|
||||
request<void>(`/admin/providers/${type}`, { method: "DELETE", token }),
|
||||
|
||||
testProvider: (
|
||||
token: string,
|
||||
type: string,
|
||||
payload: { config_json: Record<string, string>; enabled: boolean },
|
||||
) =>
|
||||
request<ProviderTestResult>(`/admin/providers/${type}/test`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload),
|
||||
token,
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
||||
schedule: {
|
||||
|
||||
@@ -131,6 +131,18 @@ export interface ConfigResponse {
|
||||
providers: ProviderInfo[];
|
||||
/** Primary provider capabilities — kept for backward compat. */
|
||||
provider_capabilities: ProviderCapabilities;
|
||||
available_provider_types: string[];
|
||||
}
|
||||
|
||||
export interface ProviderConfig {
|
||||
provider_type: string;
|
||||
config_json: Record<string, string>;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export interface ProviderTestResult {
|
||||
ok: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
// Auth
|
||||
@@ -145,6 +157,7 @@ export interface UserResponse {
|
||||
id: string;
|
||||
email: string;
|
||||
created_at: string;
|
||||
is_admin: boolean;
|
||||
}
|
||||
|
||||
// Channels
|
||||
|
||||
Reference in New Issue
Block a user