Issue #745 - Add https support

This commit is contained in:
Julian Descottes 2017-09-24 14:58:31 +02:00
parent d1156954ca
commit d502d3416b
4 changed files with 17 additions and 6 deletions

View File

@ -63,6 +63,6 @@ var Constants = {
// SERVICE URLS
APPENGINE_SAVE_URL : 'save',
IMAGE_SERVICE_UPLOAD_URL : 'http://piskel-imgstore-b.appspot.com/__/upload',
IMAGE_SERVICE_GET_URL : 'http://piskel-imgstore-b.appspot.com/img/'
IMAGE_SERVICE_UPLOAD_URL : '{{protocol}}://piskel-imgstore-b.appspot.com/__/upload',
IMAGE_SERVICE_GET_URL : '{{protocol}}://piskel-imgstore-b.appspot.com/img/'
};

View File

@ -15,10 +15,17 @@
data : imageData
};
var protocol = pskl.utils.Environment.isHttps() ? 'https' : 'http';
var wrappedSuccess = function (response) {
success(Constants.IMAGE_SERVICE_GET_URL + response.responseText);
var getUrl = pskl.utils.Template.replace(Constants.IMAGE_SERVICE_GET_URL, {
protocol: protocol
});
success(getUrl + response.responseText);
};
pskl.utils.Xhr.post(Constants.IMAGE_SERVICE_UPLOAD_URL, data, wrappedSuccess, error);
var uploadUrl = pskl.utils.Template.replace(Constants.IMAGE_SERVICE_UPLOAD_URL, {
protocol: protocol
});
pskl.utils.Xhr.post(uploadUrl, data, wrappedSuccess, error);
};
})();

View File

@ -27,7 +27,11 @@
isDebug : function () {
return window.location.href.indexOf('debug') !== -1;
}
},
isHttps : function () {
return window.location.href.indexOf('https://') === 0;
},
};
})();

View File

@ -39,7 +39,7 @@
<script type="text/template" id="save-gallery-unavailable-partial">
<div class="settings-title">Save online</div>
<div class="settings-item">
<div class="save-status">Login to <a href="http://piskelapp.com" target="_blank">piskelapp.com</a> to save and share your sprites online.</div>
<div class="save-status">Login to <a href="https://www.piskelapp.com" target="_blank">piskelapp.com</a> to save and share your sprites online.</div>
</div>
</script>