Files
duplicati/Duplicati/WebserverCore/Services/UpdateService.cs
Kenneth Skovhede 9f79025744 Removed HttpServer.
Re-implemented everything using ASP.NET.
Changed some requests to use JSON instead of FORM data.
Some work towards deleting the FIXMEGlobal instance.
Auth is missing, XSRF does not work correctly.
2024-06-07 15:56:43 +02:00

29 lines
847 B
C#

using Duplicati.WebserverCore.Abstractions;
using Newtonsoft.Json;
namespace Duplicati.WebserverCore.Services;
public class UpdateService(ISettingsService settingsService, JsonSerializerSettings options, ILogger<ISettingsService> logger) : IUpdateService
{
private UpdateInfo? _updateInfo;
public UpdateInfo? GetUpdateInfo()
{
var settings = settingsService.GetSettings();
if (settings.UpdateCheckNewVersion is not { Length: > 0 } newVersion) return null;
try
{
if (_updateInfo != null)
return _updateInfo;
return _updateInfo = JsonConvert.DeserializeObject<UpdateInfo>(newVersion, options);
}
catch
{
UpdateServiceLogger.CouldNotDeserialize(logger, settings.UpdateCheckNewVersion);
}
return null;
}
}