Files
better-genshin-impact/BetterGenshinImpact/Service/Notification/NotificationConfig.cs
禹仔二号 6becb9dd5a 添加websocket和smtp通知方法,添加bark通知,websocket为qq机器人预留。 (#1254)
* feat: add email and websocket notification

* fix typos.

* refactor(notifiers): 重构邮件和 WebSocket 通知器

- 提升 EmailNotifier 中的 SmtpClient 为类的成员变量,并在构造函数中初始化,优化资源使用
- 改进 WebSocketNotifier 的连接和重连逻辑,提高稳定性
- 优化通知器的错误处理和日志记录,增强可维护性

* Create BarkNotifier.cs

* Update NotificationConfig.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/Notifier/BarkNotifier.cs

* Add files via upload

* Update BarkNotifier.cs

* Update NotificationService.cs

* Update CommonSettingsPageViewModel.cs

* Update CommonSettingsPage.xaml

* Delete BetterGenshinImpact/Service/BarkNotifier.cs

* Add files via upload

* Add files via upload

* Add files via upload

* Update CommonSettingsPage.xaml

* fix: 回退部分代码,修复了程序崩溃的错误

* fix: remove api.day.app

---------

Co-authored-by: 秋云 <physligl@gmail.com>
Co-authored-by: DR-lin-eng <52230594+DR-lin-eng@users.noreply.github.com>
2025-03-13 00:06:09 +08:00

116 lines
2.7 KiB
C#

using CommunityToolkit.Mvvm.ComponentModel;
using System;
using System.DirectoryServices.ActiveDirectory;
namespace BetterGenshinImpact.Service.Notification;
/// <summary>
/// 通知配置管理器
/// </summary>
[Serializable]
public partial class NotificationConfig : ObservableObject
{
[ObservableProperty]
private string _notificationEventSubscribe = string.Empty;
/// <summary>
///
/// </summary>
[ObservableProperty]
private bool _webhookEnabled;
/// <summary>
///
/// </summary>
[ObservableProperty]
private string _webhookEndpoint = string.Empty;
/// <summary>
/// 是否包含截图
/// </summary>
[ObservableProperty]
private bool _includeScreenShot = true;
/// <summary>
/// windows uwp 通知是否启用
/// </summary>
[ObservableProperty]
private bool _windowsUwpNotificationEnabled = false;
// 飞书通知
/// <summary>
/// 飞书通知是否启用
/// </summary>
[ObservableProperty]
private bool _feishuNotificationEnabled = false;
/// <summary>
/// 飞书通知地址
/// </summary>
[ObservableProperty]
private string _feishuWebhookUrl = string.Empty;
// 企业微信通知
/// <summary>
/// 企业微信通知是否启用
/// </summary>
[ObservableProperty]
private bool _workweixinNotificationEnabled = false;
/// <summary>
/// 企业微信通知通知地址
/// </summary>
[ObservableProperty]
private string _workweixinWebhookUrl = string.Empty;
[ObservableProperty]
bool _webSocketNotificationEnabled = false;
[ObservableProperty]
private string _webSocketEndpoint = string.Empty;
// Email 通知配置
[ObservableProperty]
private bool _emailNotificationEnabled = false;
[ObservableProperty]
private string _smtpServer = string.Empty;
[ObservableProperty]
private int _smtpPort;
[ObservableProperty]
private string _smtpUsername = string.Empty;
[ObservableProperty]
private string _smtpPassword = string.Empty;
[ObservableProperty]
private string _fromEmail = string.Empty;
[ObservableProperty]
private string _fromName = string.Empty;
[ObservableProperty]
private string _toEmail = string.Empty;
/// <summary>
/// Bark移动推送通知配置
/// </summary>
[ObservableProperty]
private bool _barkNotificationEnabled = false;
[ObservableProperty] private string _barkApiEndpoint = string.Empty;
[ObservableProperty]
private string _barkDeviceKeys = string.Empty;
// private string[] _barkDeviceKeys = Array.Empty<string>();
}