cloudflare-turnstile-rails 1.0.0 → 1.0.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: ae18cf79497e4415f5e55355501f6d0699bd6c697c770fc7cff4032f691b98f4
|
|
4
|
+
data.tar.gz: 995935bd9b57cfac7022a235a61109d052c6f2163f25340b675109dd9e2fce86
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a0fa9c6c4f076a8b8ad8f44687ce321c30a9715048e4a77c3bd4bcf939fa751c0ca0b9660e05eedd6745af1392e9c85f2685429e040576d255e5acb20bfdc63
|
|
7
|
+
data.tar.gz: 990129c6c08a33c5fb5d52b93d85d9d549787d88eff8751eb1b80bacd2ef6525e31db1211f34846a92ddb660a6a05c8dd192b34a7239f61d7253f63b4239df5a
|
data/README.md
CHANGED
|
@@ -39,6 +39,7 @@ Supports `Rails >= 5.0` with `Ruby >= 2.6.0`.
|
|
|
39
39
|
- [Upgrade Guide](#upgrade-guide)
|
|
40
40
|
- [Troubleshooting](#troubleshooting)
|
|
41
41
|
- [Development](#development)
|
|
42
|
+
- [Contributing](#contributing)
|
|
42
43
|
- [License](#license)
|
|
43
44
|
|
|
44
45
|
|
|
@@ -198,8 +199,8 @@ All widgets will re‑initialize automatically on Turbo navigations (`turbo:rend
|
|
|
198
199
|
|
|
199
200
|
If your Rails app still uses Turbolinks (rather than Turbo), you can add a small helper to your JavaScript pack so that remote form submissions returning HTML correctly display validation errors without a full page reload. Simply copy the file:
|
|
200
201
|
|
|
201
|
-
```
|
|
202
|
-
templates
|
|
202
|
+
```plaintext
|
|
203
|
+
templates/shared/cloudflare_turbolinks_ajax_cache.js
|
|
203
204
|
```
|
|
204
205
|
|
|
205
206
|
into your application's JavaScript entrypoint (for example `app/javascript/packs/application.js`). This script listens for Rails UJS `ajax:complete` events that return HTML, caches the response as a Turbolinks snapshot, and then restores it via `Turbolinks.visit`, ensuring forms with validation errors are re‑rendered seamlessly.
|
|
@@ -357,7 +358,7 @@ If you run into any issues after upgrading Rails, please [open an issue](https:/
|
|
|
357
358
|
- When using Rails' CSP nonces, make sure `content_security_policy_nonce` is available in your view context — otherwise the Turnstile script may be blocked.
|
|
358
359
|
|
|
359
360
|
**Server Validation Errors**
|
|
360
|
-
- Validation failures (invalid, expired, or already‑used tokens) surface as model errors. Consult Cloudflare's [server-side troubleshooting](https://developers.cloudflare.com/turnstile/troubleshooting/testing/) for common [error codes](https://developers.cloudflare.com/turnstile/troubleshooting/client-side-errors/error-codes/) and [test keys](https://developers.cloudflare.com/turnstile/troubleshooting/testing/#
|
|
361
|
+
- Validation failures (invalid, expired, or already‑used tokens) surface as model errors. Consult Cloudflare's [server-side troubleshooting](https://developers.cloudflare.com/turnstile/troubleshooting/testing/) for common [error codes](https://developers.cloudflare.com/turnstile/troubleshooting/client-side-errors/error-codes/) and [test keys](https://developers.cloudflare.com/turnstile/troubleshooting/testing/#test-sitekeys).
|
|
361
362
|
|
|
362
363
|
> Still stuck? Check the Cloudflare Turnstile docs: [https://developers.cloudflare.com/turnstile/get-started/](https://developers.cloudflare.com/turnstile/get-started/)
|
|
363
364
|
|
|
@@ -405,7 +406,7 @@ rails new test_app \
|
|
|
405
406
|
-m templates/template.rb
|
|
406
407
|
```
|
|
407
408
|
|
|
408
|
-
Get the exact command from the `test/integration/` folder, where each integration test has a corresponding Rails app template. For example, to replicate the `test/integration/
|
|
409
|
+
Get the exact command from the `test/integration/` folder, where each integration test has a corresponding Rails app template. For example, to replicate the `test/integration/rails7_template_test.rb` test for Rails `v7.0.4`, run:
|
|
409
410
|
|
|
410
411
|
```bash
|
|
411
412
|
gem install rails -v 7.0.4
|
|
@@ -13,8 +13,14 @@
|
|
|
13
13
|
el = elements[i];
|
|
14
14
|
|
|
15
15
|
if (!el.dataset.initialized && el.childElementCount === 0) {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
try {
|
|
17
|
+
turnstile.render(el);
|
|
18
|
+
el.dataset.initialized = 'true';
|
|
19
|
+
}
|
|
20
|
+
catch (e) {
|
|
21
|
+
// eslint-disable-next-line no-console
|
|
22
|
+
console.warn('cloudflare-turnstile-rails: turnstile.render failed', e);
|
|
23
|
+
}
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
26
|
}
|
|
@@ -5,6 +5,8 @@ module Cloudflare
|
|
|
5
5
|
engine_name 'cloudflare_turnstile_rails'
|
|
6
6
|
|
|
7
7
|
initializer 'cloudflare_turnstile.assets' do |app|
|
|
8
|
+
next unless app.config.respond_to?(:assets)
|
|
9
|
+
|
|
8
10
|
js_path = ::Cloudflare::Turnstile::Rails::Engine.root.join(
|
|
9
11
|
'lib', 'cloudflare', 'turnstile', 'rails', 'assets', 'javascripts'
|
|
10
12
|
)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudflare-turnstile-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vadim Kononov
|
|
@@ -10,7 +10,35 @@ cert_chain: []
|
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
13
|
+
name: actionpack
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '5.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '5.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: actionview
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '5.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '5.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: railties
|
|
14
42
|
requirement: !ruby/object:Gem::Requirement
|
|
15
43
|
requirements:
|
|
16
44
|
- - ">="
|
|
@@ -88,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
88
116
|
- !ruby/object:Gem::Version
|
|
89
117
|
version: '0'
|
|
90
118
|
requirements: []
|
|
91
|
-
rubygems_version:
|
|
119
|
+
rubygems_version: 4.0.6
|
|
92
120
|
specification_version: 4
|
|
93
121
|
summary: Cloudflare Turnstile gem for Rails with built-in Turbo and Turbolinks support
|
|
94
122
|
and CSP compliance
|