Allow trayicon without server

This adds support for starting the trayicon even if there is no server.

The trayicon will start up in a disconnected state and stay like that until it manages to connect.

This fixes Support TrayIcon running with no connection	#5993
This commit is contained in:
Kenneth Skovhede
2025-03-25 10:40:45 +01:00
parent 168afe4a85
commit fca218dc60
2 changed files with 3 additions and 5 deletions
@@ -102,7 +102,7 @@ namespace Duplicati.GUI.TrayIcon
private long m_lastDataUpdateId = -1;
private bool m_disableTrayIconLogin;
private volatile IServerStatus m_status;
private volatile IServerStatus m_status = new ServerStatusImpl(LiveControlState.Paused, SuggestedStatusIcon.Disconnected, 0, 0, 0);
private volatile bool m_shutdown = false;
private volatile Thread m_requestThread;
@@ -214,10 +214,8 @@ No password provided, unable to connect to server, exiting");
ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault;
using (Connection = new HttpServerConnection(serverURL, password, passwordSource, disableTrayIconLogin, acceptedHostCertificate, options))
{
// Make sure we have the latest status
// This will throw an exception if the server is not running,
// or the password is incorrect
Connection.UpdateStatus().Await();
// Make sure we have the latest status, but don't care if it fails
Connection.UpdateStatus().FireAndForget();
using (var tk = RunTrayIcon())
{