katalyst-google-apis 1.1.0 → 1.1.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 +4 -4
- data/app/assets/javascripts/controllers/recaptcha_controller.js +37 -19
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5794e6da69ca70b6edb9a8e7bc30e75b8536d9d436422f3db7e311997aa44fee
|
|
4
|
+
data.tar.gz: 47e4870067a6c655821415606a2446f80535b76623900290c16fe35441865966
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 14b904f1003fe047a112aea03619c29a9bdca4ec9c486e4143b1c2f02d4995837d0033a1319335d4036beb53e12c6e49483d6a23c9cfdc0303711fc8bbab3d3d
|
|
7
|
+
data.tar.gz: 5d7693c3922f2573b711a033a5313b35dc0fdfb0156ee4b44f00d1c5df1316df611a9062ad1a7b1750e319b7242d34f9500d4ec4c0cac226ad841ba9de2dc521
|
|
@@ -10,25 +10,6 @@ enterprise.ready = (f) => {
|
|
|
10
10
|
(config["fns"] ||= []).push(f);
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* Inject recaptcha enterprise script into the head, unless it is already there.
|
|
15
|
-
*/
|
|
16
|
-
function injectRecaptchaScripts() {
|
|
17
|
-
if (document.head.querySelector("script[src*='recaptcha/enterprise']")) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const script = document.createElement("script");
|
|
22
|
-
script.setAttribute(
|
|
23
|
-
"src",
|
|
24
|
-
"https://www.google.com/recaptcha/enterprise.js?render=explicit",
|
|
25
|
-
);
|
|
26
|
-
script.toggleAttribute("async", true);
|
|
27
|
-
script.toggleAttribute("defer", true);
|
|
28
|
-
|
|
29
|
-
document.head.appendChild(script);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
13
|
export default class RecaptchaController extends Controller {
|
|
33
14
|
static values = {
|
|
34
15
|
siteKey: String,
|
|
@@ -122,3 +103,40 @@ export default class RecaptchaController extends Controller {
|
|
|
122
103
|
return this.element.nextElementSibling;
|
|
123
104
|
}
|
|
124
105
|
}
|
|
106
|
+
|
|
107
|
+
function getMetaElement(name) {
|
|
108
|
+
return document.querySelector(`meta[name="${name}"]`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getCspNonce() {
|
|
112
|
+
const element = getMetaElement("csp-nonce");
|
|
113
|
+
if (element) {
|
|
114
|
+
const {nonce: nonce, content: content} = element;
|
|
115
|
+
return nonce === "" ? content : nonce;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function createRecaptchaScriptElement() {
|
|
120
|
+
const element = document.createElement("script");
|
|
121
|
+
element.src = "https://www.google.com/recaptcha/enterprise.js?render=explicit";
|
|
122
|
+
const cspNonce = getCspNonce();
|
|
123
|
+
if (cspNonce) {
|
|
124
|
+
element.setAttribute("nonce", cspNonce);
|
|
125
|
+
}
|
|
126
|
+
element.async = true
|
|
127
|
+
element.defer = true
|
|
128
|
+
|
|
129
|
+
return element;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Inject recaptcha enterprise script into the head, unless it is already there.
|
|
134
|
+
*/
|
|
135
|
+
function injectRecaptchaScripts() {
|
|
136
|
+
let element = document.head.querySelector("script[src*='recaptcha/enterprise']");
|
|
137
|
+
if (!element) {
|
|
138
|
+
element = createRecaptchaScriptElement();
|
|
139
|
+
document.head.appendChild(element);
|
|
140
|
+
}
|
|
141
|
+
return element;
|
|
142
|
+
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: katalyst-google-apis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Katalyst Interactive
|
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
107
|
version: '0'
|
|
108
108
|
requirements: []
|
|
109
|
-
rubygems_version:
|
|
109
|
+
rubygems_version: 4.0.3
|
|
110
110
|
specification_version: 4
|
|
111
111
|
summary: Google REST APIs for use in Rails projects
|
|
112
112
|
test_files: []
|