repost 0.3.3 → 0.3.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 998c57594b27cb1c140eb6e141b2e64467a5cde407410c58bd3547f3529e7d20
4
- data.tar.gz: d7fef86b10e728d49154e6883fdf53659bbbacd0f281283e6ff586f82cc67199
3
+ metadata.gz: b3f86c0a5b05ecd0335c0a471d9bfb6bc838c290c2cfbab6f1d2c4e411c60a5c
4
+ data.tar.gz: 9f2e280d22ee448a6f99e30fe410e576af78c96966877d0be90df7e441ae53ac
5
5
  SHA512:
6
- metadata.gz: 4ce51773149c3bb5afc481c415753a46e2136d2ef1e41aa17709028ec24682c95a44a913dddba3ea20c06a15bb201384478ab6cac42cb1f41eba97316d35e875
7
- data.tar.gz: 97a6ab774d780fbe9cf238ee6172764adbc10d6dd6b0282f3c8950e967f413b560cb4852179d419c27d62dc1dd5ee542c66108864d90444902388a8c8235af64
6
+ metadata.gz: 45d255fb124026befb181c204c7914b260f5f9cfbc1f149072d5063e70e89d3e26d20861fd410a437edec30adc3d8e1066ff7149a3ac63c78b731cb9d958f9c2
7
+ data.tar.gz: ab0c1712df4aabf366ebf02c0067459d5102db5231ca06b5b96af72735dadc4b6ceed8ca525b04788a5593ed8124e0c943baccc60f959dbaff68eaef353e1b6f
@@ -7,7 +7,10 @@ if defined?(Rails) && defined?(ActiveSupport)
7
7
  render html: Repost::Senpai.perform(
8
8
  url,
9
9
  params: params,
10
- options: options.merge({authenticity_token: authenticity_token}.compact)
10
+ options: options.merge({
11
+ authenticity_token: authenticity_token,
12
+ autosubmit_nonce: content_security_policy_nonce,
13
+ }.compact)
11
14
  ).html_safe
12
15
  end
13
16
 
@@ -12,6 +12,7 @@ module Repost
12
12
  @charset = options.fetch(:charset, DEFAULT_CHARSET)
13
13
  @form_id = options.fetch(:form_id, generated_form_id)
14
14
  @autosubmit = options.fetch(:autosubmit, true)
15
+ @autosubmit_nonce = options.fetch(:autosubmit_nonce, nil)
15
16
  @section_classes = options.dig(:decor, :section, :classes)
16
17
  @section_html = options.dig(:decor, :section, :html)
17
18
  @submit_classes = options.dig(:decor, :submit, :classes)
@@ -31,7 +32,7 @@ module Repost
31
32
 
32
33
  attr_reader :url, :params, :options, :method, :form_id, :autosubmit,
33
34
  :section_classes, :section_html, :submit_classes,
34
- :submit_text, :authenticity_token, :charset
35
+ :submit_text, :authenticity_token, :charset, :autosubmit_nonce
35
36
 
36
37
  def form_head
37
38
  "<form id='#{form_id}' action='#{url}' method='#{method}' accept-charset='#{charset}'>"
@@ -81,7 +82,8 @@ module Repost
81
82
  end
82
83
 
83
84
  def auto_submit_script
84
- "<script>
85
+ nonce_attr = %Q( nonce="#{autosubmit_nonce}") if autosubmit_nonce
86
+ "<script#{nonce_attr}>
85
87
  document.getElementById('#{form_id}').submit();
86
88
  </script>"
87
89
  end
@@ -1,3 +1,3 @@
1
1
  module Repost
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: repost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - YaroslavO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-17 00:00:00.000000000 Z
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler