neofiles 1.3.0 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bd6bd67b5f8e69f12e4b4f5302180449877bf5c2
4
- data.tar.gz: 1e80129c603885ae84c8654c0d43d361e025c239
2
+ SHA256:
3
+ metadata.gz: 6ba1967358a294458fc392576803ec6077f407fffddb810a62306a9b1f2210c8
4
+ data.tar.gz: deca6eecbca33cf4cba1a10e526e1ca6f5317bccde69c2b4f0f375cc6e0fe4d2
5
5
  SHA512:
6
- metadata.gz: 4d659abcdbcd5659e858fbe346138f04fdd33c6d4bfd6bdfdc3223e2086ba1f625583245dad8be62c7606ba5a01d91f6dfa3d6c22a8a8c4289b319a721c6f4d4
7
- data.tar.gz: 897cbe909484416ff6ef6bdff3ca33ddf8feeb86f548bd3e2ef39a6cc76f522943c1cc3e8e2222393d70d77ae098631c46b90ae35b979a46ac002404d9f716e4
6
+ metadata.gz: 6563c6d3a5a9b1df3e8e83e6c8a6f6972592766b862422799fb32b08dca00408d2b268bf3958b0826fc5225272610eea894006e5fbd1b1fe54338b6e0cb4c1c2
7
+ data.tar.gz: a8d71310a664db68c229a295537cee6d1b9caed2178156831e5ddb20e94315ab907e815db482932c3925399e51974ed9571c28cf3812f4e5a6466140727faa17
data/README.md CHANGED
@@ -407,6 +407,13 @@ end
407
407
  # picture when added is displayed on the right or left
408
408
  # also affects the order of displaying pictures
409
409
  config.neofiles.album_append_create_side = :left
410
+
411
+ # Amazon S3 settings
412
+ config.neofiles.amazon_s3_region = 'us-east'
413
+ config.neofiles.amazon_s3_api = 'KEY_ID'
414
+ config.neofiles.amazon_s3_secret = 'KEY_SECRET'
415
+ config.neofiles.amazon_s3_bucket = 'neofiles_prod'
416
+ config.neofiles.amazon_s3_endpoint = 'https://some-s3-provider.com' # optional
410
417
  ```
411
418
 
412
419
  Roadmap, TODOs
@@ -2,6 +2,7 @@
2
2
  # If you want to work with amazon s3 you need set values for the following parameters in your config file
3
3
  # amazon_s3_region - the AWS region to connect to. The region is used to construct the client endpoint.
4
4
  # amazon_s3_api, amazon_s3_secret - used to set credentials statically
5
+ # amazon_s3_endpoint - change if using another S3-compatible provider
5
6
  # bucket_name - storage name in amazon_s3. Bucket must have a name that conforms to the naming requirements for non-US Standard regions.
6
7
  # http://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-s3-bucket-naming-requirements.html
7
8
  # File will be named as id of the Neofiles::File object
@@ -81,15 +82,23 @@ class Neofiles::DataStore::AmazonS3
81
82
  end
82
83
 
83
84
  def client
84
- @client ||= Aws::S3::Client.new(
85
- region: Rails.application.config.neofiles.amazon_s3_region,
86
- credentials: Aws::Credentials.new(
87
- Rails.application.config.neofiles.amazon_s3_api,
88
- Rails.application.config.neofiles.amazon_s3_secret
89
- )
90
- )
85
+ @client ||= Aws::S3::Client.new(client_params)
91
86
  rescue Aws::S3::Errors::ServiceError
92
87
  nil
93
88
  end
94
89
 
90
+ def client_params
91
+ {
92
+ region: Rails.application.config.neofiles.amazon_s3_region,
93
+ credentials: Aws::Credentials.new(
94
+ Rails.application.config.neofiles.amazon_s3_api,
95
+ Rails.application.config.neofiles.amazon_s3_secret
96
+ )
97
+ }.tap do |result|
98
+ if Rails.application.config.neofiles.amazon_s3_endpoint
99
+ result[:endpoint] = Rails.application.config.neofiles.amazon_s3_endpoint
100
+ end
101
+ end
102
+ end
103
+
95
104
  end
@@ -1,3 +1,3 @@
1
1
  module Neofiles
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.2'
3
3
  end
data/lib/neofiles.rb CHANGED
@@ -20,7 +20,7 @@ module Neofiles
20
20
 
21
21
  # web frontend for serving images and other files
22
22
  get '/serve/:id', to: 'files#show', as: :neofiles_file
23
- get '/serve-image/:id(/:format(/c:crop)(/q:quality))', to: 'images#show', as: :neofiles_image, constraints: {format: /[1-9]\d*x[1-9]\d*/, crop: /[10]/, quality: /[1-9]\d*/}
23
+ get '/serve-image/:id(/:format(/c:crop)(/q:quality))', to: 'images#show', as: :neofiles_image, format: false, constraints: {format: /[1-9]\d*x[1-9]\d*/, crop: /[10]/, quality: /[1-9]\d*/}
24
24
 
25
25
  # serve images w/o watermark - path has prefix nowm_ to let Nginx ot other web server not cache these queries,
26
26
  # unlike usual /serve-image/:id
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neofiles
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konanykhin Ilya
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-10 00:00:00.000000000 Z
11
+ date: 2023-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -155,7 +155,7 @@ homepage: http://neoweb.kz
155
155
  licenses:
156
156
  - MIT
157
157
  metadata: {}
158
- post_install_message:
158
+ post_install_message:
159
159
  rdoc_options: []
160
160
  require_paths:
161
161
  - lib
@@ -170,9 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
170
  - !ruby/object:Gem::Version
171
171
  version: '0'
172
172
  requirements: []
173
- rubyforge_project:
174
- rubygems_version: 2.6.12
175
- signing_key:
173
+ rubygems_version: 3.0.9
174
+ signing_key:
176
175
  specification_version: 4
177
176
  summary: Serves and manages files & images.
178
177
  test_files: []