diff --git a/dist/newsletter/index.html b/dist/newsletter/index.html index 5b91f35..cee79f6 100644 --- a/dist/newsletter/index.html +++ b/dist/newsletter/index.html @@ -85,22 +85,27 @@ this.error = ''; this.ok = false; this.loading = true; + const token = () => this.$el.querySelector('[name=cf-turnstile-response]')?.value; + for (let i = 0; i < 50 && !token(); i++) await new Promise((r) => setTimeout(r, 100)); try { const res = await fetch('https://newsletter.planetrenox.com/api/sub', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ pool: 'apophenia', email: this.email }) + body: JSON.stringify({ pool: 'apophenia', email: this.email, token: token() || '' }) }); const data = await res.json(); if (res.ok && data.ok) { this.ok = true; this.email = ''; } else { - this.error = data.error === 'invalid email' ? 'That email doesn\'t look right.' : 'Something went wrong. Please try again.'; + this.error = data.error === 'invalid email' ? 'That email doesn\'t look right.' + : data.error === 'captcha failed' ? 'Couldn\'t verify you\'re human. Please try again.' + : 'Something went wrong. Please try again.'; } } catch (e) { this.error = 'Network error. Please try again.'; } + window.turnstile?.reset(); this.loading = false; } }" @@ -126,6 +131,7 @@ +
@@ -138,6 +144,7 @@
Unsubscribe anytime. We never share your email.
+ diff --git a/dist/rss.xml b/dist/rss.xml index b338f32..e5f54ba 100644 --- a/dist/rss.xml +++ b/dist/rss.xml @@ -5,7 +5,7 @@ https://apophenia.news/