anycable-rails-core 1.5.1 → 1.5.2

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
  SHA256:
3
- metadata.gz: 047a37c59ff5b5e9e0074302b02450b8e7ab78af36382db634843eb8d1e0a802
4
- data.tar.gz: 92234b820387917f2f1321b1175b3f1bdfd6305d386320fefcbfc68384476f9d
3
+ metadata.gz: 1727e2f2fde6c605c08b7cd706b6b3a670a44151f0bf6e3cff285ee25f929f8c
4
+ data.tar.gz: 655b6add9c15168382ab0a22922ad0c6272480eeb886f196ee5b46f2eabc3cda
5
5
  SHA512:
6
- metadata.gz: 86938782b2903250bf2a6fdfa205ff70f8356414c035e4d195c93967051fccc731d520b74b373b54ac74cbbd0b3182678b863a06f466ddd17926c2dba3209025
7
- data.tar.gz: 2112a294b4fe22efd05835a2a93b60dfecaae996e990d8690af89d28017ae495d79df147b0cc451bb1a8ae429bceed594d38ded78c1b09de8518f20fe1075b55
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
@@ -13,7 +13,7 @@ ActionCable::Server::Base.prepend(Module.new do
13
13
 
14
14
  def broadcaster_for(broadcasting, **options)
15
15
  broadcasting = AnyCable::Rails.stream_name_from(broadcasting)
16
- super(broadcasting, **options)
16
+ super
17
17
  end
18
18
  end)
19
19
 
@@ -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
@@ -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 middelware by default to its own stack.
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 Devise/Warden
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 Warden::Manager do |config|
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AnyCable
4
4
  module Rails
5
- VERSION = "1.5.1"
5
+ VERSION = "1.5.2"
6
6
  end
7
7
  end
@@ -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.1
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-04-05 00:00:00.000000000 Z
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