debugbar 0.4.2 → 0.4.3

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: cc75f60be93ef95e8b51a8dcb4a7682c801fef9ba4790828a26f8ec8c4c37f63
4
- data.tar.gz: 7ef69e8c41cf2dddb68ad2d6e5ac2b2e8d4702ab9d97d89363d6f38b0fbae8ec
3
+ metadata.gz: 5baf46392ef6971651278629311c31ce702eff3c07cf85f1e46a0975f9535474
4
+ data.tar.gz: fce99f252cd68cfbd6d81b87276c6f3a0218371aa6069a6007a7def71b674769
5
5
  SHA512:
6
- metadata.gz: 9d6e2fbef45e447717b91e9e92c53884e15684bd8fdfa9363b99f4ea35da766dc9b82b71340b61063832e5149ff7564c0cafd4dddfee52b74fe93805516a87e1
7
- data.tar.gz: e35d17f833d1566a4c87b3a875ed496751622fd078386e10474eb09dbe739a193d67c481255813c3b3551b269935b08c0095ba0a37e8b2e709c28f90dfb2fb06
6
+ metadata.gz: 2f5f1f3108f0c6f5d2d5140f23c61aac35e79ba4e233d4c4c83978bd19b3e0b48acbe5d53b9dbf768d6e757e96ae8347101e128cc0a3dea513300f9967f70d82
7
+ data.tar.gz: ef27aa4a78e8f398ef2c8dc3bf30f5437b911f18913a0653b3b654e2e343854f052e374123fea5e478239f438c3b431c57ac7cd07d86069e223dec4d169695b1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.4.3 - 2025-02-04
4
+
5
+ * Small fixes - See [#54](https://github.com/julienbourdeau/debugbar/issues/54) and [#56](https://github.com/julienbourdeau/debugbar/issues/56)
6
+
3
7
  ## v0.4.2 - 2025-01-11
4
8
 
5
9
  * Mount `Debugbar::Engine` automatically from the gem to simplify setup - See [#51](https://github.com/julienbourdeau/debugbar/pull/51)
@@ -3,6 +3,10 @@ module Debugbar
3
3
  protect_from_forgery with: :null_session
4
4
  before_action :cors_set_access_control_headers
5
5
 
6
+ def get
7
+ render json: RequestBuffer.get(params[:id])
8
+ end
9
+
6
10
  def poll
7
11
  render json: RequestBuffer.to_h
8
12
  end
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+
3
+ rm public/extension.zip
4
+ cd client
5
+ npm run build:extension
6
+ cd dist-extension
7
+ rm .DS_Store
8
+ zip -r ../../extension.zip ./
data/config/routes.rb CHANGED
@@ -3,6 +3,8 @@ Debugbar::Engine.routes.draw do
3
3
  mount ActionCable.server => '/cable'
4
4
  end
5
5
 
6
+ get 'get/:id' => "polling#get"
7
+
6
8
  get 'poll' => "polling#poll"
7
9
  options 'poll/confirm' => "polling#confirm"
8
10
  post 'poll/confirm' => "polling#confirm"
data/debugbar.gemspec CHANGED
@@ -24,6 +24,8 @@ Gem::Specification.new do |spec|
24
24
  bin/ test/ spec/ features/ fixtures/
25
25
  client/
26
26
  .git .circleci appveyor Gemfile package.json package-lock.json .prettierrc
27
+ release.sh build_client.sh build_demo.sh build_fixtures.rb build_gem.sh
28
+ extension.zip
27
29
  ]
28
30
 
29
31
  spec.files = Dir.chdir(__dir__) do
@@ -1,5 +1,9 @@
1
1
  module Debugbar
2
2
  class CacheBuffer
3
+ def get(id)
4
+ get_collection[id].to_h
5
+ end
6
+
3
7
  def push(request)
4
8
  collection = get_collection
5
9
  collection[request.id] = request.to_h
@@ -4,6 +4,10 @@ module Debugbar
4
4
  @collection = {}
5
5
  end
6
6
 
7
+ def get(id)
8
+ @collection[id].to_h
9
+ end
10
+
7
11
  def push(request)
8
12
  @collection[request.id] = request
9
13
  end
@@ -1,5 +1,9 @@
1
1
  module Debugbar
2
2
  class NullBuffer
3
+ def get
4
+ {}
5
+ end
6
+
3
7
  def push(_request)
4
8
  end
5
9
 
@@ -5,6 +5,10 @@ module Debugbar
5
5
  @adapter = adapter
6
6
  end
7
7
 
8
+ def get(id)
9
+ @adapter.get(id)
10
+ end
11
+
8
12
  def push(request)
9
13
  @adapter.push(request)
10
14
  nil # Why not return self?
@@ -18,6 +18,9 @@ module Debugbar
18
18
 
19
19
  initializer 'debugbar.override_config' do |app|
20
20
  if defined? ActionCable
21
+ next if app.config.action_cable.allowed_request_origins.is_a?(Array) && app.config.action_cable.allowed_request_origins.any?
22
+ next if app.config.action_cable.allowed_request_origins.is_a?(Regexp)
23
+
21
24
  unless app.config.action_cable.disable_request_forgery_protection
22
25
  app.config.action_cable.disable_request_forgery_protection = true
23
26
  log "Debugbar: Action Cable request forgery protection is enabled. This can cause issues with Debugbar. Overriding setting config.action_cable.disable_request_forgery_protection = true now. Update your configuration to get rid of this message."
@@ -49,7 +52,7 @@ module Debugbar
49
52
  initializer 'debugbar.init' do |app|
50
53
  # Display error message if running in multi-process mode without proper configuration
51
54
  if ENV["WEB_CONCURRENCY"].to_i > 1
52
- cache_nok = %i[null_store memory_store].include?(Rails.configuration.cache_store.first.to_sym)
55
+ cache_nok = %i[null_store memory_store].include?(Rails.configuration.cache_store.to_sym)
53
56
  action_cable_nok = ActionCable.server.config.cable[:adapter].to_s == "async"
54
57
  adapter_nok = app.config.debugbar.buffer_adapter != :cache
55
58
 
@@ -12,9 +12,10 @@ module Debugbar
12
12
 
13
13
  return @app.call(env) if Debugbar::Current.ignore?
14
14
 
15
- Debugbar::Current.new_request!(SecureRandom.uuid)
15
+ req_id = SecureRandom.uuid
16
+ Debugbar::Current.new_request!(req_id)
16
17
 
17
- res = @app.call(env)
18
+ status, headers, body = @app.call(env)
18
19
 
19
20
  # TODO: Remove this if statement?
20
21
  # We check meta because the frontend doesn't support request without meta yet.
@@ -29,7 +30,11 @@ module Debugbar
29
30
  end
30
31
  end
31
32
 
32
- res
33
+ # We can't use Rails.application.url_helper here because 1. we have to set up manually the hosts, 2. the route I
34
+ # want is inside the engine routes and I didn't manage to access them via the helper
35
+ headers["X-Debugbar-Url"] = "#{ActionDispatch::Request.new(env).base_url}#{Debugbar.config.prefix}/get/#{req_id}"
36
+
37
+ [status, headers, body]
33
38
  end
34
39
  end
35
40
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Debugbar
4
- VERSION = "0.4.2"
4
+ VERSION = "0.4.3"
5
5
  end