mirror of
https://github.com/duplicati/duplicati.git
synced 2026-05-10 09:09:39 -04:00
9f79025744
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.
29 lines
847 B
C#
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;
|
|
|
|
}
|
|
} |