glib-web 0.4.59 → 0.4.60
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/helpers/glib/json_ui/abstract_builder.rb +6 -16
- data/app/helpers/glib/json_ui/view_builder.rb +0 -1
- data/app/views/json_ui/garage/views/markdowns.json.jbuilder +2 -13
- data/lib/glib/json_crawler/action_crawler.rb +6 -2
- data/lib/glib/json_crawler/action_crawlers/forms_submit.rb +7 -5
- data/lib/glib/json_crawler/action_crawlers/nav_initiate.rb +3 -1
- data/lib/glib/json_crawler/http.rb +8 -3
- data/lib/glib/json_crawler/router.rb +84 -63
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e115e3000243622421f51568643954470a02eb1
|
4
|
+
data.tar.gz: cf697c88ba64ac3ce3731fbdb49a69f993d87f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 738eaed2dd23bb59903ed80a1e1c05cc06d95928a9e68ae8a24ee6137739d5d181fb40076aa1d60a3a766546d987da50271076f499d28a67ab7d2437b1f620d0
|
7
|
+
data.tar.gz: 98be8ec4b19300946473005aa238bec89e1c02b0146ea0ecafb29b2dd32faf5719112562db95055813f8804da2cf893622182a10d9057ec67bde33ee8db8c54a
|
@@ -189,23 +189,13 @@ module Glib
|
|
189
189
|
end
|
190
190
|
|
191
191
|
json.set!(propName) do
|
192
|
-
|
193
|
-
|
194
|
-
data[:material][:name] = name
|
195
|
-
end
|
192
|
+
data[:material] ||= {}
|
193
|
+
data[:material][:name] = name if name
|
196
194
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
if (fa = data[:fa])
|
205
|
-
json.fa do
|
206
|
-
json.name fa[:name]
|
207
|
-
json.size fa[:size] if fa[:size]
|
208
|
-
end
|
195
|
+
material = data[:material]
|
196
|
+
json.material do
|
197
|
+
json.name material[:name]
|
198
|
+
json.size material[:size] if material[:size]
|
209
199
|
end
|
210
200
|
|
211
201
|
if (custom = data[:custom])
|
@@ -5,7 +5,7 @@ json_ui_page json do |page|
|
|
5
5
|
|
6
6
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
7
|
scroll.spacer height: 20
|
8
|
-
scroll.h2 text: '
|
8
|
+
scroll.h2 text: 'Paragraph'
|
9
9
|
scroll.spacer height: 6
|
10
10
|
scroll.markdown text:
|
11
11
|
'# h1 Heading' + "\n" +
|
@@ -25,17 +25,6 @@ json_ui_page json do |page|
|
|
25
25
|
"\n" +
|
26
26
|
'_This is italic text_' + "\n" +
|
27
27
|
"\n" +
|
28
|
-
'~~Strikethrough~~' + "\n"
|
29
|
-
"\n" +
|
30
|
-
'https://www.google.com' + "\n"
|
31
|
-
|
32
|
-
scroll.spacer height: 20
|
33
|
-
scroll.h2 text: 'Markdown with preview'
|
34
|
-
scroll.spacer height: 6
|
35
|
-
scroll.markdown text: 'Here is the video: https://www.youtube.com/watch?v=947op8yKJRY', previewVideo: true
|
36
|
-
|
37
|
-
scroll.spacer height: 10
|
38
|
-
scroll.markdown text: 'Some videos: https://youtu.be/ATnpEOo3GJA, https://www.youtube.com/watch?v=947op8yKJRY', previewVideo: true
|
39
|
-
|
28
|
+
'~~Strikethrough~~' + "\n"
|
40
29
|
end
|
41
30
|
end
|
@@ -1,12 +1,16 @@
|
|
1
1
|
module Glib
|
2
2
|
module JsonCrawler
|
3
3
|
class ActionCrawler
|
4
|
+
def initialize(http)
|
5
|
+
@http = http
|
6
|
+
end
|
7
|
+
|
4
8
|
def click object
|
5
|
-
|
9
|
+
@http.router.step(@http, object)
|
6
10
|
end
|
7
11
|
|
8
12
|
def crawl views
|
9
|
-
|
13
|
+
@http.router.crawl_multiple views, ->(view) do
|
10
14
|
click view
|
11
15
|
end
|
12
16
|
end
|
@@ -1,28 +1,30 @@
|
|
1
1
|
module Glib
|
2
2
|
module JsonCrawler
|
3
3
|
class FormsSubmit < ActionCrawler
|
4
|
-
def initialize
|
4
|
+
def initialize(http, params, action, form)
|
5
|
+
super(http)
|
6
|
+
|
5
7
|
@http = http
|
6
8
|
|
7
9
|
case form['method']
|
8
10
|
when 'patch', 'put'
|
9
11
|
submit_update(form, action)
|
10
12
|
else
|
11
|
-
|
13
|
+
http.router.log action, params['url']
|
12
14
|
end
|
13
15
|
end
|
14
|
-
|
16
|
+
|
15
17
|
def submit_update(view, action)
|
16
18
|
url = view['url']
|
17
19
|
fields = []
|
18
20
|
params = {}
|
19
|
-
|
21
|
+
@http.router.crawl_multiple view['childViews'], ->(child) do
|
20
22
|
if child['view'].start_with?('fields/')
|
21
23
|
fields << child
|
22
24
|
params[child['name']] = child['value']
|
23
25
|
end
|
24
26
|
end
|
25
|
-
|
27
|
+
|
26
28
|
json = @http.patch url, action, params
|
27
29
|
click(json)
|
28
30
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module Glib
|
2
2
|
module JsonCrawler
|
3
3
|
class NavInitiate < ActionCrawler
|
4
|
-
def initialize
|
4
|
+
def initialize(http, args, controller)
|
5
|
+
super(http)
|
6
|
+
|
5
7
|
@http = http
|
6
8
|
if (json = @http.get args['url'], controller) && (left_drawer = json['leftDrawer'])
|
7
9
|
crawl left_drawer['header']&.[]('childViews')
|
@@ -2,7 +2,7 @@
|
|
2
2
|
module Glib
|
3
3
|
module JsonCrawler
|
4
4
|
class Http
|
5
|
-
attr_accessor :history, :response_times, :user
|
5
|
+
attr_accessor :history, :response_times, :user, :router
|
6
6
|
|
7
7
|
URI_REGEXP = /\A#{URI::regexp}\z/
|
8
8
|
|
@@ -13,11 +13,12 @@ module Glib
|
|
13
13
|
403, ## FORBIDDEN Should be used for logged-in but not allowed to access
|
14
14
|
].flatten
|
15
15
|
|
16
|
-
def initialize(context, user)
|
16
|
+
def initialize(context, user, router)
|
17
17
|
@context = context
|
18
18
|
@history = []
|
19
19
|
@response_times = []
|
20
20
|
@user = user
|
21
|
+
@router = router
|
21
22
|
end
|
22
23
|
|
23
24
|
def get(url, controller)
|
@@ -40,6 +41,10 @@ module Glib
|
|
40
41
|
fetch(:delete, url, controller, {})
|
41
42
|
end
|
42
43
|
|
44
|
+
# def log(controller, url, response)
|
45
|
+
# @router.log(controller, url, response)
|
46
|
+
# end
|
47
|
+
|
43
48
|
def controller
|
44
49
|
@context.integration_session.controller
|
45
50
|
end
|
@@ -77,7 +82,7 @@ module Glib
|
|
77
82
|
raise
|
78
83
|
end
|
79
84
|
response = @context.response
|
80
|
-
|
85
|
+
@router.log(controller, url, response)
|
81
86
|
|
82
87
|
if (code = response.code.to_i) == 302
|
83
88
|
redirect_uri = URI(response.headers['Location'])
|
@@ -1,63 +1,84 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
1
|
+
|
2
|
+
module Glib
|
3
|
+
module JsonCrawler
|
4
|
+
class Router
|
5
|
+
# @@crawler_actions = Set.new
|
6
|
+
# @@store_action = false
|
7
|
+
|
8
|
+
# def self.crawler_actions
|
9
|
+
# @@crawler_actions
|
10
|
+
# end
|
11
|
+
|
12
|
+
def log(action, url, response = nil)
|
13
|
+
@logger.puts ' ' * @depth + [
|
14
|
+
action,
|
15
|
+
response.present? ? response.code : nil,
|
16
|
+
url
|
17
|
+
].compact.join(' :: ')
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(logger, store_action)
|
21
|
+
# @@depth = -1
|
22
|
+
# @@logger = logger
|
23
|
+
# @@visitor = Glib::Json::Traversal::Visitor.new
|
24
|
+
# @@store_action = store_action
|
25
|
+
|
26
|
+
@depth = -1
|
27
|
+
@logger = logger
|
28
|
+
@visitor = Glib::Json::Traversal::Visitor.new
|
29
|
+
@store_action = store_action
|
30
|
+
end
|
31
|
+
|
32
|
+
def step(http, args)
|
33
|
+
if (controller = http.controller)
|
34
|
+
Glib::JsonCrawler::Coverage.coverage_files.add(http.controller.class.instance_method(http.action_name).source_location.first)
|
35
|
+
end
|
36
|
+
|
37
|
+
if args.is_a?(Hash) && args['rel'] != 'nofollow'
|
38
|
+
if (onClick = (args.fetch('onClick', nil) || args.fetch('onResponse', nil)))
|
39
|
+
action = onClick['action']
|
40
|
+
params = onClick
|
41
|
+
end
|
42
|
+
|
43
|
+
if action.present?
|
44
|
+
@depth += 1
|
45
|
+
child = case action
|
46
|
+
when 'initiate_navigation'
|
47
|
+
# @@crawler_actions.add([action, params['url']]) if @@store_action
|
48
|
+
JsonCrawler::NavInitiate.new(http, params, action)
|
49
|
+
when 'windows/open-v1', 'dialogs/open-v1', 'windows/reload-v1'
|
50
|
+
unless action == 'dialogs/open-v1'
|
51
|
+
# @@crawler_actions.add([action, params['url']]) if @@store_action
|
52
|
+
end
|
53
|
+
JsonCrawler::WindowsOpen.new(http, params, action)
|
54
|
+
# when 'http/delete-v1'
|
55
|
+
# JsonCrawler::ActionHttp.new(:delete, http, params, action)
|
56
|
+
when 'http/post-v1'
|
57
|
+
JsonCrawler::ActionHttp.new(:post, http, params, action)
|
58
|
+
when 'forms/submit-v1'
|
59
|
+
forms = @visitor.forms
|
60
|
+
raise 'Submit action needs to be inside a form' if forms.size < 1
|
61
|
+
JsonCrawler::FormsSubmit.new(http, params, action, forms.last)
|
62
|
+
else
|
63
|
+
unless ['http/delete-v1', 'dialogs/oauth-v1', 'windows/openWeb-v1'].include?(action)
|
64
|
+
# @@crawler_actions.add([action, params['url']]) if @@store_action
|
65
|
+
end
|
66
|
+
self.log action, params['url']
|
67
|
+
end
|
68
|
+
@depth -= 1
|
69
|
+
child
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def tear_down
|
75
|
+
@logger.close
|
76
|
+
end
|
77
|
+
|
78
|
+
def crawl_multiple(views, block)
|
79
|
+
@visitor.traverse_multiple views, block
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|