glib-web 4.38.0 → 4.39.0
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/action_builder/dialogs.rb +3 -0
- data/app/helpers/glib/json_ui/action_builder/sheets.rb +2 -0
- data/app/helpers/glib/json_ui/view_builder.rb +1 -1
- 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 +8 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 04bdbf508e9bae2d875e880a1ccff951cacb80d7eae24a543e82a816d9eaff4f
|
|
4
|
+
data.tar.gz: 3f209d236fafbb17c2a40a5cf570bfd5166be900059abbf71b0b652260e035ec
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 480b89089e395f1b123bab2e0b161d485406eb537c215fab96c464e8be22bd7e42a44d7ef460cf37d32396642dcf37eb46afe7625bae126e19cae89d3870f1bc
|
|
7
|
+
data.tar.gz: 3ad20d4a121a87e14b496ad5e179b4f7db2be6812a7bc086086e000ec12c52558b6768192300cdcd273a676824beed495d5db8a4fa97854aff76957310f6fee3
|
|
@@ -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?
|
|
@@ -5,6 +5,7 @@ class Glib::JsonUi::ActionBuilder
|
|
|
5
5
|
string :message
|
|
6
6
|
action :onLoad
|
|
7
7
|
action :onClose
|
|
8
|
+
singleton_array :styleClass, :styleClasses
|
|
8
9
|
end
|
|
9
10
|
|
|
10
11
|
|
|
@@ -16,6 +17,7 @@ class Glib::JsonUi::ActionBuilder
|
|
|
16
17
|
bool :closeOnBlur
|
|
17
18
|
bool :updateExisting
|
|
18
19
|
action :onClose
|
|
20
|
+
singleton_array :styleClass, :styleClasses
|
|
19
21
|
|
|
20
22
|
# def initialize(json, page)
|
|
21
23
|
# @json = json
|
|
@@ -37,6 +39,7 @@ class Glib::JsonUi::ActionBuilder
|
|
|
37
39
|
bool :closeOnBlur
|
|
38
40
|
bool :updateExisting
|
|
39
41
|
action :onClose
|
|
42
|
+
singleton_array :styleClass, :styleClasses
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
class Reload < Action
|
|
@@ -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,10 +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.39.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ''
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
11
|
date: 2019-10-04 00:00:00.000000000 Z
|
|
@@ -135,6 +136,7 @@ dependencies:
|
|
|
135
136
|
- - ">="
|
|
136
137
|
- !ruby/object:Gem::Version
|
|
137
138
|
version: '0'
|
|
139
|
+
description:
|
|
138
140
|
email: ''
|
|
139
141
|
executables: []
|
|
140
142
|
extensions: []
|
|
@@ -370,6 +372,7 @@ files:
|
|
|
370
372
|
- app/views/json_ui/garage/test_page/dialog.json.jbuilder
|
|
371
373
|
- app/views/json_ui/garage/test_page/dialog_open.json.jbuilder
|
|
372
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
|
|
373
376
|
- app/views/json_ui/garage/test_page/form.json.jbuilder
|
|
374
377
|
- app/views/json_ui/garage/test_page/form_dynamic.json.jbuilder
|
|
375
378
|
- app/views/json_ui/garage/test_page/lifecycle.json.jbuilder
|
|
@@ -448,8 +451,10 @@ files:
|
|
|
448
451
|
- lib/glib/value.rb
|
|
449
452
|
- lib/glib/version.rb
|
|
450
453
|
- lib/tasks/db.rake
|
|
454
|
+
homepage:
|
|
451
455
|
licenses: []
|
|
452
456
|
metadata: {}
|
|
457
|
+
post_install_message:
|
|
453
458
|
rdoc_options: []
|
|
454
459
|
require_paths:
|
|
455
460
|
- lib
|
|
@@ -464,7 +469,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
464
469
|
- !ruby/object:Gem::Version
|
|
465
470
|
version: '0'
|
|
466
471
|
requirements: []
|
|
467
|
-
rubygems_version: 3.6
|
|
472
|
+
rubygems_version: 3.4.6
|
|
473
|
+
signing_key:
|
|
468
474
|
specification_version: 4
|
|
469
475
|
summary: ''
|
|
470
476
|
test_files: []
|