mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Don't send the whole script result back from the API.
This commit is contained in:
parent
95ebedf89e
commit
e70d083a3f
@ -48,7 +48,7 @@ public class ScriptExecutor : IScriptExecutor
|
||||
result.InputType = ScriptInputType.Api;
|
||||
result.SenderUserName = senderUsername;
|
||||
|
||||
await SendResultsToApi(result, authToken);
|
||||
_ = await SendResultsToApi(result, authToken);
|
||||
await hubConnection.SendAsync("ScriptResultViaApi", requestID);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -78,7 +78,7 @@ public class ScriptExecutor : IScriptExecutor
|
||||
{
|
||||
return;
|
||||
}
|
||||
await hubConnection.SendAsync("ScriptResult", responseResult.ID);
|
||||
await hubConnection.SendAsync("ScriptResult", responseResult.Id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -143,7 +143,7 @@ public class ScriptExecutor : IScriptExecutor
|
||||
result.InputType = scriptInputType;
|
||||
result.SavedScriptId = savedScriptId;
|
||||
|
||||
var responseResult = await SendResultsToApi(result, expiringToken);
|
||||
_ = await SendResultsToApi(result, expiringToken);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -196,7 +196,7 @@ public class ScriptExecutor : IScriptExecutor
|
||||
}
|
||||
throw new InvalidOperationException($"Unknown shell type: {shell}");
|
||||
}
|
||||
private async Task<ScriptResult?> SendResultsToApi(object result, string expiringToken)
|
||||
private async Task<ScriptResultResponse?> SendResultsToApi(object result, string expiringToken)
|
||||
{
|
||||
var targetURL = _configService.GetConnectionInfo().Host + $"/API/ScriptResults";
|
||||
|
||||
@ -212,6 +212,6 @@ public class ScriptExecutor : IScriptExecutor
|
||||
}
|
||||
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
return JsonSerializer.Deserialize<ScriptResult>(content, JsonSerializerHelper.CaseInsensitiveOptions);
|
||||
return JsonSerializer.Deserialize<ScriptResultResponse>(content, JsonSerializerHelper.CaseInsensitiveOptions);
|
||||
}
|
||||
}
|
||||
@ -54,7 +54,7 @@ public class ScriptResultsController : ControllerBase
|
||||
|
||||
[HttpPost]
|
||||
[ServiceFilter(typeof(ExpiringTokenFilter))]
|
||||
public async Task<ActionResult<ScriptResult>> Post([FromBody] ScriptResult result)
|
||||
public async Task<ActionResult<ScriptResultResponse>> Post([FromBody] ScriptResult result)
|
||||
{
|
||||
_dataService.AddOrUpdateScriptResult(result);
|
||||
|
||||
@ -111,6 +111,9 @@ public class ScriptResultsController : ControllerBase
|
||||
await _dataService.AddScriptResultToScriptRun(result.ID, result.ScriptRunId.Value);
|
||||
}
|
||||
|
||||
return result;
|
||||
return new ScriptResultResponse()
|
||||
{
|
||||
Id = result.ID
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
11
Shared/Models/ScriptResultResponse.cs
Normal file
11
Shared/Models/ScriptResultResponse.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Remotely.Shared.Models;
|
||||
public class ScriptResultResponse
|
||||
{
|
||||
public required string Id { get; init; }
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user