jj-middleware 3.1.0 → 3.1.1
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 +4 -4
- data/lib/jj/middleware.rb +1 -1
- data/lib/jj/middleware/username_correction.rb +11 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8697c185d2706398041c54c46d161a3e2999046
|
4
|
+
data.tar.gz: f6d7107453964aaeb88c04fcb28e1e278c77478e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32546eb6b323c6763e4fa35df331348f588b60e4a3a7c1eab648c26c5d91dc44ea3d6d63f0ae1bb48ba4667036aaf3e736678f01e2df139e53efc71bca560887
|
7
|
+
data.tar.gz: e045e771531b66e4ea970f8bf1d2afd4bb1a4af079bed7ade61c8781dc967c9016dfd4b310f8f4c505b158495ba22cadd3ba95c9fe823f7ace4b6d52dbb6ec4d
|
data/lib/jj/middleware.rb
CHANGED
@@ -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
|
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('.')
|