routing-filter-codeur 0.7.1.1 → 0.7.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/routing_filter/adapters/routers/journey.rb +25 -7
- data/lib/routing_filter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d471f2df5df783d7ff49326fddeb891cd698f580e48044945e969fc9d65e105
|
4
|
+
data.tar.gz: 938019b4ade919fd8d8291c89bb9b309dd9f3afa0870ca9b3a225739911347fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3524f4dca5e3a1a90aff4a04cb6b68581bad7b17c454d7e214ce86f9d8fb1501a495c6d37ba40d57b357d07232acdb2119de18c208389ea8572c95088df8db35
|
7
|
+
data.tar.gz: c35b8a1711a4904cae16562fb9df5181d66baff0a020a43805f7835474235ec222e8f50187dca2e26401512250f1b9859eb92de581fb7b5a1e15afbe57328a29
|
@@ -1,25 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Prepend the method lookup to intercept find_routes in rails.
|
4
|
+
#
|
5
|
+
# This enables us to intercept the incoming route paths before they are
|
6
|
+
# recognized by the rails router and transformed to a route set and dispatched
|
7
|
+
# to a controller.
|
1
8
|
module ActionDispatchJourneyRouterWithFiltering
|
2
9
|
def find_routes(env)
|
3
|
-
path = env.is_a?(Hash)
|
10
|
+
path = if env.is_a?(Hash)
|
11
|
+
env['PATH_INFO']
|
12
|
+
else
|
13
|
+
env.path_info
|
14
|
+
end
|
15
|
+
|
4
16
|
filter_parameters = {}
|
5
17
|
original_path = path.dup
|
6
18
|
|
19
|
+
# Apply the custom user around_recognize filter callbacks
|
7
20
|
@routes.filters.run(:around_recognize, path, env) do
|
21
|
+
# Yield the filter paramters for adjustment by the user
|
8
22
|
filter_parameters
|
9
23
|
end
|
10
24
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
25
|
+
# Recognize the routes
|
26
|
+
super(env) do |match, parameters, route|
|
27
|
+
# Merge in custom parameters that will be visible to the controller
|
28
|
+
params = (parameters || {}).merge(filter_parameters)
|
29
|
+
|
30
|
+
# Reset the path before yielding to the controller (prevents breakages in CSRF validation)
|
16
31
|
if env.is_a?(Hash)
|
17
32
|
env['PATH_INFO'] = original_path
|
18
33
|
else
|
19
34
|
env.path_info = original_path
|
20
35
|
end
|
36
|
+
|
37
|
+
# Yield results are dispatched to the controller
|
38
|
+
yield [match, params, route]
|
21
39
|
end
|
22
40
|
end
|
23
41
|
end
|
24
42
|
|
25
|
-
ActionDispatch::Journey::Router.
|
43
|
+
ActionDispatch::Journey::Router.prepend(ActionDispatchJourneyRouterWithFiltering)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: routing-filter-codeur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.1.
|
4
|
+
version: 0.7.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Fuchs
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-01-
|
12
|
+
date: 2024-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|