mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
impl #1230
This commit is contained in:
@@ -147,7 +147,7 @@ internal sealed partial class DailyNoteService : IDailyNoteService, IRecipient<U
|
||||
// 发送通知必须早于数据库更新,否则会导致通知重复
|
||||
await dailyNoteNotificationOperation.SendAsync(entry).ConfigureAwait(false);
|
||||
await dailyNoteDbService.UpdateDailyNoteEntryAsync(entry).ConfigureAwait(false);
|
||||
await dailyNoteWebhookOperation.TryPostDailyNoteToWebhookAsync(dailyNote).ConfigureAwait(false);
|
||||
await dailyNoteWebhookOperation.TryPostDailyNoteToWebhookAsync(entry.Uid, dailyNote).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT license.
|
||||
|
||||
using Snap.Hutao.Core.DependencyInjection.Annotation.HttpClient;
|
||||
using Snap.Hutao.Web.Hoyolab;
|
||||
using Snap.Hutao.Web.Request.Builder;
|
||||
using Snap.Hutao.Web.Request.Builder.Abstraction;
|
||||
using System.Net.Http;
|
||||
@@ -18,7 +19,7 @@ internal sealed partial class DailyNoteWebhookOperation
|
||||
private readonly DailyNoteOptions dailyNoteOptions;
|
||||
private readonly HttpClient httpClient;
|
||||
|
||||
public async ValueTask TryPostDailyNoteToWebhookAsync(WebDailyNote dailyNote, CancellationToken token = default)
|
||||
public async ValueTask TryPostDailyNoteToWebhookAsync(PlayerUid playerUid, WebDailyNote dailyNote, CancellationToken token = default)
|
||||
{
|
||||
string? targetUrl = dailyNoteOptions.WebhookUrl;
|
||||
if (string.IsNullOrEmpty(targetUrl) || !Uri.TryCreate(targetUrl, UriKind.Absolute, out Uri? targetUri))
|
||||
@@ -28,6 +29,7 @@ internal sealed partial class DailyNoteWebhookOperation
|
||||
|
||||
HttpRequestMessageBuilder builder = httpRequestMessageBuilderFactory.Create()
|
||||
.SetRequestUri(targetUri)
|
||||
.SetHeader("x-uid", $"{playerUid}")
|
||||
.PostJson(dailyNote);
|
||||
|
||||
await builder.TryCatchSendAsync(httpClient, logger, token).ConfigureAwait(false);
|
||||
|
||||
@@ -73,11 +73,11 @@ internal sealed partial class UpdateService : IUpdateService
|
||||
public async ValueTask LaunchUpdaterAsync()
|
||||
{
|
||||
RuntimeOptions runtimeOptions = serviceProvider.GetRequiredService<RuntimeOptions>();
|
||||
string updatetTargetPath = runtimeOptions.GetDataFolderUpdateCacheFolderFile(UpdaterFilename);
|
||||
string updaterTargetPath = runtimeOptions.GetDataFolderUpdateCacheFolderFile(UpdaterFilename);
|
||||
|
||||
Uri updaterSourceUri = $"ms-appx:///{UpdaterFilename}".ToUri();
|
||||
StorageFile updaterFile = await StorageFile.GetFileFromApplicationUriAsync(updaterSourceUri);
|
||||
await updaterFile.OverwriteCopyAsync(updatetTargetPath).ConfigureAwait(false);
|
||||
await updaterFile.OverwriteCopyAsync(updaterTargetPath).ConfigureAwait(false);
|
||||
|
||||
string commandLine = new CommandLineBuilder()
|
||||
.Append("--package-path", GetUpdatePackagePath(runtimeOptions))
|
||||
@@ -89,7 +89,7 @@ internal sealed partial class UpdateService : IUpdateService
|
||||
{
|
||||
Arguments = commandLine,
|
||||
WindowStyle = ProcessWindowStyle.Minimized,
|
||||
FileName = updatetTargetPath,
|
||||
FileName = updaterTargetPath,
|
||||
UseShellExecute = true,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user