debugbar 0.3.1 → 0.3.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: 9533b2b578ca8071254a691d573f41708598945ab8ee666d45655f65f6b30730
4
- data.tar.gz: 4aba711679f6a65212f6fa88d543108e64c9a33f3fd99c59a3566d032f67e26b
3
+ metadata.gz: fd1a075eabe5d5017fc955bee4b4d7cce8ba3358819c8864ae509624b893ba88
4
+ data.tar.gz: 915b71a9216e8b8d5de3b60a61b39a837aecae95a2f531bf20a6872b3a22efb9
5
5
  SHA512:
6
- metadata.gz: 92d5d50ff82b3087cd332133e5c87733a7b2dc4eaa46c65fe4f5cac909d064a4a1c65612650a1eb10b18350272c8ae3f205663571793635c64a59369cb8aa545
7
- data.tar.gz: fd282177ec09843ab1a90ab9a71bb0838225e9958e2d443175faa3f60b8c5b87f7f78ca11bf8a867f671d906d045a0f87508ccc2c777e126f965fdd00161a3d2
6
+ metadata.gz: d8183036e357cd3258f4cc6302e05997cbfe448627a2e48e5c2e362c1b84bc148bc4f921ac5a0edf1053a6455f2127afe4542f0280cfcc2992a6b193591be279
7
+ data.tar.gz: 42370b3a50db567eb5a7a550c2d3b398c308e78b3aaa2efbc7f4bbb251f4dc5f1f18e26745a94134a418e14cfe0670563e3b00d2a8a1d7f1f86299f9b0b48c00
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.3.3 - 2024-06-15
4
+
5
+ * Allow nonce to be set for content security policies - See [#38](https://github.com/julienbourdeau/debugbar/pull/38)
6
+
7
+ ## v0.3.2 - 2024-05-04
8
+
9
+ * Improved Debug panel (to be in par with Queries panel) - See [#36](https://github.com/julienbourdeau/debugbar/pull/36)
10
+ * Better SQL dialect detection - See [c40e2405](https://github.com/julienbourdeau/debugbar/commit/c40e240524308c7ecf09fecbb548e97c2ef4e8b7)
11
+ * Add timings to SQL queries 🎨 - See [ebf8edcd](https://github.com/julienbourdeau/debugbar/commit/ebf8edcd8598a4a7b490a774a7374d51a3efc6b8)
12
+
3
13
  ## v0.3.1 - 2024-05-01
4
14
 
5
15
  * Add `active_record.adapter` config to help frontend format SQL queries - See [#35](https://github.com/julienbourdeau/debugbar/pull/35)
@@ -22,7 +22,7 @@ module Debugbar::TagHelpers
22
22
  HTML
23
23
 
24
24
  html += <<-HTML
25
- <script type="text/javascript" data-turbo-permanent>
25
+ <script type="text/javascript" data-turbo-permanent nonce="#{opt.delete(:nonce)}">
26
26
  window._debugbarConfigOptions = #{opt.to_json}
27
27
  </script>
28
28
  HTML
@@ -40,8 +40,8 @@ module Debugbar
40
40
  @jobs << job
41
41
  end
42
42
 
43
- def add_msg(msg, extra)
44
- @messages << {msg: msg, extra: extra}
43
+ def add_msg(msg, extra, source)
44
+ @messages << {id: SecureRandom.hex(8), msg: msg, extra: extra, source: source}
45
45
  end
46
46
 
47
47
  def add_cache(c)
@@ -36,12 +36,13 @@ module Debugbar
36
36
  duration: event.duration.round(1),
37
37
  lock_wait: payload[:lock_wait]&.round(1),
38
38
  binds: binds,
39
- source: query_source_location&.split(":in"),
39
+ source: query_source_location
40
40
  })
41
41
  end
42
42
 
43
43
  def query_source_location
44
- backtrace_cleaner.clean(caller(3))[0]
44
+ str = backtrace_cleaner.clean(caller(3))[0]
45
+ str&.split(":in")&.map { |s| s.delete_prefix("#{Rails.root}/").strip.tr("`'", '' ) } # Duplicated in Debugbar.msg
45
46
  end
46
47
  end
47
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Debugbar
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.3"
5
5
  end
data/lib/debugbar.rb CHANGED
@@ -47,12 +47,12 @@ module Debugbar
47
47
  end
48
48
  end
49
49
 
50
- def msg(msg, *extra)
50
+ def msg(msg, extra, source)
51
51
  if Current.request.nil?
52
52
  puts "The current request is not set yet. Printing to STDOUT instead."
53
- puts msg, extra
53
+ puts msg, extra, source
54
54
  else
55
- Current.request.add_msg(msg, extra)
55
+ Current.request.add_msg(msg, extra, source)
56
56
  end
57
57
  end
58
58
  end
@@ -82,7 +82,8 @@ module Debugbar
82
82
  end
83
83
 
84
84
  def msg(msg, *extra)
85
- Tracker.msg(msg, *extra)
85
+ source = caller.first&.split(":in")&.map { |s| s.delete_prefix("#{Rails.root}/").strip.tr("`'", '' ) }
86
+ Tracker.msg(msg, extra, source)
86
87
  end
87
88
  end
88
89
  end