glib-web 4.1.5 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/glib/glib_direct_uploads_controller.rb +52 -0
- data/app/helpers/glib/json_ui/abstract_builder.rb +17 -2
- data/app/helpers/glib/json_ui/action_builder/logics.rb +1 -0
- data/app/helpers/glib/json_ui/page_helper.rb +10 -1
- data/app/helpers/glib/json_ui/view_builder/fields.rb +3 -2
- data/app/helpers/glib/json_ui/view_builder/panels.rb +14 -1
- data/app/helpers/glib/json_ui/view_builder.rb +1 -1
- data/app/models/glib/dummy_job_application.rb +1 -1
- data/app/views/json_ui/garage/forms/conditional_value.json.jbuilder +1 -5
- data/app/views/json_ui/garage/forms/dialogs_update3.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/file_upload.json.jbuilder +27 -11
- data/app/views/json_ui/garage/forms/new_rich_text.json.jbuilder +4 -4
- data/app/views/json_ui/garage/forms/rich_text.json.jbuilder +2 -2
- data/app/views/json_ui/garage/forms/show_hide.json.jbuilder +34 -0
- data/app/views/json_ui/garage/forms/submit_on_change.json.jbuilder +1 -1
- data/app/views/json_ui/garage/forms/text_validation.json.jbuilder +10 -9
- data/app/views/json_ui/garage/pages/paste_file.jbuilder +1 -1
- data/app/views/json_ui/garage/panels/flow.json.jbuilder +13 -0
- data/app/views/json_ui/garage/panels/horizontal.json.jbuilder +13 -0
- data/app/views/json_ui/garage/panels/responsive.json.jbuilder +12 -0
- data/app/views/json_ui/garage/panels/ul.json.jbuilder +13 -0
- data/app/views/json_ui/garage/panels/vertical.json.jbuilder +13 -0
- data/app/views/json_ui/garage/views/icon_names.json.jbuilder +1 -1
- data/app/views/json_ui/garage/views/treeView.json.jbuilder +1 -1
- data/config/routes.rb +2 -0
- data/lib/active_storage/service/glib_s3_service.rb +22 -0
- data/lib/glib/engine.rb +0 -7
- metadata +25 -12
- data/lib/glib/blob.rb +0 -23
- data/lib/glib/direct_uploads_controller.rb +0 -32
- data/lib/glib/s3_service.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faf0d291c51c0fa43711bc1e563a85693087ac7979784ef50144838227b36f51
|
4
|
+
data.tar.gz: 99cb79b91991380f89387958d6f7378a5e9dd18db2517b3ee24888369e09d01a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cc7697604c728d1999a4da910991c75e6a9750e9492e8c4489971c60e91f0b8233276a9b6b806737229e7b7950bf14609b89d04845d8b5ef0c6f25d966dd19e
|
7
|
+
data.tar.gz: 925654476843e66088de357fe3c6f94b5f16411a8e6e70552dcb0c0199198dd607d519c117d079543d8678c86731f11beb9b28c5760548760d3a162445ad0a85
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Glib
|
2
|
+
class GlibDirectUploadsController < ::ActiveStorage::DirectUploadsController
|
3
|
+
before_action :authenticate_user!
|
4
|
+
|
5
|
+
rescue_from StandardError do |e|
|
6
|
+
if !Rails.env.production?
|
7
|
+
raise e
|
8
|
+
end
|
9
|
+
render json: { message: 'Upload failed' }, status: 500
|
10
|
+
end
|
11
|
+
|
12
|
+
rescue_from Glib::Auth::Policy::UnauthorizedError do
|
13
|
+
render json: { message: 'Forbidden' }, status: 403
|
14
|
+
end
|
15
|
+
|
16
|
+
rescue_from ActionController::InvalidAuthenticityToken do
|
17
|
+
render json: { message: 'Session expired. Please refresh page' }, status: 401
|
18
|
+
end
|
19
|
+
|
20
|
+
def create
|
21
|
+
blob = ActiveStorage::Blob.new # generate blob key
|
22
|
+
if blob_args[:prefix].present?
|
23
|
+
blob.key = "#{blob_args[:prefix]}/#{blob.key}"
|
24
|
+
end
|
25
|
+
blob.assign_attributes(**blob_args.except(:tagging, :prefix))
|
26
|
+
blob.save!
|
27
|
+
|
28
|
+
if blob.service.instance_of?(::ActiveStorage::Service::GlibS3Service)
|
29
|
+
blob.service.tagging = blob_args[:tagging]
|
30
|
+
end
|
31
|
+
|
32
|
+
render json: direct_upload_json(blob)
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
def blob_args
|
37
|
+
params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, :prefix, :tagging, metadata: {}).to_h.symbolize_keys
|
38
|
+
end
|
39
|
+
|
40
|
+
def direct_upload_json(blob)
|
41
|
+
url, headers = blob.service_url_for_direct_upload
|
42
|
+
blob.as_json(root: false, methods: :signed_id).merge(direct_upload: {
|
43
|
+
url: url,
|
44
|
+
headers: headers.merge(blob.service_headers_for_direct_upload)
|
45
|
+
})
|
46
|
+
end
|
47
|
+
|
48
|
+
def raise_error
|
49
|
+
raise Glib::Auth::Policy::UnauthorizedError
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -279,8 +279,23 @@ module Glib
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
-
def self.hash(propName)
|
282
|
+
def self.hash(propName, **options)
|
283
283
|
define_method(propName) do |value|
|
284
|
+
value = ActiveSupport::HashWithIndifferentAccess.new(value)
|
285
|
+
|
286
|
+
required = options[:required] || []
|
287
|
+
optional = options[:optional] || []
|
288
|
+
|
289
|
+
required.each do |req|
|
290
|
+
raise ArgumentError, "Hash property: '#{req}' is requred" if value[req.to_s].blank?
|
291
|
+
end
|
292
|
+
|
293
|
+
if optional.present?
|
294
|
+
value.except(*required).each do |k, v|
|
295
|
+
raise ArgumentError, "Unknown hash property: '#{k}'" if !optional.include?(k.to_sym)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
284
299
|
json.set! propName, value
|
285
300
|
end
|
286
301
|
end
|
@@ -326,7 +341,7 @@ module Glib
|
|
326
341
|
|
327
342
|
if value
|
328
343
|
if !Rails.env.production?
|
329
|
-
if !value.match
|
344
|
+
if !value.match(/^#([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/i)
|
330
345
|
raise "Invalid color: #{value}"
|
331
346
|
end
|
332
347
|
end
|
@@ -19,6 +19,15 @@ module Glib
|
|
19
19
|
)
|
20
20
|
end
|
21
21
|
|
22
|
+
def glib_direct_uploads_url(options = {})
|
23
|
+
Glib::Web::Engine.routes.url_helpers.glib_direct_uploads_url(options.merge(
|
24
|
+
protocol: request.protocol,
|
25
|
+
host: request.host,
|
26
|
+
port: request.port,
|
27
|
+
_render: params[:_render], format: params[:format])
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
22
31
|
def json_ui_garage_current_url(options = {})
|
23
32
|
json_ui_garage_url(options.merge(path: params[:path]))
|
24
33
|
end
|
@@ -237,7 +246,7 @@ module Glib
|
|
237
246
|
def form(options = {})
|
238
247
|
form = Glib::JsonUi::ViewBuilder::Panels::Form.new(json, self)
|
239
248
|
form.childViews(->(view_builder) { })
|
240
|
-
panel_options = options.slice!(:url, :method, :local, :onSubmit, :paramNameForFormData, :model, :onChange, :onChangeAndLoad)
|
249
|
+
panel_options = options.slice!(:url, :method, :local, :onSubmit, :paramNameForFormData, :model, :onChange, :onChangeAndLoad, :autoValidate)
|
241
250
|
|
242
251
|
json.fullPageForm do
|
243
252
|
json.view 'panels/fullPageForm'
|
@@ -66,7 +66,7 @@ class Glib::JsonUi::ViewBuilder
|
|
66
66
|
@label ||= context.field_label(@prop, @label_args || {})
|
67
67
|
@hint ||= context.hint_label(@prop, @hint_args || {})
|
68
68
|
@placeholder ||= context.placeholder_label(@prop, @placeholder_args || {})
|
69
|
-
@validation ||= context.field_validation(@prop) if @autoValidate
|
69
|
+
@validation ||= context.field_validation(@prop) if form._autoValidate || @autoValidate
|
70
70
|
|
71
71
|
if form.current_dynamic_group.nil?
|
72
72
|
# This is not relevant inside a dynamic group
|
@@ -219,7 +219,7 @@ class Glib::JsonUi::ViewBuilder
|
|
219
219
|
|
220
220
|
string :titlePrefix
|
221
221
|
panels_builder :content, :template
|
222
|
-
|
222
|
+
array :groupFieldProperties
|
223
223
|
|
224
224
|
# NOTE: Consider using sub-panel instead (e.g. groupTemplate)
|
225
225
|
# views :groupTemplateViews
|
@@ -326,6 +326,7 @@ class Glib::JsonUi::ViewBuilder
|
|
326
326
|
string :storagePrefix
|
327
327
|
hash :metadata
|
328
328
|
string :tagging
|
329
|
+
hash :tags
|
329
330
|
|
330
331
|
required :accepts, :directUploadUrl
|
331
332
|
|
@@ -1,7 +1,10 @@
|
|
1
|
+
require 'js_regex'
|
2
|
+
|
1
3
|
class Glib::JsonUi::ViewBuilder
|
2
4
|
module Panels
|
3
5
|
class Form < View
|
4
6
|
attr_reader :model_name # See Panels::Form.field_name
|
7
|
+
attr_reader :_autoValidate
|
5
8
|
attr_accessor :current_dynamic_group
|
6
9
|
|
7
10
|
action :onSubmit
|
@@ -10,6 +13,10 @@ class Glib::JsonUi::ViewBuilder
|
|
10
13
|
string :paramNameForFormData
|
11
14
|
bool :local
|
12
15
|
|
16
|
+
def autoValidate(autoValidate)
|
17
|
+
@_autoValidate = autoValidate
|
18
|
+
end
|
19
|
+
|
13
20
|
def nested_associations
|
14
21
|
@nested_associations ||= []
|
15
22
|
end
|
@@ -129,7 +136,7 @@ class Glib::JsonUi::ViewBuilder
|
|
129
136
|
|
130
137
|
def self.field_validation(model, prop)
|
131
138
|
validations = {}
|
132
|
-
ignored = ['confirmation', 'comparison', 'uniqueness', 'validates_associated', 'validates_each', 'validates_with'
|
139
|
+
ignored = ['confirmation', 'comparison', 'uniqueness', 'validates_associated', 'validates_each', 'validates_with']
|
133
140
|
model.class.validators_on(prop).each do |validator|
|
134
141
|
next if ignored.include?(validator.kind.to_s)
|
135
142
|
|
@@ -150,6 +157,12 @@ class Glib::JsonUi::ViewBuilder
|
|
150
157
|
'less_than_or_equal_to', 'other_than', 'in', 'odd', 'even'
|
151
158
|
].inject({}) { |prev, curr| prev.merge(curr => lookup_error_message(model.to_s.underscore, prop, curr)) }
|
152
159
|
when :format
|
160
|
+
if validations[validator.kind][:with].instance_of?(Regexp)
|
161
|
+
validations[validator.kind][:with] = JsRegex.new(validations[validator.kind][:with]).source
|
162
|
+
end
|
163
|
+
if validations[validator.kind][:without].instance_of?(Regexp)
|
164
|
+
validations[validator.kind][:without] = JsRegex.new(validations[validator.kind][:without]).source
|
165
|
+
end
|
153
166
|
validations[validator.kind][:message] ||= lookup_error_message(model.to_s.underscore, prop, 'invalid')
|
154
167
|
when :inclusion
|
155
168
|
validations[validator.kind][:message] ||= lookup_error_message(model.to_s.underscore, prop, 'inclusion')
|
@@ -9,7 +9,7 @@ module Glib
|
|
9
9
|
validates :accept, acceptance: {}, allow_nil: false
|
10
10
|
validates :words, length: { maximum: 100, minimum: 1 }
|
11
11
|
validates :age, numericality: { only_integer: true, less_than_or_equal_to: 30, greater_than_or_equal_to: 18 }, allow_blank: true
|
12
|
-
|
12
|
+
validates :name, format: { with: /Doe\z/, message: 'This job is for person end with Doe' }
|
13
13
|
validates :position, inclusion: { in: ['programmer', 'devops', 'designer'] }, allow_blank: true
|
14
14
|
|
15
15
|
end
|
@@ -30,11 +30,7 @@ page.form \
|
|
30
30
|
form.h2 text: 'Check/uncheck All'
|
31
31
|
form.spacer height: 6
|
32
32
|
form.fields_check name: 'user[check_all]', label: 'All', checkValue: true, onChangeAndLoad: ->(action) do
|
33
|
-
action.
|
34
|
-
saction.logics_set targetId: 'check1', conditionalData: { value: { "==": [{ "var": 'user[check_all]' }, true] } }
|
35
|
-
saction.logics_set targetId: 'check2', conditionalData: { value: { "==": [{ "var": 'user[check_all]' }, true] } }
|
36
|
-
saction.logics_set targetId: 'check3', conditionalData: { value: { "==": [{ "var": 'user[check_all]' }, true] } }
|
37
|
-
end
|
33
|
+
action.logics_set targetIds: ['check1', 'check2', 'check3'], conditionalData: { value: { "==": [{ "var": 'user[check_all]' }, true] } }
|
38
34
|
end
|
39
35
|
form.fields_check id: 'check1', name: 'user[check1]', label: 'Check 1', checkValue: true
|
40
36
|
form.fields_check id: 'check2', name: 'user[check2]', label: 'Check 2', checkValue: true
|
@@ -11,29 +11,29 @@ render "#{@path_prefix}/nav_menu", json: json, page: page
|
|
11
11
|
|
12
12
|
page.form options.merge(childViews: ->(form) do
|
13
13
|
rules = { fileType: 'image', maxFileSize: 5000 }
|
14
|
-
form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Landscape Photo', accepts: rules, directUploadUrl:
|
14
|
+
form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Landscape Photo', accepts: rules, directUploadUrl: glib_direct_uploads_url,
|
15
15
|
value: 'eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4',
|
16
16
|
fileUrl: 'https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100',
|
17
17
|
fileTitle: '1 month ago',
|
18
18
|
placeholderView: { type: 'image', width: 100, height: 75, url: 'https://www.atms.com.au/wp-content/uploads/2019/10/placeholder-1-1024x683.png?x93630' }
|
19
19
|
|
20
20
|
rules = { fileType: 'image', maxFileSize: 1, fileTypeErrorText: 'Invalid!', maxFileSizeErrorText: 'Too big!' }
|
21
|
-
form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Avatar', accepts: rules, directUploadUrl:
|
21
|
+
form.fields_file name: 'user[photo][]', width: 'matchParent', label: 'Avatar', accepts: rules, directUploadUrl: glib_direct_uploads_url,
|
22
22
|
placeholderView: { type: 'avatar', width: 100, height: 100, url: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMREBUREhAWFhUWGBcVFRgXFxUVFxcWGRUWFxYVFRUYHSggGB0lHRgVITEhJSkrLi4uGB8zODMtNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAOMA3gMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABgcB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NbDjWqOBJm3Dsg+mRL1CFoiwZcv3itzyDq48KUWWOAEjj+5IONF0PgbcDu+y0ESxQYREQEREBERAREQEREBERARfTGE4BdDGNbiaoNbYUhN3QfdbQy9penJYZMGbsONao4EmbcO3OiAHX6YbUL7uj+6rLyDq48KURpAEjj+5VQC25XHYgbfrhsWGAjWw41R4J1cOFKoMllyo5IGX6lYYCDN2HdHgkzbh2QGvv0NNqF93RWXkGjce1EaQBJ2Pf1QC25UV2IGXtL90WGAjWw71RwJM24dudEBrr9DTasRDLRIn819PIOrj2ojSAJOx7+qD4iWbce60uYRiF0MBGth3qskkmYw/exByIustacBPlRa3QW4TIPGvyQaEW91nl7QWPw53hBpRbhZydo7p5FZFwQaUXSYDRiSshu1rRLf8APFBoZDJwC2CEAZEzO4LbEde1T9FgESkdb67KoPqJo1HKWxfIZe0lhgIq7DujgSZtw7eiA11+hptQvu6P7qsvIOrj2ojSAJOx7+qAW3KiuxAy9pfuiwwEa2HeqOBJmMO3OiAHX6Gm1C65QV2rLzPVx7IwgUdj3QfVp1eqWfVREGqy49PskfW7IiDZasOv3WYGr3REGuy49FiPrdkRBstWHX7rMHV7rKINVlx6LEXX7IiDZasBzWYOp3+qyiDVZcTyWIuv2+iIg2WrAc1mHqdD9URB8WXEr5fr9R9ERBttOr1Sz6vdZRBpsuPT7JH1uyIg2WrDqswdTuiINdlxPJYtOt0REH//2Q==' }
|
23
23
|
|
24
24
|
rules = { fileType: 'pdf', maxFileSize: 5000 }
|
25
|
-
form.fields_file name: 'user[pdf1][]', width: 'matchParent', label: 'PDF Document', accepts: rules, directUploadUrl:
|
25
|
+
form.fields_file name: 'user[pdf1][]', width: 'matchParent', label: 'PDF Document', accepts: rules, directUploadUrl: glib_direct_uploads_url,
|
26
26
|
placeholderView: { type: 'image', width: 100, height: 100, url: 'data:image/webp;base64,UklGRqQVAABXRUJQVlA4TJcVAAAv/8F/ELWK4rZtHGn/tVOv/CNiAvik1tymPAJg9nKbNQXcCFtqZ1Ar3s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HnvFgHpJBcbQXEzPnx+UEG1/63z+nUHLPNCygYB+Gp7lBCDrvQ9tcnPbz2MMFennnxC67D9oavukMRWZYA+62JDK89mNByzDAvkOAchre6QxlZds47sIyoPXSAyS0vtmB1NRBvdYdCcjC8fjei9qBEDH7nlBfHyALtUPzVHUqJGd6Bfcx6gA0NzkUueUHcg3fw3vBXd4guMTEDBjyj1uMrk26DevgcsgEAAhLD94bHukNUyYkZNiA+bj2+nGLjhnOSOhsuAYPMmL3hse5wxU1QzPAD6iPXA2zIxkHKbPiF8tej9obPusOfPK93KChmOIXT2PUAJeww+TZNtlvchSdoxu0Nr3WH150KSTG7bRWNXw/wIgHPAU6eLbToZEFk7D7wW3d4/bvnDn2QlMNuaYz+7PknWA8IIsG55Z1Pl+PT4Mm6gs8PMn4feK47vH7Wxgu0qCyLh/PkJlmPXz3vea6txuCFcz4+BwjOm0bbWT4/fsEp9gFedwjIAno0Ai8puwOO4TfVeoAGWojGdTzDn6E5cIjX6EQ8DO7FONE+wOsOMVnAjxSM4S0WLqaz4GECzMcff/DRu0tzqliARsKkawQWQOBsKDk6Q8G94EnwOkCH0M5LPMRtjOAmypAEd6iBfcJ9APjlMwks/xkR0O6QKBaw7pCxoXWHfA2vO6RrI+kOiWEZTXdIC8t4ukNWWEbUHZLCMqbukBOWcXWHhLAAd4ccDbo7ZGhj7A6JZinMfPs4z9Edzv53h7P/3WGNMdZEL8uQhVprSPSyDNkWQtgSvSwDVtpxHK3wy9K/OyyP1lpXQDPN8pIMCHnfd01AE81yGq6cOWddQDPNYriX22PRHlSzFO0jmFIyfSipZlkAAA==' }
|
27
27
|
|
28
28
|
rules = { fileType: ['pdf', 'image'], maxFileSize: 5000 }
|
29
|
-
form.fields_file name: 'user[pdf2][]', width: 'matchParent', label: 'PDF/Image File', accepts: rules, directUploadUrl:
|
29
|
+
form.fields_file name: 'user[pdf2][]', width: 'matchParent', label: 'PDF/Image File', accepts: rules, directUploadUrl: glib_direct_uploads_url
|
30
30
|
|
31
31
|
rules = { fileType: 'zip', maxFileSize: 5000 }
|
32
|
-
form.fields_file name: 'user[zip][]', width: 'matchParent', label: 'ZIP Document', accepts: rules, directUploadUrl:
|
32
|
+
form.fields_file name: 'user[zip][]', width: 'matchParent', label: 'ZIP Document', accepts: rules, directUploadUrl: glib_direct_uploads_url
|
33
33
|
|
34
34
|
# TODO
|
35
35
|
# rules = { fileType: 'image/*', maxFileSize: 1, fileTypeErrorText: 'Invalid!', maxFileSizeErrorText: 'Too big!' }
|
36
|
-
# form.fields_multiImage name: 'user[photos][]', width: 'matchParent', label: 'Avatar', accepts: rules, directUploadUrl:
|
36
|
+
# form.fields_multiImage name: 'user[photos][]', width: 'matchParent', label: 'Avatar', accepts: rules, directUploadUrl: glib_direct_uploads_url,
|
37
37
|
# placeholderView: { type: 'avatar', width: 100, height: 100, url: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMREBUREhAWFhUWGBcVFRgXFxUVFxcWGRUWFxYVFRUYHSggGB0lHRgVITEhJSkrLi4uGB8zODMtNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAOMA3gMBIgACEQEDEQH/xAAbAAEAAgMBAQAAAAAAAAAAAAAABgcBAwQFAv/EAEAQAAECAwMKAwYEBAYDAAAAAAEAAgMRIQQSMQUGIjJBUWFxgZEHE6FCUnKxwdEUI2LwM4KSskNzg6LC4WOz8f/EABQBAQAAAAAAAAAAAAAAAAAAAAD/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwC6XuvCQRj7okcUe27UYoxt4TOKDDG3Knkjm3jeGCMdeoeaOcWmQwQZe6/Qc0a+6Lpx+6PbcqOSNbeF44oMMbcqeSOZeN4YIx1+h5oXEG6MEGXuv0HNGuui6cfuvMytl6zWTXi6XuN039hh1koflPxDe4nyILW/qfpO/pFB6oLDhMLTX0XLbLbChmcSNDZ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QWPw53hBpRbhZydo7p5FZFwQaUXSYDRiSshu1rRLf8APFBoZDJwC2CEAZEzO4LbEde1T9FgESkdb67KoPqJo1HKWxfIZe0lhgIq7DujgSZtw7eiA11+hptQvu6P7qsvIOrj2ojSAJOx7+qAW3KiuxAy9pfuiwwEa2HeqOBJmMO3OiAHX6Gm1C65QV2rLzPVx7IwgUdj3QfVp1eqWfVREGqy49PskfW7IiDZasOv3WYGr3REGuy49FiPrdkRBstWHX7rMHV7rKINVlx6LEXX7IiDZasBzWYOp3+qyiDVZcTyWIuv2+iIg2WrAc1mHqdD9URB8WXEr5fr9R9ERBttOr1Sz6vdZRBpsuPT7JH1uyIg2WrDqswdTuiINdlxPJYtOt0REH//2Q==' }
|
38
38
|
|
39
39
|
form.spacer height: 16
|
@@ -41,35 +41,51 @@ page.form options.merge(childViews: ->(form) do
|
|
41
41
|
form.spacer height: 8
|
42
42
|
form.fields_multiUpload \
|
43
43
|
name: 'user[multi][]',
|
44
|
+
id: 'upload_1',
|
44
45
|
width: 360,
|
45
46
|
accepts: { fileType: 'image', maxFileSize: 10 },
|
46
|
-
directUploadUrl:
|
47
|
+
directUploadUrl: glib_direct_uploads_url,
|
47
48
|
uploadTitle: 'Files uploaded:',
|
48
49
|
storagePrefix: 'glib',
|
49
50
|
metadata: {
|
50
51
|
foo: 'bar',
|
51
52
|
zoo: 'baz'
|
52
53
|
},
|
53
|
-
tagging: 'key=value&key1=value1',
|
54
|
+
# tagging: 'key=value&key1=value1',
|
55
|
+
tags: { key: 'value', key1: 'value1' },
|
54
56
|
files: [
|
55
|
-
{ name: 'File (Example)', signed_id: ActiveStorage::Attachment.
|
57
|
+
{ name: 'File (Example)', signed_id: ActiveStorage::Attachment.first&.signed_id }
|
56
58
|
]
|
59
|
+
form.button text: 'Clear files', onClick: ->(action) do
|
60
|
+
action.components_set targetId: 'upload_1', data: { files: [], value: nil }
|
61
|
+
end
|
62
|
+
|
57
63
|
form.spacer height: 16
|
58
64
|
form.label text: 'File upload with onFinishUpload'
|
59
65
|
form.spacer height: 8
|
60
66
|
form.fields_multiUpload \
|
61
67
|
name: 'user[multi2][]',
|
68
|
+
id: 'upload_2',
|
62
69
|
width: 360,
|
63
70
|
accepts: { fileType: 'image', maxFileSize: 5000 },
|
64
|
-
directUploadUrl:
|
71
|
+
directUploadUrl: glib_direct_uploads_url,
|
65
72
|
uploadTitle: 'Files uploaded:',
|
66
73
|
onFinishUpload: ->(action) { action.forms_submit }
|
74
|
+
form.button text: 'Populate files', onClick: ->(action) do
|
75
|
+
action.components_set targetId: 'upload_2', data: {
|
76
|
+
files: [
|
77
|
+
{ name: 'File (Example)', signed_id: ActiveStorage::Attachment.last&.signed_id }
|
78
|
+
],
|
79
|
+
value: [1]
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
67
83
|
form.spacer height: 16
|
68
84
|
form.label text: 'Sign'
|
69
85
|
form.spacer height: 8
|
70
86
|
form.fields_sign \
|
71
87
|
name: 'user[sign]',
|
72
|
-
directUploadUrl:
|
88
|
+
directUploadUrl: glib_direct_uploads_url,
|
73
89
|
width: 300, height: 150,
|
74
90
|
validation: { required: { message: 'add your signature!' } }
|
75
91
|
form.spacer height: 24
|
@@ -23,16 +23,16 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
|
|
23
23
|
|
24
24
|
json.images do
|
25
25
|
json.child! do
|
26
|
-
json.value
|
26
|
+
json.value 'eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFQT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--193dc0d939b9558fc4973fafbba91d989cbb04d4'
|
27
27
|
# json.fileTitle "hita i hanom hg.jpg"
|
28
|
-
json.fileUrl
|
28
|
+
json.fileUrl 'https://imageserver-demo.herokuapp.com/image/itinerarybuilder-demo/o6CKzNt67PWnkPdUEnWMt7pr?h=100&w=100'
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
json.imageUploader do
|
33
33
|
json.fieldName 'user[images_attributes]'
|
34
|
-
json.accepts(fileType:
|
35
|
-
json.directUploadUrl
|
34
|
+
json.accepts(fileType: 'image/*', maxFileSize: 5000)
|
35
|
+
json.directUploadUrl glib_direct_uploads_url
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -47,7 +47,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
|
|
47
47
|
imageUploader: {
|
48
48
|
name: 'user[images_attributes][]',
|
49
49
|
accepts: { fileType: 'image/*', maxFileSize: 5000 },
|
50
|
-
directUploadUrl:
|
50
|
+
directUploadUrl: glib_direct_uploads_url
|
51
51
|
},
|
52
52
|
onChange: ->(action) do
|
53
53
|
action.forms_submit overrideUrl: json_ui_garage_url(path: 'forms/rich_text_preview')
|
@@ -72,7 +72,7 @@ page.form url: json_ui_garage_url(path: 'forms/basic_post'), method: 'post', pad
|
|
72
72
|
# json.imageUploader do
|
73
73
|
# json.name 'user[images_attributes][]'
|
74
74
|
# json.accepts(fileType: 'image/*', maxFileSize: 5000)
|
75
|
-
# json.directUploadUrl
|
75
|
+
# json.directUploadUrl glib_direct_uploads_url
|
76
76
|
# end
|
77
77
|
# end
|
78
78
|
end
|
@@ -342,6 +342,40 @@ page.form \
|
|
342
342
|
form.fields_text id: 'field4', name: 'user[loadif_target8]', width: 'matchParent', value: params[:key]
|
343
343
|
end
|
344
344
|
|
345
|
+
# form.fields_check name: 'user[loadif7]', label: 'Show target nested panels', checkValue: 'true', uncheckValue: 'false', value: 'false', onChangeAndLoad: ->(action) do
|
346
|
+
# action.logics_set targetId: 'panel7a', conditionalData: { displayed: { "==": [{ "var": 'user[loadif7]' }, 'true'] } }
|
347
|
+
# end
|
348
|
+
|
349
|
+
form.spacer height: 20
|
350
|
+
options = [
|
351
|
+
{ text: 'Option 1', value: 'option1' },
|
352
|
+
{ text: 'Option 2', value: 'option2' }
|
353
|
+
]
|
354
|
+
form.fields_select name: 'user[loadif7]', width: 'matchParent', label: 'Select "show"', options: options, value: '', onChangeAndLoad: ->(action) do
|
355
|
+
action.runMultiple childActions: ->(saction) do
|
356
|
+
saction.logics_set targetId: 'panel7a', conditionalData: { displayed: { "==": [{ "var": 'user[loadif7]' }, 'option1'] } }
|
357
|
+
saction.logics_set targetId: 'panel7b', conditionalData: { displayed: { "==": [{ "var": 'user[loadif7]' }, 'option2'] } }
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
form.panels_vertical \
|
362
|
+
id: 'panel7a',
|
363
|
+
styleClass: 'border-2',
|
364
|
+
width: 'matchParent',
|
365
|
+
padding: { top: 8, right: 8, bottom: 8, left: 8 },
|
366
|
+
childViews: ->(res) do
|
367
|
+
res.fields_text name: 'user[loadif_target9]', width: 'matchParent', value: 'Value 7a'
|
368
|
+
end
|
369
|
+
|
370
|
+
form.panels_vertical \
|
371
|
+
id: 'panel7b',
|
372
|
+
styleClass: 'border-2',
|
373
|
+
width: 'matchParent',
|
374
|
+
padding: { top: 8, right: 8, bottom: 8, left: 8 },
|
375
|
+
childViews: ->(res) do
|
376
|
+
res.fields_text name: 'user[loadif_target9]', width: 'matchParent', value: 'Value 7b'
|
377
|
+
end
|
378
|
+
|
345
379
|
form.spacer height: 20
|
346
380
|
form.fields_submit text: 'Submit'
|
347
381
|
|
@@ -113,7 +113,7 @@ page.scroll childViews: ->(scroll) do
|
|
113
113
|
width: 'matchParent',
|
114
114
|
label: 'Avatar',
|
115
115
|
accepts: rules,
|
116
|
-
directUploadUrl:
|
116
|
+
directUploadUrl: glib_direct_uploads_url,
|
117
117
|
placeholderView: { type: 'avatar', width: 100, height: 100, url: 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBxMREBUREhAWFhUWGBcVFRgXFxUVFxcWGRUWFxYVFRUYHSggGB0lHRgVITEhJSkrLi4uGB8zODMtNygtLisBCgoKBQUFDgUFDisZExkrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrK//AABEIAOMA3gMBIgAC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9+mG1C+5o4rLyDq48KIwgCTseNUAsuVx2IGXtJYYCNbDjWqOBJm3Dsg+mRL1CFoiwZcv3itzyDq48KUWWOAEjj+5IONF0PgbcDu+y0ESxQYREQEREBERAREQEREBERARfTGE4BdDGNbiaoNbYUhN3QfdbQy9penJYZMGbsONao4EmbcO3OiAHX6YbUL7uj+6rLyDq48KURpAEjj+5VQC25XHYgbfrhsWGAjWw41R4J1cOFKoMllyo5IGX6lYYCDN2HdHgkzbh2QGvv0NNqF93RWXkGjce1EaQBJ2Pf1QC25UV2IGXtL90WGAjWw71RwJM24dudEBrr9DTasRDLRIn819PIOrj2ojSAJOx7+qD4iWbce60uYRiF0MBGth3qskkmYw/exByIustacBPlRa3QW4TIPGvyQaEW91nl7QWPw53hBpRbhZydo7p5FZFwQaUXSYDRiSshu1rRLf8APFBoZDJwC2CEAZEzO4LbEde1T9FgESkdb67KoPqJo1HKWxfIZe0lhgIq7DujgSZtw7eiA11+hptQvu6P7qsvIOrj2ojSAJOx7+qAW3KiuxAy9pfuiwwEa2HeqOBJmMO3OiAHX6Gm1C65QV2rLzPVx7IwgUdj3QfVp1eqWfVREGqy49PskfW7IiDZasOv3WYGr3REGuy49FiPrdkRBstWHX7rMHV7rKINVlx6LEXX7IiDZasBzWYOp3+qyiDVZcTyWIuv2+iIg2WrAc1mHqdD9URB8WXEr5fr9R9ERBttOr1Sz6vdZRBpsuPT7JH1uyIg2WrDqswdTuiINdlxPJYtOt0REH//2Q==' },
|
118
118
|
onChange: ->(action) do
|
119
119
|
action.sheets_select message: 'Submit data?', buttons: ->(menu) do
|
@@ -8,13 +8,14 @@ page.form \
|
|
8
8
|
url: json_ui_garage_url(path: 'forms/generic_post'),
|
9
9
|
method: 'post',
|
10
10
|
padding: glib_json_padding_body,
|
11
|
+
autoValidate: true,
|
11
12
|
childViews: ->(form) do
|
12
13
|
form.fields_text \
|
13
14
|
prop: :name,
|
14
15
|
name: 'user[name]',
|
15
16
|
width: 'matchParent',
|
16
|
-
label: 'Name'
|
17
|
-
|
17
|
+
label: 'Name'
|
18
|
+
|
18
19
|
|
19
20
|
form.fields_email \
|
20
21
|
name: 'user[email]',
|
@@ -30,8 +31,8 @@ page.form \
|
|
30
31
|
prop: :age,
|
31
32
|
name: 'user[age]',
|
32
33
|
width: 'matchParent',
|
33
|
-
label: 'Age'
|
34
|
-
|
34
|
+
label: 'Age'
|
35
|
+
|
35
36
|
|
36
37
|
form.fields_phone \
|
37
38
|
name: 'user[phone1]',
|
@@ -57,8 +58,8 @@ page.form \
|
|
57
58
|
name: 'user[words]',
|
58
59
|
width: 'matchParent',
|
59
60
|
label: 'Textarea with maxLength',
|
60
|
-
maxLength: 1000
|
61
|
-
|
61
|
+
maxLength: 1000
|
62
|
+
|
62
63
|
|
63
64
|
options = ['programmer', 'devops', 'designer', 'ceo', 'office_boy'].map { |v| { text: v.humanize, value: v } }
|
64
65
|
form.fields_select \
|
@@ -66,8 +67,8 @@ page.form \
|
|
66
67
|
name: 'user[position]',
|
67
68
|
width: 'matchParent',
|
68
69
|
label: 'Position',
|
69
|
-
options: options
|
70
|
-
|
70
|
+
options: options
|
71
|
+
|
71
72
|
|
72
73
|
form.spacer height: 10
|
73
74
|
form.h4 text: 'Gender'
|
@@ -95,7 +96,7 @@ page.form \
|
|
95
96
|
end
|
96
97
|
|
97
98
|
form.spacer height: 10
|
98
|
-
form.fields_check prop: :accept, label: 'Accept terms & condition', name: 'user[accept]'
|
99
|
+
form.fields_check prop: :accept, label: 'Accept terms & condition', name: 'user[accept]'
|
99
100
|
|
100
101
|
form.spacer height: 30
|
101
102
|
form.fields_submit text: 'Submit'
|
@@ -4,6 +4,19 @@ page = json_ui_page json
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
6
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
|
+
scroll.h1 text: 'Show/hide'
|
8
|
+
scroll.panels_flow id: 'flow1', width: 300, innerPadding: { top: 0 }, backgroundColor: '#b3bac2', childViews: ->(panel) do
|
9
|
+
panel.button text: '1'
|
10
|
+
panel.button text: '2'
|
11
|
+
panel.button text: '3'
|
12
|
+
end
|
13
|
+
scroll.button text: 'show', onClick: ->(action) do
|
14
|
+
action.components_set targetId: 'flow1', data: { displayed: true }
|
15
|
+
end
|
16
|
+
scroll.button text: 'hide', onClick: ->(action) do
|
17
|
+
action.components_set targetId: 'flow1', data: { displayed: false }
|
18
|
+
end
|
19
|
+
|
7
20
|
scroll.h1 text: 'Basic'
|
8
21
|
scroll.panels_flow width: 300, innerPadding: { top: 0 }, backgroundColor: '#b3bac2', childViews: ->(panel) do
|
9
22
|
panel.button text: '1'
|
@@ -4,6 +4,19 @@ json_ui_page json do |page|
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
6
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
|
+
scroll.h1 text: 'Show/hide'
|
8
|
+
scroll.panels_horizontal id: 'hor1', width: 200, height: 100, backgroundColor: '#b3bac2', childViews: ->(panel) do
|
9
|
+
panel.button text: '1'
|
10
|
+
end
|
11
|
+
scroll.button text: 'show', onClick: ->(action) do
|
12
|
+
action.components_set targetId: 'hor1', data: { displayed: true }
|
13
|
+
end
|
14
|
+
scroll.button text: 'hide', onClick: ->(action) do
|
15
|
+
action.components_set targetId: 'hor1', data: { displayed: false }
|
16
|
+
end
|
17
|
+
|
18
|
+
scroll.label text: "\n"
|
19
|
+
|
7
20
|
scroll.h1 text: 'Basic'
|
8
21
|
scroll.panels_horizontal backgroundColor: '#b3bac2', childViews: ->(panel) do
|
9
22
|
panel.button text: '1'
|
@@ -4,6 +4,18 @@ page = json_ui_page json
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
6
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
|
+
scroll.h1 text: 'Show/hide'
|
8
|
+
scroll.panels_responsive id: 'res1', width: 300, backgroundColor: '#b3bac2', childViews: ->(panel) do
|
9
|
+
panel.button text: '1'
|
10
|
+
panel.button text: '2'
|
11
|
+
end
|
12
|
+
scroll.button text: 'show', onClick: ->(action) do
|
13
|
+
action.components_set targetId: 'res1', data: { displayed: true }
|
14
|
+
end
|
15
|
+
scroll.button text: 'hide', onClick: ->(action) do
|
16
|
+
action.components_set targetId: 'res1', data: { displayed: false }
|
17
|
+
end
|
18
|
+
|
7
19
|
scroll.h1 text: 'Panels Columns'
|
8
20
|
scroll.label text: 'Shrink the browser\'s width to see how the column panels are rearranged. On mobile screens, they are always arranged vertically'
|
9
21
|
scroll.spacer height: 8
|
@@ -4,6 +4,19 @@ page = json_ui_page json
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
6
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
|
+
scroll.h2 text: 'Show/hide'
|
8
|
+
scroll.spacer height: 6
|
9
|
+
scroll.panels_ul id: 'ul', childViews: ->(li) do
|
10
|
+
li.label text: 'text1'
|
11
|
+
li.label text: 'text2'
|
12
|
+
end
|
13
|
+
scroll.button text: 'show', onClick: ->(action) do
|
14
|
+
action.components_set targetId: 'ul', data: { displayed: true }
|
15
|
+
end
|
16
|
+
scroll.button text: 'hide', onClick: ->(action) do
|
17
|
+
action.components_set targetId: 'ul', data: { displayed: false }
|
18
|
+
end
|
19
|
+
scroll.spacer height: 14
|
7
20
|
scroll.h2 text: 'Standard Usage'
|
8
21
|
scroll.spacer height: 6
|
9
22
|
scroll.panels_ul childViews: ->(ul) do
|
@@ -4,6 +4,19 @@ json_ui_page json do |page|
|
|
4
4
|
render "#{@path_prefix}/nav_menu", json: json, page: page
|
5
5
|
|
6
6
|
page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
7
|
+
|
8
|
+
scroll.h1 text: 'Show/Hide'
|
9
|
+
scroll.panels_vertical id: 'vert1', width: 200, height: 100, backgroundColor: '#b3bac2', childViews: ->(panel) do
|
10
|
+
panel.button text: 'Button1'
|
11
|
+
end
|
12
|
+
scroll.button text: 'show', onClick: ->(action) do
|
13
|
+
action.components_set targetId: 'vert1', data: { displayed: true }
|
14
|
+
end
|
15
|
+
scroll.button text: 'hide', onClick: ->(action) do
|
16
|
+
action.components_set targetId: 'vert1', data: { displayed: false }
|
17
|
+
end
|
18
|
+
|
19
|
+
scroll.label text: "\n"
|
7
20
|
scroll.h1 text: 'Basic'
|
8
21
|
scroll.panels_vertical backgroundColor: '#b3bac2', childViews: ->(panel) do
|
9
22
|
panel.button text: 'Button1'
|
@@ -2257,7 +2257,7 @@ page.scroll padding: glib_json_padding_body, childViews: ->(scroll) do
|
|
2257
2257
|
icon_names.each do |icon_name|
|
2258
2258
|
scroll.panels_column lg: { cols: 4 }, childViews: ->(column) do
|
2259
2259
|
column.panels_horizontal align: 'middle', childViews: ->(horizontal) do
|
2260
|
-
horizontal.icon
|
2260
|
+
horizontal.icon name: icon_name
|
2261
2261
|
horizontal.spacer width: 6
|
2262
2262
|
horizontal.label text: icon_name
|
2263
2263
|
|
@@ -11,7 +11,7 @@ json_ui_page json do |page|
|
|
11
11
|
flow.treeView \
|
12
12
|
inputName: 'user',
|
13
13
|
url: json_ui_garage_url(path: 'forms/generic_post'),
|
14
|
-
directUploadUrl:
|
14
|
+
directUploadUrl: glib_direct_uploads_url,
|
15
15
|
width: 240,
|
16
16
|
selected: 'parent-1',
|
17
17
|
items: [
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'active_storage/service/s3_service'
|
2
|
+
|
3
|
+
module ActiveStorage
|
4
|
+
class Service::GlibS3Service < Service::S3Service
|
5
|
+
attr_accessor :tagging
|
6
|
+
|
7
|
+
# This is cause problem because S3 server ignore `x-amz-tagging` query params so it fails to tagging an object
|
8
|
+
# API: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Presigner.html#presigned_request-instance_method
|
9
|
+
# Detail about problem: https://github.com/aws/aws-sdk/issues/782
|
10
|
+
def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: {})
|
11
|
+
instrument :url, key: key do |payload|
|
12
|
+
generated_url, headers = object_for(key).presigned_request :put, expires_in: expires_in.to_i,
|
13
|
+
content_type: content_type, content_length: content_length, content_md5: checksum,
|
14
|
+
metadata: custom_metadata, whitelist_headers: ['content-length'], tagging: tagging, **upload_options
|
15
|
+
|
16
|
+
payload[:url] = generated_url
|
17
|
+
|
18
|
+
[generated_url, headers]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/glib/engine.rb
CHANGED
@@ -2,13 +2,6 @@ module Glib
|
|
2
2
|
module Web
|
3
3
|
class Engine < ::Rails::Engine
|
4
4
|
# isolate_namespace Glib::Web
|
5
|
-
|
6
|
-
# modify direct upload
|
7
|
-
config.to_prepare do
|
8
|
-
require_relative 's3_service'
|
9
|
-
require_relative 'blob'
|
10
|
-
require_relative 'direct_uploads_controller'
|
11
|
-
end
|
12
5
|
end
|
13
6
|
end
|
14
7
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
@@ -14,16 +14,16 @@ dependencies:
|
|
14
14
|
name: activestorage
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '7.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '7.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: pundit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +56,30 @@ dependencies:
|
|
56
56
|
name: actioncable
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: '7.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '7.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: js_regex
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.11'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
82
|
+
version: '3.11'
|
69
83
|
description:
|
70
84
|
email: ''
|
71
85
|
executables: []
|
@@ -86,6 +100,7 @@ files:
|
|
86
100
|
- app/controllers/concerns/glib/json/traversal.rb
|
87
101
|
- app/controllers/concerns/glib/json/ui.rb
|
88
102
|
- app/controllers/concerns/glib/json/validation.rb
|
103
|
+
- app/controllers/glib/glib_direct_uploads_controller.rb
|
89
104
|
- app/controllers/glib/home_controller.rb
|
90
105
|
- app/helpers/glib/app_feature_support_helper.rb
|
91
106
|
- app/helpers/glib/dynamic_images_helper.rb
|
@@ -302,6 +317,7 @@ files:
|
|
302
317
|
- app/views/layouts/json_ui/no_custom.html.erb
|
303
318
|
- app/views/layouts/json_ui/renderer.html.erb
|
304
319
|
- config/routes.rb
|
320
|
+
- lib/active_storage/service/glib_s3_service.rb
|
305
321
|
- lib/generators/glib/install_generator.rb
|
306
322
|
- lib/generators/templates/20191017062519_create_texts.rb
|
307
323
|
- lib/generators/templates/20191024063257_add_scope_to_texts.rb
|
@@ -310,9 +326,7 @@ files:
|
|
310
326
|
- lib/generators/templates/database.yml
|
311
327
|
- lib/generators/templates/dynamic_text.rb
|
312
328
|
- lib/glib-web.rb
|
313
|
-
- lib/glib/blob.rb
|
314
329
|
- lib/glib/crypt/utils.rb
|
315
|
-
- lib/glib/direct_uploads_controller.rb
|
316
330
|
- lib/glib/dynamic_text.rb
|
317
331
|
- lib/glib/dynamic_text/config.rb
|
318
332
|
- lib/glib/engine.rb
|
@@ -330,7 +344,6 @@ files:
|
|
330
344
|
- lib/glib/json_crawler/http.rb
|
331
345
|
- lib/glib/json_crawler/router.rb
|
332
346
|
- lib/glib/mailer_tester.rb
|
333
|
-
- lib/glib/s3_service.rb
|
334
347
|
- lib/glib/test_helpers.rb
|
335
348
|
- lib/glib/time_freezable_mailer.rb
|
336
349
|
- lib/glib/time_returning_mailer.rb
|
data/lib/glib/blob.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
::ActiveStorage::Blob.class_eval do
|
2
|
-
attr_accessor :tagging
|
3
|
-
|
4
|
-
# removing custom_metadata and add tagging
|
5
|
-
def service_headers_for_direct_upload
|
6
|
-
service.headers_for_direct_upload key, filename: filename, content_type: content_type, content_length: byte_size, checksum: checksum, tagging: tagging
|
7
|
-
end
|
8
|
-
def service_url_for_direct_upload(expires_in: ActiveStorage.service_urls_expire_in)
|
9
|
-
service.url_for_direct_upload key, expires_in: expires_in, content_type: content_type, content_length: byte_size, checksum: checksum, custom_metadata: custom_metadata, tagging: tagging
|
10
|
-
end
|
11
|
-
|
12
|
-
class << self
|
13
|
-
def create_before_direct_upload!(key: nil, filename:, byte_size:, checksum:, content_type: nil, metadata: nil, service_name: nil, record: nil, prefix: nil, tagging: nil)
|
14
|
-
key_name = key || generate_unique_secure_token
|
15
|
-
if prefix.present?
|
16
|
-
key_name = "#{prefix}/#{key_name}"
|
17
|
-
end
|
18
|
-
blob = create! key: key_name, filename: filename, byte_size: byte_size, checksum: checksum, content_type: content_type, metadata: metadata, service_name: service_name
|
19
|
-
blob.tagging = tagging
|
20
|
-
blob
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
::ActiveStorage::DirectUploadsController.class_eval do
|
2
|
-
# include Rails.application.routes.url_helpers
|
3
|
-
before_action :authenticate_user!
|
4
|
-
|
5
|
-
rescue_from StandardError do |e|
|
6
|
-
if !Rails.env.production?
|
7
|
-
raise e
|
8
|
-
end
|
9
|
-
render json: { message: 'Upload failed' }, status: 500
|
10
|
-
end
|
11
|
-
|
12
|
-
rescue_from Glib::Auth::Policy::UnauthorizedError do
|
13
|
-
render json: { message: 'Forbidden' }, status: 403
|
14
|
-
end
|
15
|
-
|
16
|
-
rescue_from ActionController::InvalidAuthenticityToken do
|
17
|
-
render json: { message: 'Session expired. Please refresh page' }, status: 401
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
def blob_args
|
22
|
-
params.require(:blob).permit(:filename, :byte_size, :checksum, :content_type, :prefix, :tagging, metadata: {}).to_h.symbolize_keys
|
23
|
-
end
|
24
|
-
|
25
|
-
def authenticate_user!
|
26
|
-
current_user.present? ? nil : raise_error
|
27
|
-
end
|
28
|
-
|
29
|
-
def raise_error
|
30
|
-
raise Glib::Auth::Policy::UnauthorizedError
|
31
|
-
end
|
32
|
-
end
|
data/lib/glib/s3_service.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'active_storage/service/s3_service'
|
2
|
-
|
3
|
-
::ActiveStorage::Service::S3Service.class_eval do
|
4
|
-
attr_reader :headers_for_request
|
5
|
-
|
6
|
-
# Change presigned_url to presigned_request
|
7
|
-
# appearently presigned_url hoist all header `x-amz-` to query params.
|
8
|
-
# This is cause problem because S3 server ignore `x-amz-tagging` query params so it fails to tagging an object
|
9
|
-
# API: https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/S3/Presigner.html#presigned_request-instance_method
|
10
|
-
# Detail about problem: https://github.com/aws/aws-sdk/issues/782
|
11
|
-
def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, tagging: nil, custom_metadata: {})
|
12
|
-
instrument :url, key: key do |payload|
|
13
|
-
generated_url, headers = object_for(key).presigned_request :put, expires_in: expires_in.to_i,
|
14
|
-
content_type: content_type, content_length: content_length, content_md5: checksum,
|
15
|
-
metadata: custom_metadata, whitelist_headers: ['content-length'], tagging: tagging, **upload_options
|
16
|
-
|
17
|
-
payload[:url] = generated_url
|
18
|
-
@headers_for_request = headers
|
19
|
-
|
20
|
-
generated_url
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def headers_for_direct_upload(key, content_type:, checksum:, filename: nil, disposition: nil, tagging: nil, custom_metadata: {}, **)
|
25
|
-
content_disposition = content_disposition_with(type: disposition, filename: filename) if filename
|
26
|
-
|
27
|
-
headers = { 'Content-Type' => content_type, 'Content-MD5' => checksum, 'Content-Disposition' => content_disposition, **custom_metadata_headers(custom_metadata) }
|
28
|
-
headers.merge(headers_for_request)
|
29
|
-
end
|
30
|
-
end
|