glib-web 4.37.1 → 4.38.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/controllers/concerns/glib/auth/policy.rb +9 -0
- data/app/helpers/glib/json_ui/view_builder/panels.rb +1 -0
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +1 -1
- data/app/views/json_ui/garage/test_page/_header.json.jbuilder +19 -11
- data/app/views/json_ui/garage/test_page/file_upload_new.json.jbuilder +158 -0
- data/lib/glib/json_crawler/router.rb +29 -2
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf8ec529a4fe8b94ca43b3930e4fb263799ebc8736c18f5f4157972224d778a0
|
|
4
|
+
data.tar.gz: 57836eea14257e3789e5b36cfa480c2a6f50e6b5650ed25cc69a26565b93301f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8de3989aec15bb53c2ad750a2c8521f92dd88d8628e30e91fbd460f6e5c9edfa004ec8a118b16eea94c72e7da48fe28ca870c0a797cc5dd2d8c25a4ff6f3737a
|
|
7
|
+
data.tar.gz: '09b80248d2f6a82330500bb15370fc7a05ac3ee0e15d910d3c924603ff6e899fcae34a99e6a9419ca1e81703edfdbfce6db638911e71067572a497e76e7e5716'
|
|
@@ -100,6 +100,14 @@ module Glib::Auth
|
|
|
100
100
|
raise_access_denied(resource_instance, policy_instance) unless policy_instance.public_send(query)
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
+
def glib_skip_controller_action_if_permission_test
|
|
104
|
+
permission_test = params[:__glib_permission_test].present?
|
|
105
|
+
|
|
106
|
+
if permission_test
|
|
107
|
+
render status: 200, json: { status: 'ok' }
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
103
111
|
class UnauthorizedError < Pundit::NotAuthorizedError
|
|
104
112
|
end
|
|
105
113
|
|
|
@@ -110,6 +118,7 @@ module Glib::Auth
|
|
|
110
118
|
|
|
111
119
|
before_action :glib_load_resource
|
|
112
120
|
before_action :glib_authorize_resource
|
|
121
|
+
before_action :glib_skip_controller_action_if_permission_test
|
|
113
122
|
end
|
|
114
123
|
|
|
115
124
|
def glib_auth_inited?
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
navs = ['form', 'dialog', 'form_dynamic', 'auto_validate', 'multiupload', 'dirty_state', 'window', 'selectable', 'lifecycle']
|
|
1
|
+
navs = ['form', 'dialog', 'form_dynamic', 'auto_validate', 'multiupload', 'dirty_state', 'window', 'selectable', 'lifecycle', 'file_upload_new']
|
|
2
2
|
|
|
3
|
-
view.panels_flow
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
view.panels_flow(
|
|
4
|
+
innerPadding: { bottom: 0 },
|
|
5
|
+
styleClass: 'align-right',
|
|
6
|
+
width: 'matchParent',
|
|
7
|
+
childViews: ->(res) do
|
|
8
|
+
navs.each_with_index do |nav, index|
|
|
9
|
+
if index < navs.size && index != 0
|
|
10
|
+
res.spacer width: 4
|
|
11
|
+
res.label text: '|'
|
|
12
|
+
res.spacer width: 4
|
|
13
|
+
end
|
|
14
|
+
res.label(
|
|
15
|
+
text: nav,
|
|
16
|
+
onClick: ->(action) do
|
|
17
|
+
action.windows_open url: json_ui_garage_url(path: "test_page/#{nav}")
|
|
18
|
+
end
|
|
19
|
+
)
|
|
12
20
|
end
|
|
13
21
|
end
|
|
14
|
-
|
|
22
|
+
)
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
json.title 'Forms'
|
|
2
|
+
page = json_ui_page json
|
|
3
|
+
render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
4
|
+
|
|
5
|
+
params[:mode] ||= 'html'
|
|
6
|
+
|
|
7
|
+
image = OpenStruct.new(
|
|
8
|
+
url: 'https://picsum.photos/id/11/100/60',
|
|
9
|
+
signed_id: 'test',
|
|
10
|
+
filename: 'upload.png'
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
accepts = {
|
|
14
|
+
fileType: 'image',
|
|
15
|
+
maxFileSize: 10,
|
|
16
|
+
maxFileLength: 2
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if params[:mode] == 'html'
|
|
20
|
+
directUploadUrl = nil
|
|
21
|
+
else
|
|
22
|
+
directUploadUrl = glib_direct_uploads_url
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
properties = {
|
|
26
|
+
styleClass: 'pb-2',
|
|
27
|
+
directUploadUrl: params,
|
|
28
|
+
accepts: accepts,
|
|
29
|
+
directUploadUrl: directUploadUrl,
|
|
30
|
+
value: image&.signed_id
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# properties[:onMaxFileLengthError] = ->(action) do
|
|
34
|
+
# action.snackbars_alert message: 'max file length exceeded'
|
|
35
|
+
# end
|
|
36
|
+
|
|
37
|
+
# properties[:onMaxFileSizeError] = ->(action) do
|
|
38
|
+
# action.snackbars_alert message: 'max file size exceeded'
|
|
39
|
+
# end
|
|
40
|
+
|
|
41
|
+
# properties[:onFileTypeError] = ->(action) do
|
|
42
|
+
# action.snackbars_alert message: 'file type invalid'
|
|
43
|
+
# end
|
|
44
|
+
|
|
45
|
+
properties[:onFinishUpload] = ->(action) do # rubocop:disable Glib/MultilineMethodCallStyle
|
|
46
|
+
action.snackbars_alert message: 'Get the signed ids!'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
page.form(
|
|
50
|
+
url: json_ui_garage_url(path: 'forms/generic_post'),
|
|
51
|
+
method: 'post',
|
|
52
|
+
childViews: ->(form) do
|
|
53
|
+
render 'json_ui/garage/test_page/header', view: form
|
|
54
|
+
|
|
55
|
+
# form.panels_flow(
|
|
56
|
+
# styleClass: 'items-center justify-center gap-2 pb-4',
|
|
57
|
+
# childViews: ->(flow) do
|
|
58
|
+
# flow.label text: "MODE: #{params[:mode] || 'directUpload'}"
|
|
59
|
+
# change = params[:mode] == 'html' ? 'directUpload' : 'html'
|
|
60
|
+
# flow.button text: 'Change', onClick: ->(action) { action.windows_open url: json_ui_garage_current_url({ mode: change }) }
|
|
61
|
+
# end
|
|
62
|
+
# )
|
|
63
|
+
|
|
64
|
+
form.h2 text: 'Field Upload', styleClass: 'pb-4'
|
|
65
|
+
form.label text: 'placeholder image', styleClass: 'pb-1'
|
|
66
|
+
form.panels_flow(
|
|
67
|
+
styleClass: 'align-center',
|
|
68
|
+
xs: { gap: { all: 4 } },
|
|
69
|
+
childViews: ->(flow) do
|
|
70
|
+
form.fields_upload(
|
|
71
|
+
properties.merge(
|
|
72
|
+
name: 'user[file_placeholderView]',
|
|
73
|
+
id: 'pv1',
|
|
74
|
+
placeholderView: { type: 'image', url: image&.url, width: 144, height: 144 }
|
|
75
|
+
)
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
flow.button(
|
|
79
|
+
text: 'Trigger',
|
|
80
|
+
onClick: ->(action) do
|
|
81
|
+
action.components_invoke targetId: 'pv1', name: 'trigger'
|
|
82
|
+
end
|
|
83
|
+
)
|
|
84
|
+
flow.button(
|
|
85
|
+
text: 'Reset',
|
|
86
|
+
onClick: ->(action) do
|
|
87
|
+
action.components_invoke targetId: 'pv1', name: 'reset'
|
|
88
|
+
end
|
|
89
|
+
)
|
|
90
|
+
end
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
form.label text: 'placeholder avatar', styleClass: 'pb-1'
|
|
94
|
+
form.panels_flow(
|
|
95
|
+
styleClass: 'align-center',
|
|
96
|
+
xs: { gap: { all: 4 } },
|
|
97
|
+
childViews: ->(flow) do
|
|
98
|
+
flow.fields_upload(
|
|
99
|
+
properties.merge(
|
|
100
|
+
name: 'user[file_placeholderView2]',
|
|
101
|
+
id: 'pv2',
|
|
102
|
+
placeholderView: { type: 'avatar', url: image&.url, width: 64, height: 64 }
|
|
103
|
+
)
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
form.label text: 'file input', styleClass: 'pb-1'
|
|
110
|
+
form.fields_upload(
|
|
111
|
+
properties.merge(
|
|
112
|
+
name: 'user[file_input1]',
|
|
113
|
+
id: 'fi1',
|
|
114
|
+
label: 'Upload file',
|
|
115
|
+
width: 300,
|
|
116
|
+
label: 'Choose file',
|
|
117
|
+
inputView: { variant: 'outlined' },
|
|
118
|
+
multiple: false
|
|
119
|
+
)
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
form.label text: 'multiprogress', styleClass: 'pb-1'
|
|
124
|
+
form.fields_upload(
|
|
125
|
+
properties.merge(
|
|
126
|
+
name: 'user[file_multiprogress1][]',
|
|
127
|
+
id: 'mp1',
|
|
128
|
+
width: 300,
|
|
129
|
+
label: 'Upload file',
|
|
130
|
+
multiple: true,
|
|
131
|
+
multiProgressView: { files: [] }
|
|
132
|
+
)
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
form.label text: 'Button file upload', styleClass: 'pb-1'
|
|
137
|
+
form.button(
|
|
138
|
+
text: 'click me to select file',
|
|
139
|
+
onClick: ->(action) do
|
|
140
|
+
action.components_invoke targetId: 'btn1', name: 'trigger'
|
|
141
|
+
end
|
|
142
|
+
)
|
|
143
|
+
form.fields_upload(
|
|
144
|
+
properties.merge(
|
|
145
|
+
name: 'user[file_btn1][]',
|
|
146
|
+
id: 'btn1',
|
|
147
|
+
width: 300,
|
|
148
|
+
label: 'Upload file',
|
|
149
|
+
multiple: true,
|
|
150
|
+
inputView: { files: [] },
|
|
151
|
+
styleClass: 'pb-4 d-none'
|
|
152
|
+
)
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
form.fields_submit text: 'submit'
|
|
156
|
+
|
|
157
|
+
end
|
|
158
|
+
)
|
|
@@ -9,11 +9,17 @@ module Glib
|
|
|
9
9
|
attr_accessor :host, :skip_similar_page
|
|
10
10
|
|
|
11
11
|
def log(action, url, response = nil)
|
|
12
|
+
if url.present?
|
|
13
|
+
url = remove_params(url, [:__glib_permission_test])
|
|
14
|
+
end
|
|
15
|
+
|
|
12
16
|
@last_log = [
|
|
13
17
|
action,
|
|
14
18
|
response.present? ? response.code : nil,
|
|
15
19
|
url
|
|
16
|
-
].compact.join(
|
|
20
|
+
].compact.join(
|
|
21
|
+
' :: '
|
|
22
|
+
)
|
|
17
23
|
|
|
18
24
|
# puts @last_log
|
|
19
25
|
|
|
@@ -127,7 +133,9 @@ module Glib
|
|
|
127
133
|
'dialogs/oauth-v1',
|
|
128
134
|
'http/delete',
|
|
129
135
|
'dialogs/oauth'
|
|
130
|
-
].include?(
|
|
136
|
+
].include?(
|
|
137
|
+
action
|
|
138
|
+
)
|
|
131
139
|
# @read_only_actions.add([action, params['url']])
|
|
132
140
|
http_actions.add([action, params['url']])
|
|
133
141
|
end
|
|
@@ -164,6 +172,10 @@ module Glib
|
|
|
164
172
|
crawler_actions.each do |crawler_action|
|
|
165
173
|
action, url, params = crawler_action
|
|
166
174
|
|
|
175
|
+
if url.present?
|
|
176
|
+
url = add_params(url, __glib_permission_test: true)
|
|
177
|
+
end
|
|
178
|
+
|
|
167
179
|
params = JSON.parse(params) if params.is_a?(String)
|
|
168
180
|
params ||= {}
|
|
169
181
|
|
|
@@ -212,6 +224,21 @@ module Glib
|
|
|
212
224
|
end
|
|
213
225
|
|
|
214
226
|
private
|
|
227
|
+
def add_params(url, new_params)
|
|
228
|
+
uri = URI(url)
|
|
229
|
+
existing = URI.decode_www_form(uri.query || '')
|
|
230
|
+
uri.query = URI.encode_www_form(existing + new_params.to_a)
|
|
231
|
+
uri.to_s
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
def remove_params(url, keys)
|
|
235
|
+
keys = keys.map(&:to_s)
|
|
236
|
+
uri = URI(url)
|
|
237
|
+
filtered = URI.decode_www_form(uri.query || '').reject { |name, _| name.empty? || keys.include?(name) }
|
|
238
|
+
uri.query = filtered.empty? ? nil : URI.encode_www_form(filtered)
|
|
239
|
+
uri.to_s
|
|
240
|
+
end
|
|
241
|
+
|
|
215
242
|
def similar_page?(params)
|
|
216
243
|
return false if http_actions.blank? || params['url'].blank?
|
|
217
244
|
return false if !skip_similar_page
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: glib-web
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.38.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ''
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
date: 2019-10-04 00:00:00.000000000 Z
|
|
@@ -136,7 +136,7 @@ dependencies:
|
|
|
136
136
|
- - ">="
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
138
|
version: '0'
|
|
139
|
-
description:
|
|
139
|
+
description:
|
|
140
140
|
email: ''
|
|
141
141
|
executables: []
|
|
142
142
|
extensions: []
|
|
@@ -372,6 +372,7 @@ files:
|
|
|
372
372
|
- app/views/json_ui/garage/test_page/dialog.json.jbuilder
|
|
373
373
|
- app/views/json_ui/garage/test_page/dialog_open.json.jbuilder
|
|
374
374
|
- app/views/json_ui/garage/test_page/dirty_state.json.jbuilder
|
|
375
|
+
- app/views/json_ui/garage/test_page/file_upload_new.json.jbuilder
|
|
375
376
|
- app/views/json_ui/garage/test_page/form.json.jbuilder
|
|
376
377
|
- app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder
|
|
377
378
|
- app/views/json_ui/garage/test_page/lifecycle.json.jbuilder
|
|
@@ -450,10 +451,10 @@ files:
|
|
|
450
451
|
- lib/glib/value.rb
|
|
451
452
|
- lib/glib/version.rb
|
|
452
453
|
- lib/tasks/db.rake
|
|
453
|
-
homepage:
|
|
454
|
+
homepage:
|
|
454
455
|
licenses: []
|
|
455
456
|
metadata: {}
|
|
456
|
-
post_install_message:
|
|
457
|
+
post_install_message:
|
|
457
458
|
rdoc_options: []
|
|
458
459
|
require_paths:
|
|
459
460
|
- lib
|
|
@@ -469,7 +470,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
469
470
|
version: '0'
|
|
470
471
|
requirements: []
|
|
471
472
|
rubygems_version: 3.4.6
|
|
472
|
-
signing_key:
|
|
473
|
+
signing_key:
|
|
473
474
|
specification_version: 4
|
|
474
475
|
summary: ''
|
|
475
476
|
test_files: []
|