glib-web 0.6.2 → 0.6.6
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: 5f6803ad260efc33294f643a2a623e418a260b24b18729142aeb41f6a6d891c9
|
4
|
+
data.tar.gz: e3c581588cff960a60857cd63aa904dae41a81da4a86596b2bf17275353acca9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1de3a468c5f82b9d4ee70afc5763e1ab9f31e4ff54cbb14ed891ff546b867db084a6c5d091cc4cb70d6f75fc24b0fe052c169beb6edc4e3c3e96beefe3208574
|
7
|
+
data.tar.gz: c7cd87a3e9399c9b03730eee4a16f679af1d55eada9b0a4468129a122306a5ef54d42e4c3a9ef39617a320d38cadc00e08ca60255443abaeae6b7944034172ce
|
@@ -35,6 +35,18 @@ module Glib::Analytics
|
|
35
35
|
segment = request.headers['GApp-Analytics-Referer-Segment']
|
36
36
|
placement = request.headers['GApp-Analytics-Referer-Placement']
|
37
37
|
|
38
|
+
if group.nil? && action.nil? && !request.headers['referer'].nil?
|
39
|
+
if request.headers['referer'].start_with?("http://#{request.host}",
|
40
|
+
"https://#{request.host}",
|
41
|
+
"http://www.#{request.host}",
|
42
|
+
"https://www.#{request.host}")
|
43
|
+
|
44
|
+
route = Rails.application.routes.recognize_path(request.headers['referer'].delete_suffix('/'))
|
45
|
+
group = route[:controller]
|
46
|
+
action = route[:action]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
38
50
|
if group && action
|
39
51
|
return { group: group, action: action, segment: segment, placement: placement }
|
40
52
|
end
|
@@ -102,7 +102,7 @@ module Glib
|
|
102
102
|
if (code = response.code) == 302
|
103
103
|
redirect_uri = URI(response.headers['Location'])
|
104
104
|
redirect_uri.query = [redirect_uri.query, 'format=json'].compact.join('&')
|
105
|
-
get redirect_uri.to_s, action, params if
|
105
|
+
get redirect_uri.to_s, action, params if router.allowed?(redirect_uri.to_s)
|
106
106
|
else
|
107
107
|
response_times << response.headers['X-Runtime'].to_f
|
108
108
|
|
@@ -54,9 +54,11 @@ module Glib
|
|
54
54
|
when 'runMultiple-v1', 'runMultiple'
|
55
55
|
JsonCrawler::RunMultiple.new(http, params, action)
|
56
56
|
when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1', 'windows/open', 'dialogs/open', 'windows/reload', 'windows/openWeb', 'windows/openWeb-v1'
|
57
|
-
if params['url']
|
57
|
+
if allowed?(params['url'])
|
58
58
|
@read_only_actions.add([action, params['url']])
|
59
59
|
JsonCrawler::WindowsOpen.new(http, params, action)
|
60
|
+
else
|
61
|
+
self.log action, params['url']
|
60
62
|
end
|
61
63
|
when 'sheets/select-v1', 'sheets/select'
|
62
64
|
JsonCrawler::Menu.new(http, params, action)
|
@@ -90,6 +92,11 @@ module Glib
|
|
90
92
|
def crawl_multiple(views, block)
|
91
93
|
@visitor.traverse_multiple views, block
|
92
94
|
end
|
95
|
+
|
96
|
+
def allowed?(url)
|
97
|
+
regex = Regexp.new("#{host}.+(?<!\.pdf)$")
|
98
|
+
regex.match(url)
|
99
|
+
end
|
93
100
|
end
|
94
101
|
end
|
95
102
|
end
|