From 1255cb94eab59ee23d1533f32e3180248180ec85 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 4 Feb 2015 12:03:07 -0500 Subject: [PATCH] Add force_ssl support --- static/js/app.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index 58f225172..29db85ae3 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -977,7 +977,7 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading return resource; }; - var buildUrl = function(path, parameters) { + var buildUrl = function(path, parameters, opt_forcessl) { // We already have /api/v1/ on the URLs, so remove them from the paths. path = path.substr('/api/v1/'.length, path.length); @@ -1017,6 +1017,11 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading } } + // If we are forcing SSL, return an absolutel URL with an SSL prefix. + if (opt_forcessl) { + path = 'https://' + window.location.host + '/api/v1/' + path; + } + return url; }; @@ -1155,8 +1160,8 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading var path = resource['path']; // Add the operation itself. - apiService[operationName] = function(opt_options, opt_parameters, opt_background) { - var one = Restangular.one(buildUrl(path, opt_parameters)); + apiService[operationName] = function(opt_options, opt_parameters, opt_background, opt_forcessl) { + var one = Restangular.one(buildUrl(path, opt_parameters, opt_forcessl)); if (opt_background) { one.withHttpConfig({ 'ignoreLoadingBar': true