thecore_api 1.1.19 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb3f1313669274d375e66ac65d076013046d8f1e
4
- data.tar.gz: 251e902eb7f430c4a9f8d75cf2df6db752b66696
3
+ metadata.gz: 4150ac295cc272aad66fe0144cc5fe7a675bd3eb
4
+ data.tar.gz: 964bf8967f023d225b7d634cf6ccbfa38fee2542
5
5
  SHA512:
6
- metadata.gz: c8a4ef6afc9ba184054446ce343946cd233a5b9e15c7a3f7910ea6efbdc7518a01f0870c9851aae3a99393109a20db6b35f18b0e2f0a90e9692cd2be5f1ffcca
7
- data.tar.gz: 29a425758f62d2b10c56a326538adebec7b4e4b7c8f0426ddc18c75eca36a28c7b0a72e1459d4dd78f2eb963654618c0044f959efe6c96dc9b13acdccfa20c68
6
+ metadata.gz: 3df94866c03df4fb0aa822ec0ecfd83e349c9e3cb23d91ca4124adf0ee649ab09c34c927e52024a83b687b476ea7801311d0c7e3ac685b0563002c1b15b50026
7
+ data.tar.gz: 12efbcbef6f5ad1bf09081ab95beb773f40c19c73bb0ac4e05221e81b5ee06875c5138a1f551e39c690937f8d9e8fc936fd99b706062982bbd551e477a4a22fb
@@ -1,7 +1,15 @@
1
1
  # config/initializers/cors.rb
2
2
  Rails.application.config.middleware.insert_before 0, Rack::Cors do
3
3
  allow do
4
- origins '*'
4
+ origins { |source, env|
5
+ # No settings => '*'
6
+ allowed_origins = Settings.ns('api').allowed_origins
7
+ return true if allowed_origins.blank?
8
+ allowed_origins.split(",").each do |domain|
9
+ return true if source.end_with?(domain.strip)
10
+ end
11
+ return false
12
+ }
5
13
  resource '*',
6
14
  headers: :any,
7
15
  methods: %i(get post put patch delete options head)
@@ -0,0 +1,5 @@
1
+ class AddAllowedOriginsToSettings < ActiveRecord::Migration[5.2]
2
+ def change
3
+ Settings.ns('api').allowed_origins = "localhost:3000,127.0.0.1:3000,localhost:8081"
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module ThecoreApi
2
- VERSION = "1.1.19".freeze
2
+ VERSION = "1.2.0".freeze
3
3
  end
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.19
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-18 00:00:00.000000000 Z
11
+ date: 2018-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thecore
@@ -96,6 +96,7 @@ files:
96
96
  - config/initializers/cors_api_thecore.rb
97
97
  - config/initializers/wrap_parameters.rb
98
98
  - config/routes.rb
99
+ - db/migrate/20181120234856_add_allowed_origins_to_settings.rb
99
100
  - lib/tasks/thecore_api_tasks.rake
100
101
  - lib/thecore_api.rb
101
102
  - lib/thecore_api/engine.rb
@@ -130,6 +131,7 @@ files:
130
131
  - test/dummy/config/locales/en.yml
131
132
  - test/dummy/config/routes.rb
132
133
  - test/dummy/config/secrets.yml
134
+ - test/dummy/log/development.log
133
135
  - test/dummy/public/404.html
134
136
  - test/dummy/public/422.html
135
137
  - test/dummy/public/500.html
@@ -177,6 +179,7 @@ test_files:
177
179
  - test/dummy/public/favicon.ico
178
180
  - test/dummy/public/422.html
179
181
  - test/dummy/Rakefile
182
+ - test/dummy/log/development.log
180
183
  - test/dummy/config.ru
181
184
  - test/dummy/README.rdoc
182
185
  - test/dummy/config/locales/en.yml