-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to upload custom versions of the attended support client.
- Loading branch information
Showing
15 changed files
with
408 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Remotely.Server.Services; | ||
using Remotely.Shared.Models; | ||
using Remotely.Shared.Services; | ||
|
||
namespace Remotely.Server.API; | ||
|
||
[Route("api/custom-binaries")] | ||
[ApiController] | ||
public class CustomBinariesController( | ||
IDataService _dataService, | ||
IWebHostEnvironment _hostingEnvironment, | ||
IEmbeddedServerDataProvider _embeddedData) : ControllerBase | ||
{ | ||
[HttpGet("win-x86/desktop/{organizationId}")] | ||
public async Task<IActionResult> GetWinX86Desktop(string organizationId) | ||
{ | ||
var embeddedData = await GetEmbeddedData(organizationId); | ||
var filePath = Path.Combine(_hostingEnvironment.ContentRootPath, "AppData", "Win-x86", "Remotely_Desktop.exe"); | ||
var fileName = _embeddedData.GetEncodedFileName(filePath, embeddedData); | ||
var rs = System.IO.File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); | ||
return File(rs, "application/octet-stream", fileName); | ||
} | ||
|
||
[HttpGet("win-x64/desktop/{organizationId}")] | ||
public async Task<IActionResult> GetWinX64Desktop(string organizationId) | ||
{ | ||
var embeddedData = await GetEmbeddedData(organizationId); | ||
var filePath = Path.Combine(_hostingEnvironment.ContentRootPath, "AppData", "Win-x64", "Remotely_Desktop.exe"); | ||
var fileName = _embeddedData.GetEncodedFileName(filePath, embeddedData); | ||
var rs = System.IO.File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.Read); | ||
return File(rs, "application/octet-stream", fileName); | ||
} | ||
|
||
private async Task<EmbeddedServerData> GetEmbeddedData(string? organizationId) | ||
{ | ||
var defaultOrg = await _dataService.GetDefaultOrganization(); | ||
|
||
// The default org will be used if unspecified, so might as well save the | ||
// space in the file name. | ||
if (defaultOrg.IsSuccess && | ||
defaultOrg.Value.ID.Equals(organizationId, StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
organizationId = null; | ||
} | ||
|
||
var settings = await _dataService.GetSettings(); | ||
var effectiveScheme = settings.ForceClientHttps ? "https" : Request.Scheme; | ||
var serverUrl = $"{effectiveScheme}://{Request.Host}"; | ||
return new EmbeddedServerData(new Uri(serverUrl), organizationId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.