From e41cf5014b04a7efee53ef6ea2c71307de20e887 Mon Sep 17 00:00:00 2001 From: Stanimir Stoyanov Date: Fri, 11 Oct 2024 17:23:19 +0300 Subject: [PATCH] initial customizations --- Agent/Services/AgentHubConnection.cs | 2 +- ...ktop.Win.csproj => Desktop.Win.csproj.disabled} | 0 Remotely.sln | 14 -------------- Server/API/ScriptingController.cs | 4 +++- Server/Hubs/AgentHub.cs | 4 ++-- docker-compose/docker-compose.yml | 8 +++++--- 6 files changed, 11 insertions(+), 21 deletions(-) rename Desktop.Win/{Desktop.Win.csproj => Desktop.Win.csproj.disabled} (100%) diff --git a/Agent/Services/AgentHubConnection.cs b/Agent/Services/AgentHubConnection.cs index af0a43af..61adacbc 100644 --- a/Agent/Services/AgentHubConnection.cs +++ b/Agent/Services/AgentHubConnection.cs @@ -232,7 +232,7 @@ public class AgentHubConnection : IAgentHubConnection, IDisposable senderUsername, senderConnectionId, ScriptInputType.Terminal, - TimeSpan.FromSeconds(30), + TimeSpan.FromSeconds(30), // TODO _hubConnection) .ConfigureAwait(false); } diff --git a/Desktop.Win/Desktop.Win.csproj b/Desktop.Win/Desktop.Win.csproj.disabled similarity index 100% rename from Desktop.Win/Desktop.Win.csproj rename to Desktop.Win/Desktop.Win.csproj.disabled diff --git a/Remotely.sln b/Remotely.sln index 872e1565..f89dd963 100644 --- a/Remotely.sln +++ b/Remotely.sln @@ -29,8 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Shared", "Shared\Shared.csp EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Desktop.Linux", "Desktop.Linux\Desktop.Linux.csproj", "{FF7FD66A-B3E2-4D39-A457-A00C94EDE9E6}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Desktop.Win", "Desktop.Win\Desktop.Win.csproj", "{6B726FC4-A907-4813-BF38-3342E02AA8D2}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Server.Tests", "Tests\Server.Tests\Server.Tests.csproj", "{48D9D0E6-5781-44A9-84C0-56F56C2A1193}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LoadTester", "Tests\LoadTester\LoadTester.csproj", "{6C25240C-613D-4A86-A04E-784BA6726094}" @@ -108,18 +106,6 @@ Global {FF7FD66A-B3E2-4D39-A457-A00C94EDE9E6}.Release|x64.Build.0 = Release|x64 {FF7FD66A-B3E2-4D39-A457-A00C94EDE9E6}.Release|x86.ActiveCfg = Release|x86 {FF7FD66A-B3E2-4D39-A457-A00C94EDE9E6}.Release|x86.Build.0 = Release|x86 - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Debug|x64.ActiveCfg = Debug|x64 - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Debug|x64.Build.0 = Debug|x64 - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Debug|x86.ActiveCfg = Debug|x86 - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Debug|x86.Build.0 = Debug|x86 - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Release|Any CPU.Build.0 = Release|Any CPU - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Release|x64.ActiveCfg = Release|x64 - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Release|x64.Build.0 = Release|x64 - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Release|x86.ActiveCfg = Release|x86 - {6B726FC4-A907-4813-BF38-3342E02AA8D2}.Release|x86.Build.0 = Release|x86 {48D9D0E6-5781-44A9-84C0-56F56C2A1193}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {48D9D0E6-5781-44A9-84C0-56F56C2A1193}.Debug|Any CPU.Build.0 = Debug|Any CPU {48D9D0E6-5781-44A9-84C0-56F56C2A1193}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/Server/API/ScriptingController.cs b/Server/API/ScriptingController.cs index 06dfc96c..5dc2248a 100644 --- a/Server/API/ScriptingController.cs +++ b/Server/API/ScriptingController.cs @@ -104,7 +104,9 @@ public class ScriptingController : ControllerBase command, User?.Identity?.Name ?? "API Key"); - var success = await WaitHelper.WaitForAsync(() => AgentHub.ApiScriptResults.TryGetValue(requestID, out _), TimeSpan.FromSeconds(30)); + var success = await WaitHelper.WaitForAsync( + () => AgentHub.ApiScriptResults.TryGetValue(requestID, out _), + TimeSpan.FromSeconds(30)); // TODO if (!success) { return NotFound(); diff --git a/Server/Hubs/AgentHub.cs b/Server/Hubs/AgentHub.cs index b408b27a..14ee694f 100644 --- a/Server/Hubs/AgentHub.cs +++ b/Server/Hubs/AgentHub.cs @@ -339,9 +339,9 @@ public class AgentHub : Hub await _messenger.Send(message, $"{result.Value.SenderConnectionID}"); } - public void ScriptResultViaApi(string commandID, string requestID) + public void ScriptResultViaApi(string requestID) // PROBLEMATIC { - ApiScriptResults.Set(requestID, commandID, DateTimeOffset.Now.AddHours(1)); + ApiScriptResults.Set(requestID, requestID, DateTimeOffset.Now.AddHours(1)); } public Task SendConnectionFailedToViewers(List viewerIDs) diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index ae9391a2..18d7ac10 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -11,13 +11,15 @@ networks: services: remotely: - image: immybot/remotely:latest + build: + context: ../ + dockerfile: ./Server/Dockerfile container_name: remotely volumes: - - /var/www/remotely:/app/AppData + - /home/bot/remotely:/app/AppData restart: unless-stopped ports: - - "5000:5000" + - "5001:5000" networks: - remotely environment: