Externalize more resources, implement Content-Security-Policy headers

This commit is contained in:
Raphael Michel
2016-04-10 17:30:24 +02:00
parent 5cca426cd3
commit 02fb27fa5d
19 changed files with 494 additions and 297 deletions

View File

@@ -1,4 +1,4 @@
/*global $, stripe_pubkey, stripe_loadingmessage */
/*global $, stripe_pubkey, stripe_loadingmessage, gettext */
'use strict';
var Stripe = null;
@@ -44,7 +44,7 @@ var pretixstripe = {
}
},
'request': function () {
waitingDialog.show(stripe_loading_message);
waitingDialog.show(gettext("Contacting Stripe…"));
$(".stripe-errors").hide();
Stripe.card.createToken(
{
@@ -80,7 +80,7 @@ var pretixstripe = {
url: 'https://js.stripe.com/v2/',
dataType: 'script',
success: function () {
Stripe.setPublishableKey(stripe_pubkey);
Stripe.setPublishableKey($.trim($("#stripe_pubkey").html()));
}
}
);

View File

@@ -5,7 +5,5 @@
{% compress js %}
<script type="text/javascript" src="{% static "pretixplugins/stripe/pretix-stripe.js" %}"></script>
{% endcompress %}
<script type="text/javascript">
var stripe_pubkey = '{{ settings.publishable_key }}';
var stripe_loading_message = '{% trans "Contacting Stripe…" %}';
</script>
<script type="text/plain" id="stripe_pubkey">{{ settings.publishable_key }}</script>