mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-13 12:49:41 +08:00
- Add NotificationProvider base class with send() and test() methods
- Add NotificationManager for handling multiple providers simultaneously
- Add new providers: Discord, Gotify, Pushover, generic Webhook
- Migrate existing providers (Telegram, Bark, Server Chan, WeChat Work) to new architecture
- Add API endpoints for testing providers (/notification/test, /notification/test-config)
- Auto-migrate legacy single-provider configs to new multi-provider format
- Update WebUI with card-based multi-provider settings UI
- Add test button for each provider in settings
- Generic webhook supports template variables: {{title}}, {{season}}, {{episode}}, {{poster_url}}
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import type { NotificationProviderConfig, NotificationType } from '#/config';
|
|
import type { TupleToUnion } from '#/utils';
|
|
|
|
export interface TestProviderRequest {
|
|
provider_index: number;
|
|
}
|
|
|
|
export interface TestProviderConfigRequest {
|
|
type: TupleToUnion<NotificationType>;
|
|
enabled?: boolean;
|
|
token?: string;
|
|
chat_id?: string;
|
|
webhook_url?: string;
|
|
server_url?: string;
|
|
device_key?: string;
|
|
user_key?: string;
|
|
api_token?: string;
|
|
template?: string;
|
|
url?: string;
|
|
}
|
|
|
|
export interface TestResponse {
|
|
success: boolean;
|
|
message: string;
|
|
message_zh: string;
|
|
message_en: string;
|
|
}
|
|
|
|
export const apiNotification = {
|
|
/**
|
|
* Test a configured provider by index
|
|
*/
|
|
async testProvider(request: TestProviderRequest) {
|
|
const { data } = await axios.post<TestResponse>(
|
|
'api/v1/notification/test',
|
|
request
|
|
);
|
|
return { data };
|
|
},
|
|
|
|
/**
|
|
* Test an unsaved provider configuration
|
|
*/
|
|
async testProviderConfig(request: TestProviderConfigRequest) {
|
|
const { data } = await axios.post<TestResponse>(
|
|
'api/v1/notification/test-config',
|
|
request
|
|
);
|
|
return { data };
|
|
},
|
|
};
|