feat: publish dbussmsforward refactor

This commit is contained in:
2026-05-08 23:54:03 +08:00
commit 9f1ee9ffe6
77 changed files with 15585 additions and 0 deletions
@@ -0,0 +1,31 @@
using DbusSmsForward.Helper;
using DbusSmsForward.Notifications;
using DbusSmsForward.ProcessSmsContent;
using DbusSmsForward.Services;
using DbusSmsForward.SettingModel;
using DbusSmsForward.SMSModel;
using System.Net.Http.Json;
using System.Text.Json.Nodes;
namespace DbusSmsForward.Notifications;
public sealed class PushPlusNotificationSender(DbusSmsForwardOptions options) : NotificationSenderBase("pushplus")
{
private readonly PushPlusConfig _config = options.Notifications.PushPlus;
public override bool IsEnabled => _config.Enabled && !string.IsNullOrWhiteSpace(_config.Token);
public override async Task SendAsync(SmsContentModel sms, string body, string deviceName, CancellationToken cancellationToken)
{
SmsCodeModel code = NotificationContentBuilder.ExtractCode(options, sms);
JsonObject payload = new()
{
["token"] = _config.Token,
["title"] = BuildTitle(sms.TelNumber, code.CodeValue),
["content"] = body,
["topic"] = string.Empty
};
await HttpHelper.PostAsync(_config.Endpoint, payload, _config.SkipTlsValidation, cancellationToken);
}
}