wovnrb 2.5.1 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wovnrb/api_translator.rb +1 -1
- data/lib/wovnrb/services/html_converter.rb +5 -1
- data/lib/wovnrb/store.rb +2 -2
- data/lib/wovnrb/version.rb +1 -1
- data/test/lib/services/html_converter_test.rb +8 -2
- data/test/lib/store_test.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87e1de8bb4d4e0aacac97628ff3f02cc52756f710897e92124d9c05019125fe3
|
4
|
+
data.tar.gz: 4cfa377c062238076d77f77e1dc4d8b4a1f539fb78751b8b3a846e0fe70b3269
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb76b8e1d6049620933f25f7921940fd6006b04fda13fba82f86f414906878c6c6c84d93918935a9ab2548c525fb116000e8480cac5c444265f92bdffaf38b5f
|
7
|
+
data.tar.gz: 1771496f33d419c64fdf3b3be112db32e5dc8d788c3f4cd3dc14ee3e25e272106dc8d93cd86df5e8fe56dde2ec1e2ba1efa60575b5054fb6223a674f1f833af3
|
@@ -142,10 +142,14 @@ module Wovnrb
|
|
142
142
|
# Remove wovn snippet code from dom
|
143
143
|
def strip_snippet
|
144
144
|
@dom.xpath('//script').each do |script_node|
|
145
|
-
script_node.remove if script_node['src'] && script_node['src']
|
145
|
+
script_node.remove if (script_node['src'] && widget_urls.any? { |url| script_node['src'].include? url }) || script_node['data-wovnio'].present?
|
146
146
|
end
|
147
147
|
end
|
148
148
|
|
149
|
+
def widget_urls
|
150
|
+
[@store.settings['api_url'] + '/widget', 'j.wovn.io', 'j.dev-wovn.io:3000']
|
151
|
+
end
|
152
|
+
|
149
153
|
def insert_snippet(adds_backend_error_mark = true)
|
150
154
|
parent_node = @dom.at_css('head') || @dom.at_css('body') || @dom.at_css('html')
|
151
155
|
return unless parent_node
|
data/lib/wovnrb/store.rb
CHANGED
@@ -23,7 +23,7 @@ module Wovnrb
|
|
23
23
|
'lang_param_name' => 'wovn',
|
24
24
|
'query' => [],
|
25
25
|
'ignore_class' => [],
|
26
|
-
'api_url' => 'https://wovn.global.ssl.fastly.net
|
26
|
+
'api_url' => 'https://wovn.global.ssl.fastly.net',
|
27
27
|
'api_timeout_seconds' => 1.0,
|
28
28
|
'default_lang' => 'en',
|
29
29
|
'supported_langs' => ['en'],
|
@@ -157,7 +157,7 @@ module Wovnrb
|
|
157
157
|
|
158
158
|
if @settings['wovn_dev_mode']
|
159
159
|
if @settings['api_url'] == self.class.default_settings['api_url']
|
160
|
-
@settings['api_url'] = 'http://dev-wovn.io:3001
|
160
|
+
@settings['api_url'] = 'http://dev-wovn.io:3001'
|
161
161
|
end
|
162
162
|
|
163
163
|
if @settings['api_timeout_seconds'] == self.class.default_settings['api_timeout_seconds']
|
data/lib/wovnrb/version.rb
CHANGED
@@ -154,11 +154,17 @@ module Wovnrb
|
|
154
154
|
end
|
155
155
|
|
156
156
|
def test_replace_snippet
|
157
|
-
converter = prepare_html_converter('<html><head
|
157
|
+
converter = prepare_html_converter('<html><head>
|
158
|
+
<script src="/a"></script>
|
159
|
+
<script src="//j.wovn.io/1" async="true">
|
160
|
+
<script src="//j.wovn.io/1" data-wovnio="key=2wpv0n" async></script>
|
161
|
+
<script src="https//cdn.wovn.io/" data-wovnio="key=2wpv0n async></script>
|
162
|
+
<script src="https://wovn.global.ssl.fastly.net/widget/abcdef></script>
|
163
|
+
</head></html>')
|
158
164
|
converter.send(:replace_snippet)
|
159
165
|
|
160
166
|
expected_html = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"//j.wovn.io/1\" async=\"true\" data-wovnio=\"key=123456&backend=true&currentLang=en&defaultLang=en&urlPattern=query&langCodeAliases={}&langParamName=wovn&version=WOVN.rb_#{VERSION}\" data-wovnio-type=\"fallback_snippet\"></script><script src=\"/a\"></script></head><body></body></html>"
|
161
|
-
assert_equal(expected_html, converter.send(:html))
|
167
|
+
assert_equal(expected_html.gsub(/\s+/, ''), converter.send(:html).gsub(/\s+/, ''))
|
162
168
|
end
|
163
169
|
|
164
170
|
def test_replace_hreflangs
|
data/test/lib/store_test.rb
CHANGED
@@ -133,7 +133,7 @@ module Wovnrb
|
|
133
133
|
|
134
134
|
assert(store.dev_mode?)
|
135
135
|
assert_equal('dev-wovn.io', store.wovn_host)
|
136
|
-
assert_equal('http://dev-wovn.io:3001
|
136
|
+
assert_equal('http://dev-wovn.io:3001', store.settings['api_url'])
|
137
137
|
assert_equal(3, store.settings['api_timeout_seconds'])
|
138
138
|
end
|
139
139
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wovnrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeff Sandford
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -463,7 +463,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
463
463
|
- !ruby/object:Gem::Version
|
464
464
|
version: '0'
|
465
465
|
requirements: []
|
466
|
-
|
466
|
+
rubyforge_project:
|
467
|
+
rubygems_version: 2.7.6.2
|
467
468
|
signing_key:
|
468
469
|
specification_version: 4
|
469
470
|
summary: Gem for WOVN.io
|