Skip to content

Commit a960aaa

Browse files
Hello Altcha
Co-authored-by: tobihagemann <[email protected]>
1 parent 8ba84fe commit a960aaa

File tree

19 files changed

+214
-171
lines changed

19 files changed

+214
-171
lines changed

assets/js/cardpayments.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
"use strict";
22

3-
const STRIPE_PK = 'pk_live_eSasX216vGvC26GdbVwA011V';
4-
const STRIPE_PLANS = {'EUR': 'plan_GgW4ovr7c6upzx', 'USD': 'plan_GejOEdJtfL3kdH'}; // live
5-
const STRIPE_PHP_URL = 'https://api.cryptomator.org/stripe/prepare_payment.php';
6-
7-
//const STRIPE_PK = 'pk_test_JhF3MoFQGw2Is0DB3BSv345P';
8-
//const STRIPE_PLANS = {'EUR': 'plan_GgVY2JfD49bc02', 'USD': 'plan_GgVZwj545E0uH3'}; // test
9-
//const STRIPE_PHP_URL = 'http://localhost/stripe/prepare_payment.php';
3+
// requires store.js
104

115
class OneTimePayment {
126

137
/**
148
* Initializes the one-time payments helper and stores a references to the status object that can be observed by AlpineJS
159
* @param {Object} status
1610
* @param {boolean} status.validCardNum Whether the Stripe input field considers the credit card number valid
17-
* @param {string} status.captcha The captcha (if reCAPTCHA validation finished) or null
11+
* @param {string} status.captcha The captcha (if captcha validation finished) or null
1812
* @param {string} status.errorMessage An error message or null
1913
* @param {boolean} status.inProgress Whether an async payment task is currently running
2014
* @param {boolean} status.success Whether the payment succeeded
@@ -127,21 +121,13 @@ class OneTimePayment {
127121
this._status.success = false;
128122
this._status.errorMessage = error.message;
129123
this._status.inProgress = false;
130-
if (grecaptcha) {
131-
this._status.captcha = '';
132-
grecaptcha.reset();
133-
}
134124
}
135125

136126
onPaymentSucceeded() {
137127
console.info('Stripe payment succeeded!');
138128
this._status.success = true;
139129
this._status.errorMessage = '';
140130
this._status.inProgress = false;
141-
if (grecaptcha) {
142-
this._status.captcha = '';
143-
grecaptcha.reset();
144-
}
145131
}
146132

147133
}

assets/js/recaptcha.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

assets/js/store.dev.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ const PADDLE_HUB_SELF_HOSTED_SUBSCRIPTION_PLAN_ID = 23141;
88
const PADDLE_HUB_MANAGED_SUBSCRIPTION_PLAN_ID = 42235;
99
const PADDLE_PRICES_URL = 'https://sandbox-checkout.paddle.com/api/2.0/prices';
1010
const STORE_API_URL = 'http://localhost:8787/api';
11+
const STRIPE_PK = 'pk_test_JhF3MoFQGw2Is0DB3BSv345P';
12+
const STRIPE_PLANS = {'EUR': 'plan_GgVY2JfD49bc02', 'USD': 'plan_GgVZwj545E0uH3'};
13+
const STRIPE_PHP_URL = 'http://localhost/stripe/prepare_payment.php';

assets/js/store.prod.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ const PADDLE_HUB_SELF_HOSTED_SUBSCRIPTION_PLAN_ID = 770132;
88
const PADDLE_HUB_MANAGED_SUBSCRIPTION_PLAN_ID = 807339;
99
const PADDLE_PRICES_URL = 'https://checkout.paddle.com/api/2.0/prices';
1010
const STORE_API_URL = 'https://store.cryptomator.org/api';
11+
const STRIPE_PK = 'pk_live_eSasX216vGvC26GdbVwA011V';
12+
const STRIPE_PLANS = {'EUR': 'plan_GgW4ovr7c6upzx', 'USD': 'plan_GejOEdJtfL3kdH'};
13+
const STRIPE_PHP_URL = 'https://api.cryptomator.org/stripe/prepare_payment.php';

hugo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ enableemoji = true
5757
source = "node_modules/js-yaml/dist"
5858
target = "assets/js/js-yaml"
5959

60+
[[module.mounts]]
61+
source = "node_modules/altcha/dist_external"
62+
target = "assets/js/altcha"
63+
6064
[markup.goldmark.renderer]
6165
unsafe = true
6266

@@ -121,6 +125,6 @@ block = true
121125
[[server.headers]]
122126
for = '/**'
123127
[server.headers.values]
124-
Content-Security-Policy = "default-src 'none'; script-src 'self' 'unsafe-eval' https://umami.skymatic.de/ https://plausible.skymatic.de/ https://community.cryptomator.org/ https://js.stripe.com/ https://*.paddle.com/ https://www.google.com/ https://www.gstatic.com/; style-src 'self' 'unsafe-inline' https://*.paddle.com/; img-src 'self' data: https://static.cryptomator.org/ https://*.paddle.com/ https://paddle.s3.amazonaws.com/; connect-src 'self' https://api.cryptomator.org/ https://store.cryptomator.org/ https://umami.skymatic.de/ https://plausible.skymatic.de/ http://localhost:8787/; font-src 'self'; media-src https://static.cryptomator.org/; frame-src https://community.cryptomator.org/ https://js.stripe.com/ https://*.paddle.com/ https://www.google.com/; base-uri 'self'; form-action 'self' https://www.paypal.com/ https://www.coinpayments.net/; frame-ancestors 'none'"
128+
Content-Security-Policy = "default-src 'none'; script-src 'self' 'unsafe-eval' https://umami.skymatic.de/ https://plausible.skymatic.de/ https://community.cryptomator.org/ https://js.stripe.com/ https://*.paddle.com/; style-src 'self' 'unsafe-inline' https://*.paddle.com/; img-src 'self' data: https://static.cryptomator.org/ https://*.paddle.com/ https://paddle.s3.amazonaws.com/; connect-src 'self' https://api.cryptomator.org/ https://store.cryptomator.org/ https://umami.skymatic.de/ https://plausible.skymatic.de/ http://localhost:8787/ http://localhost/; font-src 'self'; media-src https://static.cryptomator.org/; frame-src https://community.cryptomator.org/ https://js.stripe.com/ https://*.paddle.com/; base-uri 'self'; form-action 'self' https://www.paypal.com/ https://www.coinpayments.net/; frame-ancestors 'none';"
125129
Strict-Transport-Security = "max-age=31536000; includeSubDomains"
126130
X-Content-Type-Options = "nosniff"

i18n/de.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@
135135
translation: "Kreditkartenzahlungen werden über Stripe abgewickelt. Wir können dabei weder deine Kartennummer noch die Prüfziffer einsehen. In deiner Abrechnung wird <a class=\"text-link\" href=\"https://support.stripe.com/questions/unknown-charge-on-card-from-stripe\" target=\"_blank\" rel=\"noopener\">eine Buchung von Stripe</a> enthalten sein."
136136
- id: donate_creditcard_once_loading
137137
translation: "Lädt…"
138-
- id: donate_creditcard_once_loadcaptcha
139-
translation: "Weiter…"
140138
- id: donate_creditcard_once_paynow
141139
translation: "Jetzt bezahlen"
142140
- id: donate_creditcard_once_success
@@ -447,8 +445,6 @@
447445
translation: "Um auf deine Abonnement-Informationen zuzugreifen, wird ein Bestätigungslink an die E-Mail-Adresse gesendet, die du für den Kauf verwendet hast."
448446
- id: hub_billing_createsession_success_description
449447
translation: "Bitte überprüfe deine E-Mails auf den Link zur Verwaltung deines Hub-Abonnements."
450-
- id: hub_billing_createsession_loadcaptcha
451-
translation: "Weiter…"
452448
- id: hub_billing_createsession_submit
453449
translation: "Zugang anfordern"
454450

@@ -586,8 +582,6 @@
586582

587583
- id: hub_demo_instruction
588584
translation: "Demo-Instanzen werden automatisch erstellt. Es gibt eine begrenzte Anzahl von Demo-Instanzen. Alle Demo-Instanzen werden um 00:00 UTC zurückgesetzt."
589-
- id: hub_demo_loadcaptcha
590-
translation: "Weiter…"
591585
- id: hub_demo_submit
592586
translation: "Demo ausprobieren"
593587
- id: hub_demo_success_title
@@ -928,8 +922,6 @@
928922
translation: "E-Mail"
929923
- id: supporter_cert_common_email_placeholder
930924
translation: "E-Mail-Adresse"
931-
- id: supporter_cert_common_loadcaptcha
932-
translation: "Weiter…"
933925
- id: supporter_cert_common_submit
934926
translation: "Anfrage senden"
935927
- id: supporter_cert_common_success_title
@@ -995,3 +987,17 @@
995987
translation: "Wir haben dir die Details zu deinen vergangenen Transaktionen und Lizenzen per E-Mail zugesandt."
996988
- id: supporter_cert_recovery_contact_us
997989
translation: "Wenn du keine E-Mail bekommen hast, <a class=\"text-link\" href=\"mailto:[email protected]\">kontaktiere uns</a>."
990+
991+
# Altcha
992+
- id: altcha_label
993+
translation: "Ich bin kein Bot"
994+
- id: altcha_error
995+
translation: "Verifizierung fehlgeschlagen. Versuche es später erneut."
996+
- id: altcha_expired
997+
translation: "Verifizierung abgelaufen. Bitte erneut versuchen."
998+
- id: altcha_verified
999+
translation: "Verifiziert!"
1000+
- id: altcha_verifying
1001+
translation: "Verifizierung läuft…"
1002+
- id: altcha_waitAlert
1003+
translation: "Verifizierung läuft… bitte warten."

i18n/en.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@
135135
translation: "Credit card payments are securely handled by Stripe. We will not be able to see your card number or CVC. Please expect to be <a class=\"text-link\" href=\"https://support.stripe.com/questions/unknown-charge-on-card-from-stripe\" target=\"_blank\" rel=\"noopener\">charged by Stripe</a>."
136136
- id: donate_creditcard_once_loading
137137
translation: "Loading…"
138-
- id: donate_creditcard_once_loadcaptcha
139-
translation: "Continue…"
140138
- id: donate_creditcard_once_paynow
141139
translation: "Pay Now"
142140
- id: donate_creditcard_once_success
@@ -447,8 +445,6 @@
447445
translation: "To access your subscription information, a confirmation link will be sent to the email you used to make your purchase."
448446
- id: hub_billing_createsession_success_description
449447
translation: "Please check your email for the link to manage your Hub subscription."
450-
- id: hub_billing_createsession_loadcaptcha
451-
translation: "Continue…"
452448
- id: hub_billing_createsession_submit
453449
translation: "Request Access"
454450

@@ -586,8 +582,6 @@
586582

587583
- id: hub_demo_instruction
588584
translation: "Demo instances are created automatically. There are a limited number of demo instances available. All demo instances are reset at 00:00 UTC."
589-
- id: hub_demo_loadcaptcha
590-
translation: "Continue…"
591585
- id: hub_demo_submit
592586
translation: "Try Demo"
593587
- id: hub_demo_success_title
@@ -928,8 +922,6 @@
928922
translation: "Email"
929923
- id: supporter_cert_common_email_placeholder
930924
translation: "Email address"
931-
- id: supporter_cert_common_loadcaptcha
932-
translation: "Continue…"
933925
- id: supporter_cert_common_submit
934926
translation: "Send Request"
935927
- id: supporter_cert_common_success_title
@@ -995,3 +987,17 @@
995987
translation: "We've sent details of your past transactions and licenses to you via email."
996988
- id: supporter_cert_recovery_contact_us
997989
translation: "If you didn't get an email, <a class=\"text-link\" href=\"mailto:[email protected]\">contact us</a>."
990+
991+
# Altcha
992+
- id: altcha_label
993+
translation: "I\\'m not a bot"
994+
- id: altcha_error
995+
translation: "Verification failed. Try again later."
996+
- id: altcha_expired
997+
translation: "Verification expired. Try again."
998+
- id: altcha_verified
999+
translation: "Verified!"
1000+
- id: altcha_verifying
1001+
translation: "Verifying…"
1002+
- id: altcha_waitAlert
1003+
translation: "Verifying… please wait."

layouts/donate/list.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,25 @@ <h3 class="font-headline text-xl md:text-2xl leading-relaxed mb-4">{{ i18n "dona
7070
{{ end }}
7171
{{ define "script" }}
7272
{{ if hugo.IsDevelopment }}
73+
{{ $storeJs := resources.Get "js/store.dev.js" | resources.ExecuteAsTemplate "js/store.js" . }}
74+
<script type="text/javascript" src="{{ $storeJs.RelPermalink }}" defer></script>
7375
{{ $customerPortalJs := resources.Get "js/customerportal.js" }}
7476
<script type="text/javascript" src="{{ $customerPortalJs.RelPermalink }}" defer></script>
75-
{{ $recaptchaJs := resources.Get "js/recaptcha.js" }}
76-
<script type="text/javascript" src="{{ $recaptchaJs.RelPermalink }}" defer></script>
77+
{{ $altchaJs := resources.Get "js/altcha/altcha.js" }}
78+
<script type="module" type="text/javascript" src="{{ $altchaJs.RelPermalink }}" defer></script>
79+
{{ $altchaWorkerJs := resources.Get "js/altcha/worker.js" }}
80+
<script type="module" type="text/javascript" src="{{ $altchaWorkerJs.RelPermalink }}" defer></script>
7781
{{ $cardPaymentsJs := resources.Get "js/cardpayments.js" }}
7882
<script type="text/javascript" src="{{ $cardPaymentsJs.RelPermalink }}" defer></script>
7983
{{ else }}
84+
{{ $storeJs := resources.Get "js/store.prod.js" | resources.ExecuteAsTemplate "js/store.js" . | minify | fingerprint }}
85+
<script type="text/javascript" src="{{ $storeJs.RelPermalink }}" integrity="{{ $storeJs.Data.Integrity }}" defer></script>
8086
{{ $customerPortalJs := resources.Get "js/customerportal.js" | minify | fingerprint }}
8187
<script type="text/javascript" src="{{ $customerPortalJs.RelPermalink }}" integrity="{{ $customerPortalJs.Data.Integrity }}" defer></script>
82-
{{ $recaptchaJs := resources.Get "js/recaptcha.js" | minify | fingerprint }}
83-
<script type="text/javascript" src="{{ $recaptchaJs.RelPermalink }}" integrity="{{ $recaptchaJs.Data.Integrity }}" defer></script>
88+
{{ $altchaJs := resources.Get "js/altcha/altcha.js" }}
89+
<script type="module" type="text/javascript" src="{{ $altchaJs.RelPermalink }}" integrity="{{ $altchaJs.Data.Integrity }}" defer></script>
90+
{{ $altchaWorkerJs := resources.Get "js/altcha/worker.js" }}
91+
<script type="module" type="text/javascript" src="{{ $altchaWorkerJs.RelPermalink }}" integrity="{{ $altchaWorkerJs.Data.Integrity }}" defer></script>
8492
{{ $cardPaymentsJs := resources.Get "js/cardpayments.js" | minify | fingerprint }}
8593
<script type="text/javascript" src="{{ $cardPaymentsJs.RelPermalink }}" integrity="{{ $cardPaymentsJs.Data.Integrity }}" defer></script>
8694
{{ end }}

0 commit comments

Comments
 (0)