cloudflare-turnstile-rails 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6dc1ce72ca182df1b78145dbab630dcef8370c9feeb5889031fe816c77f28cc9
|
|
4
|
+
data.tar.gz: fbe98e296d6fd63bc73bcff534199c36b80c342042c25b7d5dab90af5552122d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8fc81e538bbb4c131e8719a02910b83159fda9b21caf5faa89e97d6a561f801671c07ca14ccbe00e1dc0ff9575ee6e46adb6ec86b53c73acf620dacd1febf4b
|
|
7
|
+
data.tar.gz: d98429437a66c3f70ca2faf799c9683ceca875d64cfc04cf7699d86a87f11a7a113a160c131a2eccac064e705a5da081af5a8309fe65bccc5ead306b7979a422
|
data/README.md
CHANGED
|
@@ -14,8 +14,6 @@ Supports **Rails 5.0 → latest** and **Ruby 2.6 → latest**, with the full Rai
|
|
|
14
14
|
> [!TIP]
|
|
15
15
|
> **Using Devise?** [devise-cloudflare-turnstile](https://github.com/vkononov/devise-cloudflare-turnstile) protects every Devise form (sign in, sign up, password reset, and more) with no changes to your Devise views or controllers. It is built on this gem and shares its configuration, so you can use both to protect Devise and non-Devise forms in the same app.
|
|
16
16
|
|
|
17
|
-
[](https://www.buymeacoffee.com/vkononov)
|
|
18
|
-
|
|
19
17
|
## Features
|
|
20
18
|
|
|
21
19
|
* **One‑line integration**: `<%= cloudflare_turnstile_tag %>` in views, `valid_turnstile?(model:)` in controllers — no extra wiring.
|
|
@@ -47,10 +47,17 @@
|
|
|
47
47
|
helper.nonce = nonce;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
// In implicit mode, Turnstile renders the initial page itself.
|
|
51
|
+
if ((/[?&]render=explicit(&|$)/).test(cfUrl)) {
|
|
52
|
+
helper.addEventListener('load', reinitializeTurnstile);
|
|
53
|
+
document.addEventListener('DOMContentLoaded', reinitializeTurnstile);
|
|
54
|
+
}
|
|
55
|
+
|
|
50
56
|
document.head.appendChild(helper);
|
|
51
57
|
|
|
52
|
-
// set up
|
|
58
|
+
// set up navigation hooks only once
|
|
53
59
|
document.addEventListener('turbo:render', reinitializeTurnstile);
|
|
60
|
+
document.addEventListener('turbolinks:load', reinitializeTurnstile);
|
|
54
61
|
document.addEventListener('turbo:before-stream-render', function(event) {
|
|
55
62
|
var orig = event.detail.render.bind(event.detail);
|
|
56
63
|
|