Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Agent/Services/Linux/UpdaterLinux.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ public async Task CheckForUpdates()

_logger.LogInformation("Service Updater: Update found.");

if (response.Headers.ETag is { } responseEtag)
{
await File.WriteAllTextAsync("etag.txt", responseEtag.ToString());
}

await InstallLatestVersion();

}
Expand Down
5 changes: 5 additions & 0 deletions Agent/Services/MacOS/UpdaterMac.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ public async Task CheckForUpdates()

_logger.LogInformation("Service Updater: Update found.");

if (response.Headers.ETag is { } responseEtag)
{
await File.WriteAllTextAsync("etag.txt", responseEtag.ToString());
}

await InstallLatestVersion();

}
Expand Down
6 changes: 5 additions & 1 deletion Agent/Services/Windows/UpdaterWin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,13 @@ public async Task CheckForUpdates()
return;
}


_logger.LogInformation("Service Updater: Update found.");

if (response.Headers.ETag is { } responseEtag)
{
await File.WriteAllTextAsync("etag.txt", responseEtag.ToString());
}

await InstallLatestVersion();

}
Expand Down
6 changes: 6 additions & 0 deletions Server/Components/Devices/DeviceCard.razor
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@
</ButtonContent>
</FileInputButton>
</li>
<li>
<button class="dropdown-item" @onclick="UpdateAgent" disabled="@(!Device.IsOnline)">
<i class="oi oi-cloud-download" title="Update Agent"></i>
<span class="ms-2">Update Agent</span>
</button>
</li>
<li>
<button class="dropdown-item bg-danger" @onclick="UninstallAgent">
<i class="oi oi-delete" title="Uninstall"></i>
Expand Down
6 changes: 6 additions & 0 deletions Server/Components/Devices/DeviceCard.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ private void ToggleIsSelected(ChangeEventArgs args)
}
}

private async Task UpdateAgent()
{
await CircuitConnection.UpdateAgents(new[] { Device.ID });
ToastService.ShowToast("Update command sent.");
}

private async Task UninstallAgent()
{
var result = await JsInterop.Confirm("Are you sure you want to uninstall this agent? This is permanent!");
Expand Down
9 changes: 9 additions & 0 deletions Server/Hubs/CircuitConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public interface ICircuitConnection

Task ReinstallAgents(string[] deviceIDs);

Task UpdateAgents(string[] deviceIDs);

Task<Result<RemoteControlSession>> RemoteControl(string deviceID, bool viewOnly);

Task RemoveDevices(string[] deviceIDs);
Expand Down Expand Up @@ -215,6 +217,13 @@ public async Task ReinstallAgents(string[] deviceIDs)
_dataService.RemoveDevices(deviceIDs);
}

public async Task UpdateAgents(string[] deviceIDs)
{
deviceIDs = _dataService.FilterDeviceIdsByUserPermission(deviceIDs, User);
var connections = GetActiveConnectionsForUserOrg(deviceIDs);
await _agentHubContext.Clients.Clients(connections).ReinstallAgent();
}

public async Task<Result<RemoteControlSession>> RemoteControl(string deviceId, bool viewOnly)
{
var settings = await _dataService.GetSettings();
Expand Down
Loading