anycable-rails-core 1.5.1 → 1.5.2
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/CHANGELOG.md +5 -0
- data/lib/anycable/rails/action_cable_ext/broadcast_options.rb +1 -1
- data/lib/anycable/rails/config.rb +2 -1
- data/lib/anycable/rails/rack.rb +3 -5
- data/lib/anycable/rails/railtie.rb +8 -0
- data/lib/anycable/rails/version.rb +1 -1
- data/lib/generators/anycable/setup/setup_generator.rb +0 -14
- metadata +2 -3
- data/lib/generators/anycable/setup/templates/config/initializers/anycable.rb.tt +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1727e2f2fde6c605c08b7cd706b6b3a670a44151f0bf6e3cff285ee25f929f8c
|
4
|
+
data.tar.gz: 655b6add9c15168382ab0a22922ad0c6272480eeb886f196ee5b46f2eabc3cda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5df48d519e57df343f4b3e84fc7f33f4923212ba8a6008c722e4731cf646d82462bb37b1d77b8bdb0601986e50f6be12704f4ed33ba0ec923134dc602fa3d5a
|
7
|
+
data.tar.gz: e033ddf09baba032d2ba13f1075e3f416dedf867fef735128c3a1db42f89edc016db0299c691541a10a1a019da5ea3f65b52d0a64c17abe2293bee5dac607163
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.5.2 (2024-07-01)
|
6
|
+
|
7
|
+
- Automatically add `Warden::Manager` to the AnyCable middleware stack when Devise is present. ([@lHydra][])
|
8
|
+
|
5
9
|
## 1.5.1 (2024-04-05)
|
6
10
|
|
7
11
|
- Add `anycable-rails-core.rb` to avoid adding `require: ["anycable-rails"]` to Gemfiles manually. ([@palkan][])
|
@@ -265,3 +269,4 @@ See [Changelog](https://github.com/anycable/anycable-rails/blob/0-6-stable/CHANG
|
|
265
269
|
[@DmitryTsepelev]: https://github.com/DmitryTsepelev
|
266
270
|
[@sponomarev]: https://github.com/sponomarev
|
267
271
|
[@bibendi]: https://github.com/bibendi
|
272
|
+
[@lHydra]: http://github.com/lHydra
|
@@ -22,6 +22,7 @@ AnyCable::Config.attr_config(
|
|
22
22
|
batch_broadcasts: false,
|
23
23
|
socket_id_header: "X-Socket-ID",
|
24
24
|
disable_rpc_pool_size_warning: false,
|
25
|
-
websocket_url: nil
|
25
|
+
websocket_url: nil,
|
26
|
+
use_warden_manager: true
|
26
27
|
)
|
27
28
|
AnyCable::Config.ignore_options :access_logs_disabled, :persistent_session_enabled
|
data/lib/anycable/rails/rack.rb
CHANGED
@@ -15,14 +15,12 @@ module AnyCable
|
|
15
15
|
# For instance, consider the Rails session middleware: it's responsible for restoring the
|
16
16
|
# session data from cookies.
|
17
17
|
#
|
18
|
-
# AnyCable adds session
|
18
|
+
# AnyCable adds session middleware by default to its own stack.
|
19
19
|
#
|
20
|
-
# You can also use any Rack/Rails middleware you want. For example, to enable
|
20
|
+
# You can also use any Rack/Rails middleware you want. For example, to enable CustomMiddleware
|
21
21
|
# you can add the following code to an initializer or any other configuration file:
|
22
22
|
#
|
23
|
-
# AnyCable::Rails::Rack.middleware.use
|
24
|
-
# Devise.warden_config = config
|
25
|
-
# end
|
23
|
+
# AnyCable::Rails::Rack.middleware.use CustomMiddleware
|
26
24
|
module Rack
|
27
25
|
def self.app_build_lock
|
28
26
|
@app_build_lock
|
@@ -154,6 +154,14 @@ module AnyCable
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
+
initializer "anycable.warden_manager" do
|
158
|
+
if defined?(::Devise) && AnyCable.config.use_warden_manager?
|
159
|
+
AnyCable::Rails::Rack.middleware.use Warden::Manager do |config|
|
160
|
+
::Devise.warden_config = config
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
157
165
|
# Since Rails 6.1
|
158
166
|
if respond_to?(:server)
|
159
167
|
server do
|
@@ -65,16 +65,6 @@ module AnyCableRailsGenerators
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
def devise
|
69
|
-
return unless devise?
|
70
|
-
|
71
|
-
inside("config/initializers") do
|
72
|
-
template "anycable.rb"
|
73
|
-
end
|
74
|
-
|
75
|
-
say_status :info, "✅ config/initializers/anycable.rb with Devise configuration has been added"
|
76
|
-
end
|
77
|
-
|
78
68
|
def configs
|
79
69
|
inside("config") do
|
80
70
|
template "anycable.yml"
|
@@ -124,10 +114,6 @@ module AnyCableRailsGenerators
|
|
124
114
|
!!gemfile_lock&.match?(/^\s+rubocop\b/)
|
125
115
|
end
|
126
116
|
|
127
|
-
def devise?
|
128
|
-
!!gemfile_lock&.match?(/^\s+devise\b/)
|
129
|
-
end
|
130
|
-
|
131
117
|
def local?
|
132
118
|
@devenv == "local"
|
133
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anycable-rails-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- palkan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: anycable-core
|
@@ -107,7 +107,6 @@ files:
|
|
107
107
|
- lib/generators/anycable/setup/templates/bin/anycable-go.tt
|
108
108
|
- lib/generators/anycable/setup/templates/config/anycable.yml.tt
|
109
109
|
- lib/generators/anycable/setup/templates/config/cable.yml.tt
|
110
|
-
- lib/generators/anycable/setup/templates/config/initializers/anycable.rb.tt
|
111
110
|
- lib/generators/anycable/with_os_helpers.rb
|
112
111
|
homepage: http://github.com/anycable/anycable-rails
|
113
112
|
licenses:
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Add Warden middleware to AnyCable stack to allow accessing
|
4
|
-
# Devise current user via `env["warden"].user`.
|
5
|
-
#
|
6
|
-
# See <%= DOCS_ROOT %>/ruby/authentication
|
7
|
-
#
|
8
|
-
# NOTE: This is only needed in environments where you use AnyCable.
|
9
|
-
if defined?(AnyCable::Rails)
|
10
|
-
AnyCable::Rails::Rack.middleware.use Warden::Manager do |config|
|
11
|
-
Devise.warden_config = config
|
12
|
-
end
|
13
|
-
end
|