From 9259bc36791a7084ae33bcf0a698101ddb24d28f Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 5 Dec 2019 18:06:21 +0200 Subject: Integrated CDN downloads to PPC and MS. --- .../Controllers/MachineStudioController.cs | 10 ++++++++++ .../Web/Tango.MachineService/Controllers/PPCController.cs | 12 +++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers') diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs index dd8401570..2eeaa6e0e 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/MachineStudioController.cs @@ -99,6 +99,11 @@ namespace Tango.MachineService.Controllers response.BlobAddress = blob.GenerateReadSignature(TimeSpan.FromMinutes(60)); + if (!String.IsNullOrWhiteSpace(MachineServiceConfig.CDN_ENDPOINT)) + { + response.CdnAddress = MachineServiceConfig.CDN_ENDPOINT + blob.Uri.AbsolutePath; + } + response.IsUpdateAvailable = true; response.Version = latestVersion.Version; response.Comments = latestVersion.Comments; @@ -133,6 +138,11 @@ namespace Tango.MachineService.Controllers var container = manager.GetContainer(MachineServiceConfig.MACHINE_STUDIO_VERSIONS_CONTAINER); var blob = container.GetBlockBlobReference(latestVersion.BlobName); + if (!String.IsNullOrWhiteSpace(MachineServiceConfig.CDN_ENDPOINT)) + { + response.CdnAddress = MachineServiceConfig.CDN_ENDPOINT + blob.Uri.AbsolutePath; + } + response.BlobAddress = blob.GenerateReadSignature(TimeSpan.FromMinutes(60)); response.Version = latestVersion.Version; } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 4c39aad80..f0239978f 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -32,7 +32,7 @@ namespace Tango.MachineService.Controllers private static List _pendingUploads; private static List _pendingUpdates; private ActiveDirectoryManager _ad_manager; - private const int SQL_TEMP_CREDENTIALS_EXP_MINUTS = 20; + private const int SQL_TEMP_CREDENTIALS_EXP_MINUTS = 20; public class TokenObject { @@ -114,6 +114,11 @@ namespace Tango.MachineService.Controllers response.BlobAddress = blob.GenerateReadSignature(TimeSpan.FromMinutes(60)); + if (!String.IsNullOrWhiteSpace(MachineServiceConfig.CDN_ENDPOINT)) + { + response.CdnAddress = MachineServiceConfig.CDN_ENDPOINT + blob.Uri.AbsolutePath; + } + DbCredentials credentials = new DbCredentials(); using (SmoManager smo = new SmoManager()) @@ -197,6 +202,11 @@ namespace Tango.MachineService.Controllers response.BlobAddress = blob.GenerateReadSignature(TimeSpan.FromMinutes(60)); + if (!String.IsNullOrWhiteSpace(MachineServiceConfig.CDN_ENDPOINT)) + { + response.CdnAddress = MachineServiceConfig.CDN_ENDPOINT + blob.Uri.AbsolutePath; + } + DbCredentials credentials = new DbCredentials(); using (SmoManager smo = new SmoManager()) -- cgit v1.3.1