jj-middleware 3.1.0 → 3.1.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: 3f317b5db82cca5c4c981ce143646ae2eef4fb19
4
- data.tar.gz: 362f85b29caee84acc3384d70966b12684a3560d
3
+ metadata.gz: c8697c185d2706398041c54c46d161a3e2999046
4
+ data.tar.gz: f6d7107453964aaeb88c04fcb28e1e278c77478e
5
5
  SHA512:
6
- metadata.gz: b1967d1c2f795f0e899cec64e829a908c0c80c391e5f95c91fee2e8fbf78e2a891b01144b5700cb2aacded60c4686bdd0cc1525c69131caab8d9d792fcf56faf
7
- data.tar.gz: 1325358a38bf6cb0392e26de2d1fdbe3001b25373c25e13565b66cd2fabe291edd60e09d24db4c3e865e51b5205c84520b00fd91d123f8ebe25fc896a9751d86
6
+ metadata.gz: 32546eb6b323c6763e4fa35df331348f588b60e4a3a7c1eab648c26c5d91dc44ea3d6d63f0ae1bb48ba4667036aaf3e736678f01e2df139e53efc71bca560887
7
+ data.tar.gz: e045e771531b66e4ea970f8bf1d2afd4bb1a4af079bed7ade61c8781dc967c9016dfd4b310f8f4c505b158495ba22cadd3ba95c9fe823f7ace4b6d52dbb6ec4d
@@ -1,5 +1,5 @@
1
1
  module JJ
2
2
  module Middleware
3
- VERSION = '3.1.0'.freeze
3
+ VERSION = '3.1.1'.freeze
4
4
  end
5
5
  end
@@ -13,10 +13,10 @@ module JJ
13
13
  host_parts = request.host.split('.')
14
14
  sub_domain = host_parts.shift
15
15
 
16
- if sub_domain != CREATOR_SUB_DOMAIN && request.path != '/'
17
- redirect(generate_path(host_parts, request), 301)
18
- else
16
+ if on_profile_page?(sub_domain, request) || status_endpoint?(request)
19
17
  @app.call(env)
18
+ else
19
+ redirect(generate_path(host_parts, request), 301)
20
20
  end
21
21
  end
22
22
 
@@ -24,6 +24,14 @@ module JJ
24
24
 
25
25
  CREATOR_SUB_DOMAIN = 'creator'
26
26
 
27
+ def status_endpoint?(request)
28
+ request.path == '/status'
29
+ end
30
+
31
+ def on_profile_page?(sub_domain, request)
32
+ sub_domain != CREATOR_SUB_DOMAIN && request.path == '/'
33
+ end
34
+
27
35
  def generate_path(parts, request)
28
36
  path_format = '%s://%s%s'
29
37
  path = parts.unshift(CREATOR_SUB_DOMAIN).join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jj-middleware
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''