cyclid-ui 0.2.0 → 0.2.1

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
2
  SHA1:
3
- metadata.gz: 149e04846774e4747d1536102a1c02ccce49fd55
4
- data.tar.gz: a6f68dca217f538ba9d663f4e22a899c406c3ccb
3
+ metadata.gz: ca86e931e0eb566c2bf638de74c388e675222437
4
+ data.tar.gz: 26afc5f71cf7f4ade5ae25cc6c57b9babe9dab80
5
5
  SHA512:
6
- metadata.gz: fe51e9570ecbbeb8b99157fe38075ca3dcf79fd6df17f2e65c7bb9118d310edca8cf674a0baea402decbc56f182a9b0da0f32132fd6e949e9d1714967db98649
7
- data.tar.gz: 5cd1e04814d5be7d64cbd619df01cc2f73516702a93c6d3c54c94e3bab62efb628ab437ed6aab23404a187b9986b87f2435bbff9aa3650f24fc3ed728c661708
6
+ metadata.gz: 106ad7cb054099d963434b127d7dda2cfbedbe9dc66f4fcbc8147456b063534d7d7ea3dc9e56a36bb8dfa446f4a0870bdf267ce500817c8d12e61c33975175c0
7
+ data.tar.gz: b56757b82268f45d2774c3e0390798b17ef6f190c34c636e94143ce014fef7686b64bc748501a77bb9d944b6969a0a1a3e7aea45a6ccecde771f586ff350de62
@@ -17,6 +17,7 @@ require 'require_all'
17
17
  require 'logger'
18
18
  require 'warden'
19
19
  require 'memcached'
20
+ require 'sinatra/cross_origin'
20
21
  require 'sinatra/flash'
21
22
  require 'rack/csrf'
22
23
 
@@ -53,13 +54,6 @@ module Cyclid
53
54
  module UI
54
55
  # Sinatra application
55
56
  class App < Sinatra::Application
56
- configure do
57
- set sessions: true,
58
- secure: production?,
59
- expire_after: 31_557_600,
60
- secret: ENV['SESSION_SECRET']
61
- end
62
-
63
57
  use Rack::Deflater
64
58
  use Rack::Session::Cookie
65
59
  use Rack::Csrf, raise: true,
@@ -70,6 +64,26 @@ module Cyclid
70
64
 
71
65
  register Sinatra::Flash
72
66
 
67
+ configure do
68
+ set sessions: true,
69
+ secure: production?,
70
+ expire_after: 31_557_600,
71
+ secret: ENV['SESSION_SECRET']
72
+ set allow_origin: :any,
73
+ allow_methods: [:get, :put, :post, :options],
74
+ allow_credentials: true,
75
+ max_age: '1728000',
76
+ expose_headers: ['Content-Type']
77
+ disable :show_exceptions
78
+ end
79
+
80
+ options '*' do
81
+ response.headers['Allow'] = 'HEAD,GET,PUT,POST,DELETE,OPTIONS'
82
+ response.headers['Access-Control-Allow-Headers'] =
83
+ 'Content-Type, Cache-Control, Accept, Authorization'
84
+ 200
85
+ end
86
+
73
87
  # Configure Warden to authenticate
74
88
  use Warden::Manager do |config|
75
89
  config.serialize_into_session(&:username)
@@ -12,6 +12,7 @@
12
12
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
+ require 'sinatra/cross_origin'
15
16
  require 'sinatra-health-check'
16
17
  require 'memcached'
17
18
 
@@ -21,6 +22,8 @@ module Cyclid
21
22
  module Controllers
22
23
  # Controller for all Health related API endpoints
23
24
  class Health < Base
25
+ register Sinatra::CrossOrigin
26
+
24
27
  def initialize(_app)
25
28
  super
26
29
  @checker = SinatraHealthCheck::Checker.new(logger: Cyclid.logger,
@@ -35,6 +38,7 @@ module Cyclid
35
38
  # the healthchecks. This is intended to be used by things like load
36
39
  # balancers and active monitors.
37
40
  get '/health/status' do
41
+ cross_origin
38
42
  @checker.healthy? ? 200 : 503
39
43
  end
40
44
 
@@ -43,6 +47,7 @@ module Cyclid
43
47
  # not suitable for general health checks unless the caller intends to
44
48
  # parse the message body for the health status.
45
49
  get '/health/info' do
50
+ cross_origin
46
51
  @checker.status.to_json
47
52
  end
48
53
  end
@@ -47,6 +47,10 @@
47
47
  {{#organizations}}
48
48
  <li><a href="/{{.}}">{{.}}</a></li>
49
49
  {{/organizations}}
50
+ {{#signup}}
51
+ <li role="separator" class="divider"></li>
52
+ <li><a href="{{signup}}/organization" target="_blank">Create a new Organization</a></li>
53
+ {{/signup}}
50
54
  </ul>
51
55
  </li>
52
56
  </ul>
@@ -23,6 +23,9 @@
23
23
  <div class="dl-horizontal text-muted pad-20">
24
24
  <dt>Email</dt><dd id="user_email"></dd>
25
25
  <dt>Organizations</dt><dd id="user_org_list"></dd>
26
+ {{#signup}}
27
+ <dd><a href="{{signup}}/organization" target="_blank">Create a new Organization</a></dd>
28
+ {{/signup}}
26
29
  </div>
27
30
  </div>
28
31
 
@@ -46,6 +46,10 @@ module Cyclid
46
46
  hash = Digest::MD5.hexdigest(email)
47
47
  "https://www.gravatar.com/avatar/#{hash}?d=identicon&r=g"
48
48
  end
49
+
50
+ def signup
51
+ Cyclid.config.signup
52
+ end
49
53
  end
50
54
  end
51
55
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Cyclid
3
3
  module UI
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  end
6
6
  end
@@ -61,6 +61,9 @@ a:hover {
61
61
  .navbar-layout .navbar-nav>li>.dropdown-menu a:hover {
62
62
  background-color: #6f6f6e;
63
63
  }
64
+ .navbar-layout .navbar-nav>li>.dropdown-menu>.divider {
65
+ background-color: #6f6f6e;
66
+ }
64
67
 
65
68
  /* navbar text */
66
69
  .navbar-layout .navbar-text {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyclid-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kristian Van Der Vliet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-24 00:00:00.000000000 Z
11
+ date: 2016-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: require_all
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sinatra-cross_origin
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.3'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rack_csrf
57
71
  requirement: !ruby/object:Gem::Requirement