This commit is contained in:
natan
2024-03-26 18:32:56 +01:00
parent b8151b1ddf
commit 5d53eddb32
62 changed files with 1267 additions and 362 deletions
@@ -132,7 +132,7 @@ namespace Duplicati.Server.WebServer.RESTMethods
Serializable.ImportExportStructure importedStructure = Backups.LoadConfiguration(configurationFile, importMetadata, getPassword);
// This will create the Duplicati-server.sqlite database file if it doesn't exist.
using (Duplicati.Server.Database.Connection connection = FIXMEGlobal.GetDatabaseConnection(advancedOptions))
using (Duplicati.Server.Database.Connection connection = FIXMEGlobal.GetDatabaseConnection(null, advancedOptions))
{
if (connection.Backups.Any(x => x.Name.Equals(importedStructure.Backup.Name, StringComparison.OrdinalIgnoreCase)))
{
@@ -24,8 +24,8 @@ namespace Duplicati.Server.WebServer.RESTMethods
{
public class RequestInfo : IDisposable
{
public HttpServer.IHttpRequest Request { get; private set; }
public HttpServer.IHttpResponse Response { get; private set; }
public HttpServer.IHttpRequest Request { get; }
public HttpServer.IHttpResponse Response { get; }
public HttpServer.Sessions.IHttpSession Session { get; private set; }
public BodyWriter BodyWriter { get; private set; }
public RequestInfo(HttpServer.IHttpRequest request, HttpServer.IHttpResponse response, HttpServer.Sessions.IHttpSession session)
@@ -24,7 +24,7 @@ using System.Collections.Generic;
namespace Duplicati.Server.WebServer.RESTMethods
{
public class ServerState : IRESTMethodGET, IRESTMethodPOST, IRESTMethodDocumented
public class ServerState : IRESTMethodPOST, IRESTMethodDocumented
{
public void GET(string key, RequestInfo info)
{
@@ -32,16 +32,17 @@ namespace Duplicati.Server.WebServer.RESTMethods
long id = 0;
long.TryParse(key, out id);
var serverStatus = new Serializable.ServerStatus();
if (info.LongPollCheck(FIXMEGlobal.StatusEventNotifyer, ref id, out isError))
{
//Make sure we do not report a higher number than the eventnotifier says
var st = new Serializable.ServerStatus();
var st = serverStatus;
st.LastEventID = id;
info.OutputOK(st);
}
else if (!isError)
{
info.OutputOK(new Serializable.ServerStatus());
info.OutputOK(serverStatus);
}
}