froala-editor-sdk 1.2.0 → 4.0.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 +5 -5
- data/lib/froala-editor-sdk.rb +11 -11
- data/lib/froala-editor-sdk/file.rb +113 -108
- data/lib/froala-editor-sdk/image.rb +37 -33
- data/lib/froala-editor-sdk/s3.rb +95 -60
- data/lib/froala-editor-sdk/utils/utils.rb +18 -18
- data/lib/froala-editor-sdk/utils/validation.rb +34 -34
- data/lib/froala-editor-sdk/version.rb +8 -8
- data/lib/froala-editor-sdk/video.rb +19 -18
- metadata +11 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b9a480de43d7ab38e6c584f2619b9c616b3256885ce624b879efcee7f926ecd2
|
4
|
+
data.tar.gz: 4edd6556ad1a0049b1b7a8fda4ffc61293d76a5612f5ba70f7a95166d87ca59b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6af3df5f2c0bedf6a15bdf8c5bb060e1032f535c74abfc99fdf5d98cff73522d4c66c1520796ebb5d822a6b8f99e37ba366e572c0f5ce681f6ae0199985e3352
|
7
|
+
data.tar.gz: a7645f764dcfc0b14679e32b8470e165b1e53616f37edb779de8c9725461f69b155b7d5d6c6e961dfd4ada294fe641ee6797966fec5e8f4adc2b3e3332aa2cd4
|
data/lib/froala-editor-sdk.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require 'mime-types'
|
2
|
-
require 'mini_magick'
|
3
|
-
require 'froala-editor-sdk/utils/validation'
|
4
|
-
require 'froala-editor-sdk/utils/utils'
|
5
|
-
|
6
|
-
|
7
|
-
require 'froala-editor-sdk/file'
|
8
|
-
require 'froala-editor-sdk/image'
|
9
|
-
require 'froala-editor-sdk/s3'
|
10
|
-
require 'froala-editor-sdk/version'
|
11
|
-
require 'froala-editor-sdk/video'
|
1
|
+
require 'mime-types'
|
2
|
+
require 'mini_magick'
|
3
|
+
require 'froala-editor-sdk/utils/validation'
|
4
|
+
require 'froala-editor-sdk/utils/utils'
|
5
|
+
|
6
|
+
|
7
|
+
require 'froala-editor-sdk/file'
|
8
|
+
require 'froala-editor-sdk/image'
|
9
|
+
require 'froala-editor-sdk/s3'
|
10
|
+
require 'froala-editor-sdk/version'
|
11
|
+
require 'froala-editor-sdk/video'
|
@@ -1,109 +1,114 @@
|
|
1
|
-
module FroalaEditorSDK
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
# File functionality.
|
6
|
-
class File
|
7
|
-
|
8
|
-
# Default options that are used if no options are passed to the upload function
|
9
|
-
@default_options = {
|
10
|
-
fieldname: 'file',
|
11
|
-
validation: {
|
12
|
-
allowedExts: [".txt", ".pdf", ".doc", ".json", ".html"],
|
13
|
-
allowedMimeTypes: [ "text/plain", "application/msword", "application/x-pdf", "application/pdf", "application/json","text/html" ]
|
14
|
-
},
|
15
|
-
resize: nil
|
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
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
#
|
77
|
-
#
|
78
|
-
# +
|
79
|
-
#
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
1
|
+
module FroalaEditorSDK
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
# File functionality.
|
6
|
+
class File
|
7
|
+
|
8
|
+
# Default options that are used if no options are passed to the upload function
|
9
|
+
@default_options = {
|
10
|
+
fieldname: 'file',
|
11
|
+
validation: {
|
12
|
+
allowedExts: [".txt", ".pdf", ".doc", ".json", ".html"],
|
13
|
+
allowedMimeTypes: [ "text/plain", "application/msword", "application/x-pdf", "application/pdf", "application/json","text/html" ]
|
14
|
+
},
|
15
|
+
resize: nil,
|
16
|
+
file_access_path: '/uploads/'
|
17
|
+
}
|
18
|
+
|
19
|
+
# Default upload path.
|
20
|
+
@default_upload_path = "public/uploads/files"
|
21
|
+
|
22
|
+
# Uploads a file to the server.
|
23
|
+
# Params:
|
24
|
+
# +params+:: File upload parameter mostly is "file".
|
25
|
+
# +upload_path+:: Server upload path, a storage path where the file will be stored.
|
26
|
+
# +options+:: Hash object that contains configuration parameters for uploading a file.
|
27
|
+
# Returns json object
|
28
|
+
def self.upload(params, upload_path = @default_upload_path, options = {})
|
29
|
+
|
30
|
+
# Merge options.
|
31
|
+
options = @default_options.merge(options)
|
32
|
+
|
33
|
+
file = params[options[:fieldname]]
|
34
|
+
|
35
|
+
if file
|
36
|
+
|
37
|
+
# Validates the file extension and mime type.
|
38
|
+
validation = Validation.check(file, options)
|
39
|
+
|
40
|
+
# Uses the Utlis name function to generate a random name for the file.
|
41
|
+
file_name = Utils.name(file)
|
42
|
+
path = Rails.root.join(upload_path, file_name)
|
43
|
+
|
44
|
+
# Saves the file on the server and returns the path.
|
45
|
+
serve_url = save(file, path, options[:file_access_path])
|
46
|
+
|
47
|
+
resize(options, path) if !options[:resize].nil?
|
48
|
+
|
49
|
+
return {:link => serve_url}.to_json
|
50
|
+
else
|
51
|
+
return nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Saves a file on the server.
|
56
|
+
# Params:
|
57
|
+
# +file+:: The uploaded file that will be saved on the server.
|
58
|
+
# +path+:: The path where the file will be saved.
|
59
|
+
def self.save (file, path, file_access_path)
|
60
|
+
|
61
|
+
# Create directory if it doesn't exist.
|
62
|
+
dirname = ::File.dirname(path)
|
63
|
+
unless ::File.directory?(dirname)
|
64
|
+
::FileUtils.mkdir_p(dirname)
|
65
|
+
end
|
66
|
+
|
67
|
+
if ::File.open(path, "wb") {|f| f.write(file.read)}
|
68
|
+
|
69
|
+
# Returns a public accessible server path.
|
70
|
+
return "#{file_access_path}#{Utils.get_file_name(path)}"
|
71
|
+
else
|
72
|
+
return "error"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Deletes a file found on the server.
|
77
|
+
# Params:
|
78
|
+
# +file+:: The file that will be deleted from the server.
|
79
|
+
# +path+:: The server path where the file resides.
|
80
|
+
# Returns true or false.
|
81
|
+
def self.delete(file = params[:file], path)
|
82
|
+
|
83
|
+
file_path = Rails.root.join(path, ::File.basename(file))
|
84
|
+
begin
|
85
|
+
if ::File.delete(file_path)
|
86
|
+
return true
|
87
|
+
else
|
88
|
+
return false
|
89
|
+
end
|
90
|
+
rescue => exception
|
91
|
+
return false
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Resizes an image based on the options provided.
|
96
|
+
# The function resizes the original file,
|
97
|
+
# Params:
|
98
|
+
# +options+:: The options that contain the resize hash
|
99
|
+
# +path+:: The path where the image is stored
|
100
|
+
def self.resize (options, path)
|
101
|
+
image = MiniMagick::Image.new(path)
|
102
|
+
image.path
|
103
|
+
image.resize("#{options[:resize][:width]}x#{options[:resize][:height]}")
|
104
|
+
end
|
105
|
+
|
106
|
+
class << self
|
107
|
+
attr_reader :var
|
108
|
+
end
|
109
|
+
|
110
|
+
def var
|
111
|
+
self.class.var
|
112
|
+
end
|
113
|
+
end
|
109
114
|
end
|
@@ -1,34 +1,38 @@
|
|
1
|
-
module FroalaEditorSDK
|
2
|
-
# Image functionality.
|
3
|
-
class Image < File
|
4
|
-
|
5
|
-
# Default options that are used if no options are passed to the upload function.
|
6
|
-
@default_options = {
|
7
|
-
fieldname: 'file',
|
8
|
-
validation: {
|
9
|
-
allowedExts: [".gif", ".jpeg", ".jpg", ".png", ".svg", ".blob"],
|
10
|
-
allowedMimeTypes: [ "image/gif", "image/jpeg", "image/pjpeg", "image/x-png", "image/png", "image/svg+xml" ]
|
11
|
-
},
|
12
|
-
resize: nil
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
1
|
+
module FroalaEditorSDK
|
2
|
+
# Image functionality.
|
3
|
+
class Image < File
|
4
|
+
|
5
|
+
# Default options that are used if no options are passed to the upload function.
|
6
|
+
@default_options = {
|
7
|
+
fieldname: 'file',
|
8
|
+
validation: {
|
9
|
+
allowedExts: [".gif", ".jpeg", ".jpg", ".png", ".svg", ".blob"],
|
10
|
+
allowedMimeTypes: [ "image/gif", "image/jpeg", "image/pjpeg", "image/x-png", "image/png", "image/svg+xml" ]
|
11
|
+
},
|
12
|
+
resize: nil,
|
13
|
+
file_access_path: '/uploads/'
|
14
|
+
}
|
15
|
+
|
16
|
+
# Default upload path.
|
17
|
+
@default_upload_path = "public/uploads/images"
|
18
|
+
|
19
|
+
# Loads the images from a specific path
|
20
|
+
# Params:
|
21
|
+
# +path+:: The server path where the images are saved
|
22
|
+
# Returns Json object
|
23
|
+
def self.load_images(path, options = {})
|
24
|
+
|
25
|
+
# Merge options.
|
26
|
+
options = @default_options.merge(options)
|
27
|
+
|
28
|
+
images = Dir["#{path}*"]
|
29
|
+
all_images = []
|
30
|
+
|
31
|
+
images.each do |img|
|
32
|
+
all_images.push({url: "#{options[:file_access_path]}#{Utils.get_file_name(img)}"})
|
33
|
+
end
|
34
|
+
|
35
|
+
return all_images.to_json
|
36
|
+
end
|
37
|
+
end
|
34
38
|
end
|
data/lib/froala-editor-sdk/s3.rb
CHANGED
@@ -1,61 +1,96 @@
|
|
1
|
-
module FroalaEditorSDK
|
2
|
-
|
3
|
-
# Uploads files to S3/AWS
|
4
|
-
class S3
|
5
|
-
|
6
|
-
# Builds a signature based on the options.
|
7
|
-
# Params:
|
8
|
-
# +options+:: The configuration params that are needed to compute the signature.
|
9
|
-
def self.signature (options = nil)
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
1
|
+
module FroalaEditorSDK
|
2
|
+
|
3
|
+
# Uploads files to S3/AWS
|
4
|
+
class S3
|
5
|
+
|
6
|
+
# Builds a signature based on the options.
|
7
|
+
# Params:
|
8
|
+
# +options+:: The configuration params that are needed to compute the signature.
|
9
|
+
def self.signature (options = nil)
|
10
|
+
OpenSSL::HMAC.hexdigest(
|
11
|
+
"SHA256",
|
12
|
+
self.sign(
|
13
|
+
self.sign(
|
14
|
+
self.sign(
|
15
|
+
self.sign(
|
16
|
+
("AWS4" + options[:secretKey]).force_encoding(Encoding::UTF_8),
|
17
|
+
options[:'date-string']
|
18
|
+
),
|
19
|
+
options[:region]
|
20
|
+
),
|
21
|
+
"s3"
|
22
|
+
),
|
23
|
+
"aws4_request"
|
24
|
+
),
|
25
|
+
self.policy(options)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Builds a HMAC-SHA256 digest using key and data
|
30
|
+
# Params:
|
31
|
+
# +key+:: Key to use for creating the digest
|
32
|
+
# +data+:: Data to be used for creating the digest
|
33
|
+
def self.sign(key, data)
|
34
|
+
OpenSSL::HMAC.digest(OpenSSL::Digest::SHA256.new, key, data.force_encoding(Encoding::UTF_8))
|
35
|
+
end
|
36
|
+
|
37
|
+
# Encodes to Base64 the policy data and replaces new lines chars.
|
38
|
+
# Params:
|
39
|
+
# +options+:: The configuration params that are needed to compute the signature.
|
40
|
+
def self.policy (options = nil)
|
41
|
+
Base64.encode64(self.policy_data(options).to_json).gsub("\n", "")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Sets policy params, bucket that will be used max file size and other params.
|
45
|
+
# Params:
|
46
|
+
# +options+:: Configuration params that are needed to set the policy
|
47
|
+
def self.policy_data (options = nil)
|
48
|
+
{
|
49
|
+
expiration: 10.hours.from_now.utc.iso8601,
|
50
|
+
conditions: [
|
51
|
+
["starts-with", "$key", options[:keyStart]], # Start key/folder
|
52
|
+
["starts-with", "$Content-type", ""], # Content type
|
53
|
+
{"x-requested-with": "xhr"}, # Request type
|
54
|
+
{"x-amz-algorithm": options[:'x-amz-algorithm']}, # Encrytion Algorithm
|
55
|
+
{"x-amz-date": options[:'x-amz-date']}, # Current Date
|
56
|
+
{"x-amz-credential": options[:'x-amz-credential']}, # Encrypted Credentials
|
57
|
+
{bucket: options[:bucket]}, # Bucket name
|
58
|
+
{acl: options[:acl]}, # ACL property
|
59
|
+
{success_action_status: "201"} # Response status 201 'file created'
|
60
|
+
]
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
# Builds the amazon credential by appending access key, x-amz-date, region and 's3/aws4_request'
|
65
|
+
# Params:
|
66
|
+
# +options+:: Configuration params to generate the AWS response
|
67
|
+
def self.getXamzCredential(options = nil)
|
68
|
+
"#{options[:accessKey]}#{"/"}#{options[:'date-string']}#{"/"}#{options[:region]}#{"/"}#{"s3/aws4_request"}"
|
69
|
+
end
|
70
|
+
|
71
|
+
# Makes all the request in order and returns AWS hash response
|
72
|
+
# Params:
|
73
|
+
# +options+:: Configuration params to generate the AWS response.
|
74
|
+
def self.data_hash (options = nil)
|
75
|
+
options[:region] = 'us-east-1' if options[:region].nil? || options[:region] == 's3'
|
76
|
+
options[:'date-string'] = Time.now.strftime("%Y%m%d")
|
77
|
+
options[:'x-amz-algorithm'] = "AWS4-HMAC-SHA256"
|
78
|
+
options[:'x-amz-credential'] = self.getXamzCredential(options)
|
79
|
+
options[:'x-amz-date'] = options[:'date-string'] + "T000000Z"
|
80
|
+
|
81
|
+
{
|
82
|
+
:bucket => options[:bucket], # Upload bucket
|
83
|
+
:region => options[:region] != 'us-east-1' ? "s3-#{options[:region]}" : 's3', # Upload region
|
84
|
+
:keyStart => options[:keyStart], # Start key/folder
|
85
|
+
:params => {
|
86
|
+
:acl => options[:acl], # ACL property 'public-read'
|
87
|
+
:policy => self.policy(options), # Defined policy
|
88
|
+
:'x-amz-algorithm' => options[:'x-amz-algorithm'], # Encrytion Algorithm
|
89
|
+
:'x-amz-credential' => options[:'x-amz-credential'], # Encrypted Credentials
|
90
|
+
:'x-amz-date' => options[:'x-amz-date'], # Current Date
|
91
|
+
:'x-amz-signature' => self.signature(options), # Defined signature
|
92
|
+
}
|
93
|
+
}
|
94
|
+
end
|
95
|
+
end
|
61
96
|
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
module FroalaEditorSDK
|
2
|
-
|
3
|
-
# Basic utility functionality.
|
4
|
-
class Utils
|
5
|
-
|
6
|
-
# Generates a random name that will be used as name for files.
|
7
|
-
def self.name (file)
|
8
|
-
name = SecureRandom.urlsafe_base64
|
9
|
-
ext = ::File.extname(file.original_filename)
|
10
|
-
|
11
|
-
return "#{name}#{ext}"
|
12
|
-
end
|
13
|
-
|
14
|
-
# Returns file name from an file path
|
15
|
-
def self.get_file_name(path)
|
16
|
-
return ::File.basename(path)
|
17
|
-
end
|
18
|
-
end
|
1
|
+
module FroalaEditorSDK
|
2
|
+
|
3
|
+
# Basic utility functionality.
|
4
|
+
class Utils
|
5
|
+
|
6
|
+
# Generates a random name that will be used as name for files.
|
7
|
+
def self.name (file)
|
8
|
+
name = SecureRandom.urlsafe_base64
|
9
|
+
ext = ::File.extname(file.original_filename)
|
10
|
+
|
11
|
+
return "#{name}#{ext}"
|
12
|
+
end
|
13
|
+
|
14
|
+
# Returns file name from an file path
|
15
|
+
def self.get_file_name(path)
|
16
|
+
return ::File.basename(path)
|
17
|
+
end
|
18
|
+
end
|
19
19
|
end
|
@@ -1,35 +1,35 @@
|
|
1
|
-
module FroalaEditorSDK
|
2
|
-
|
3
|
-
# Image Validation class.
|
4
|
-
# Checks if image is matching the allowed extensions and mime types.
|
5
|
-
class Validation
|
6
|
-
require "mime-types"
|
7
|
-
|
8
|
-
def self.ext(ext, options)
|
9
|
-
raise "Not allowed" unless options[:validation][:allowedExts].include?(ext)
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.mime(mime, options)
|
13
|
-
raise "Invalid mime type" unless options[:validation][:allowedMimeTypes].include?(mime)
|
14
|
-
end
|
15
|
-
|
16
|
-
# Checks an image with the options.
|
17
|
-
# Params:
|
18
|
-
# +file+:: The image that will be validated.
|
19
|
-
# +options+:: The image options that contain allowed extensions and mime types.
|
20
|
-
# Raises exception if the image has not passed the validation
|
21
|
-
def self.check(file, options = nil)
|
22
|
-
|
23
|
-
mime = file.content_type
|
24
|
-
ext = ::File.extname(file.original_filename)
|
25
|
-
|
26
|
-
# Check if there is custom validation.
|
27
|
-
if options[:validation].class != Proc
|
28
|
-
ext(ext, options) && mime(mime, options)
|
29
|
-
else
|
30
|
-
options[:validation].call(file.path, mime)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
1
|
+
module FroalaEditorSDK
|
2
|
+
|
3
|
+
# Image Validation class.
|
4
|
+
# Checks if image is matching the allowed extensions and mime types.
|
5
|
+
class Validation
|
6
|
+
require "mime-types"
|
7
|
+
|
8
|
+
def self.ext(ext, options)
|
9
|
+
raise "Not allowed" unless options[:validation][:allowedExts].include?(ext)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.mime(mime, options)
|
13
|
+
raise "Invalid mime type" unless options[:validation][:allowedMimeTypes].include?(mime)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Checks an image with the options.
|
17
|
+
# Params:
|
18
|
+
# +file+:: The image that will be validated.
|
19
|
+
# +options+:: The image options that contain allowed extensions and mime types.
|
20
|
+
# Raises exception if the image has not passed the validation
|
21
|
+
def self.check(file, options = nil)
|
22
|
+
|
23
|
+
mime = file.content_type
|
24
|
+
ext = ::File.extname(file.original_filename)
|
25
|
+
|
26
|
+
# Check if there is custom validation.
|
27
|
+
if options[:validation].class != Proc
|
28
|
+
ext(ext, options) && mime(mime, options)
|
29
|
+
else
|
30
|
+
options[:validation].call(file.path, mime)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
35
|
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
module FroalaEditorSDK
|
2
|
-
module Version
|
3
|
-
Major =
|
4
|
-
Minor =
|
5
|
-
Tiny = 0
|
6
|
-
|
7
|
-
String = "#{Major}.#{Minor}.#{Tiny}"
|
8
|
-
end
|
1
|
+
module FroalaEditorSDK
|
2
|
+
module Version
|
3
|
+
Major = 4
|
4
|
+
Minor = 0
|
5
|
+
Tiny = 0
|
6
|
+
|
7
|
+
String = "#{Major}.#{Minor}.#{Tiny}"
|
8
|
+
end
|
9
9
|
end
|
@@ -1,19 +1,20 @@
|
|
1
|
-
module FroalaEditorSDK
|
2
|
-
|
3
|
-
# Video functionality.
|
4
|
-
class Video < File
|
5
|
-
|
6
|
-
# Default options that are used if no options are passed to the upload function
|
7
|
-
@default_options = {
|
8
|
-
fieldname: 'file',
|
9
|
-
validation: {
|
10
|
-
allowedExts: [".mp4", ".webm", ".ogg"],
|
11
|
-
allowedMimeTypes: [ "video/mp4", "video/webm", "video/ogg" ]
|
12
|
-
},
|
13
|
-
resize: nil
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
1
|
+
module FroalaEditorSDK
|
2
|
+
|
3
|
+
# Video functionality.
|
4
|
+
class Video < File
|
5
|
+
|
6
|
+
# Default options that are used if no options are passed to the upload function
|
7
|
+
@default_options = {
|
8
|
+
fieldname: 'file',
|
9
|
+
validation: {
|
10
|
+
allowedExts: [".mp4", ".webm", ".ogg"],
|
11
|
+
allowedMimeTypes: [ "video/mp4", "video/webm", "video/ogg" ]
|
12
|
+
},
|
13
|
+
resize: nil,
|
14
|
+
file_access_path: '/uploads/'
|
15
|
+
}
|
16
|
+
|
17
|
+
# Default upload path.
|
18
|
+
@default_upload_path = "public/uploads/videos"
|
19
|
+
end
|
19
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: froala-editor-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Froala Labs
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mime-types
|
@@ -30,30 +30,30 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mini_magick
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.5
|
47
|
+
version: '4.5'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.5
|
54
|
+
version: '4.5'
|
55
55
|
description: Ruby SDK for Froala Editor
|
56
|
-
email:
|
56
|
+
email:
|
57
57
|
executables: []
|
58
58
|
extensions: []
|
59
59
|
extra_rdoc_files: []
|
@@ -70,7 +70,7 @@ homepage: https://github.com/froala/wysiwyg-editor-ruby-sdk
|
|
70
70
|
licenses:
|
71
71
|
- MIT
|
72
72
|
metadata: {}
|
73
|
-
post_install_message:
|
73
|
+
post_install_message:
|
74
74
|
rdoc_options: []
|
75
75
|
require_paths:
|
76
76
|
- lib
|
@@ -85,9 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
|
89
|
-
|
90
|
-
signing_key:
|
88
|
+
rubygems_version: 3.0.3.1
|
89
|
+
signing_key:
|
91
90
|
specification_version: 4
|
92
91
|
summary: Ruby on Rails SDK for Froala WYSIWYG Editor.
|
93
92
|
test_files: []
|