copy_tuner_client 0.13.3 → 0.13.5

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: fcfaac32f023250fb386ea6333a09fe74a6f4152372540dba6adcf06b9e5d464
4
- data.tar.gz: 5589dfced3c0c9e11f843f9c7707d7a1a81f112a09752d3014d52eb31ef7cd51
3
+ metadata.gz: 28ccf5e2ed38298ddcd90d04ec2a6180fa6ebb09410923b0dbb5d2f64d90e05e
4
+ data.tar.gz: 4fd8162f350c4fc57725a10e44016f10f7048393e88656fe94b75689c5b9d2c1
5
5
  SHA512:
6
- metadata.gz: 0d25871c33344d9fb9b3e869ae075916d4a47a7e4bed529c2cceec8c7f3ac150ab0e5b2fc81e3df81692ba0a0e5fcb7c45ad695ec32b5037cf40c6abb9a5e4fc
7
- data.tar.gz: ace3323cdc8bdf6e27fd8895443bbb0df0200e73a8c9342bd066e3d9b877dc7cc00817888c2315980167176329d95e73ee1af63df38f974a18cf2353abbfce9f
6
+ metadata.gz: c627bcbaf93424c9cac41132bd05bfa3c26b887d66e4ebcf2438a18bf5d05f4f6e38c1a6030d63b3ad981f20a6fd40256383564fa3d67b4ebf19446bef609c1b
7
+ data.tar.gz: '08adeeff5aaaafdcf872382448ebc4bb76c230d6bfda1460b460a7ec3fb7006cb08372c9e0535db406089e7cd2a18b134ea526727d48dc8b015ff23634d06654'
data/.gitignore CHANGED
@@ -19,3 +19,5 @@ pkg
19
19
  *.gemfile.lock
20
20
  .idea/
21
21
  node_modules
22
+
23
+ Gemfile.lock
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.13.5
2
+
3
+ - Rename assets
4
+
5
+ ## 0.13.4
6
+
7
+ - Fix csp nonce
8
+
1
9
  ## 0.13.3
2
10
 
3
11
  - Add `media="all"` attribute to stylesheet link tag
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 SonicGarden
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
File without changes
File without changes
@@ -10,8 +10,9 @@ module CopyTunerClient
10
10
  CopyTunerClient::TranslationLog.clear
11
11
  status, headers, response = @app.call(env)
12
12
  if html_headers?(status, headers) && body = response_body(response)
13
- body = append_css(body)
14
- body = append_js(body)
13
+ csp_nonce = env['action_dispatch.content_security_policy_nonce'] || env['secure_headers_content_security_policy_nonce']
14
+ body = append_css(body, csp_nonce)
15
+ body = append_js(body, csp_nonce)
15
16
  content_length = body.bytesize.to_s
16
17
  headers['Content-Length'] = content_length
17
18
  # maintains compatibility with other middlewares
@@ -31,11 +32,12 @@ module CopyTunerClient
31
32
  ActionController::Base.helpers
32
33
  end
33
34
 
34
- def append_css(html)
35
+ def append_css(html, csp_nonce)
36
+ css_tag = helpers.stylesheet_link_tag 'copytuner', media: :all, nonce: csp_nonce
35
37
  append_to_html_body(html, css_tag)
36
38
  end
37
39
 
38
- def append_js(html)
40
+ def append_js(html, csp_nonce)
39
41
  json =
40
42
  if CopyTunerClient::TranslationLog.initialized?
41
43
  CopyTunerClient::TranslationLog.translations.to_json
@@ -43,17 +45,13 @@ module CopyTunerClient
43
45
  '{}'
44
46
  end
45
47
 
46
- append_to_html_body(html, helpers.javascript_tag(<<~SCRIPT))
48
+ append_to_html_body(html, helpers.javascript_tag(<<~SCRIPT, nonce: csp_nonce))
47
49
  window.CopyTuner = {
48
50
  url: '#{CopyTunerClient.configuration.project_url}',
49
51
  data: #{json},
50
52
  }
51
53
  SCRIPT
52
- append_to_html_body(html, helpers.javascript_include_tag(:main, type: 'module', crossorigin: 'anonymous'))
53
- end
54
-
55
- def css_tag
56
- helpers.stylesheet_link_tag :style, media: :all
54
+ append_to_html_body(html, helpers.javascript_include_tag('copytuner', type: 'module', crossorigin: 'anonymous', nonce: csp_nonce))
57
55
  end
58
56
 
59
57
  def append_to_html_body(html, content)
@@ -25,7 +25,7 @@ module CopyTunerClient
25
25
  end
26
26
 
27
27
  initializer "copy_tuner.assets.precompile", group: :all do |app|
28
- app.config.assets.precompile += ['main.js', 'style.css']
28
+ app.config.assets.precompile += ['copytuner.js', 'copytuner.css']
29
29
  end
30
30
  end
31
31
  end
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.13.3'.freeze
3
+ VERSION = '0.13.5'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
data/vite.config.ts CHANGED
@@ -10,9 +10,9 @@ export default defineConfig({
10
10
  },
11
11
  rollupOptions: {
12
12
  output: {
13
- entryFileNames: `javascripts/[name].js`,
14
- assetFileNames: `stylesheets/[name].[ext]`,
15
- }
16
- }
13
+ entryFileNames: `javascripts/copytuner.js`,
14
+ assetFileNames: `stylesheets/copytuner.[ext]`,
15
+ },
16
+ },
17
17
  },
18
18
  })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copy_tuner_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.3
4
+ version: 0.13.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-21 00:00:00.000000000 Z
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -195,11 +195,11 @@ files:
195
195
  - ".vscode/settings.json"
196
196
  - CHANGELOG.md
197
197
  - Gemfile
198
- - Gemfile.lock
198
+ - LICENSE.txt
199
199
  - README.md
200
200
  - Rakefile
201
- - app/assets/javascripts/main.js
202
- - app/assets/stylesheets/style.css
201
+ - app/assets/javascripts/copytuner.js
202
+ - app/assets/stylesheets/copytuner.css
203
203
  - copy_tuner_client.gemspec
204
204
  - gemfiles/6.1.gemfile
205
205
  - gemfiles/7.0.gemfile
data/Gemfile.lock DELETED
@@ -1,258 +0,0 @@
1
- GIT
2
- remote: https://github.com/SonicGarden/sgcop.git
3
- revision: a2478f309e7c82d32b93073e0a1158ab20c894c8
4
- specs:
5
- sgcop (0.5.14)
6
- haml_lint (~> 0.40.0)
7
- rubocop (~> 1.30.0)
8
- rubocop-performance (~> 1.14.0)
9
- rubocop-rails (~> 2.14.2)
10
- rubocop-rake (~> 0.6.0)
11
- rubocop-rspec (~> 2.11.1)
12
-
13
- PATH
14
- remote: .
15
- specs:
16
- copy_tuner_client (0.13.3)
17
- i18n (>= 0.5.0)
18
- json
19
- nokogiri
20
-
21
- GEM
22
- remote: http://rubygems.org/
23
- specs:
24
- actioncable (6.1.6)
25
- actionpack (= 6.1.6)
26
- activesupport (= 6.1.6)
27
- nio4r (~> 2.0)
28
- websocket-driver (>= 0.6.1)
29
- actionmailbox (6.1.6)
30
- actionpack (= 6.1.6)
31
- activejob (= 6.1.6)
32
- activerecord (= 6.1.6)
33
- activestorage (= 6.1.6)
34
- activesupport (= 6.1.6)
35
- mail (>= 2.7.1)
36
- actionmailer (6.1.6)
37
- actionpack (= 6.1.6)
38
- actionview (= 6.1.6)
39
- activejob (= 6.1.6)
40
- activesupport (= 6.1.6)
41
- mail (~> 2.5, >= 2.5.4)
42
- rails-dom-testing (~> 2.0)
43
- actionpack (6.1.6)
44
- actionview (= 6.1.6)
45
- activesupport (= 6.1.6)
46
- rack (~> 2.0, >= 2.0.9)
47
- rack-test (>= 0.6.3)
48
- rails-dom-testing (~> 2.0)
49
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
50
- actiontext (6.1.6)
51
- actionpack (= 6.1.6)
52
- activerecord (= 6.1.6)
53
- activestorage (= 6.1.6)
54
- activesupport (= 6.1.6)
55
- nokogiri (>= 1.8.5)
56
- actionview (6.1.6)
57
- activesupport (= 6.1.6)
58
- builder (~> 3.1)
59
- erubi (~> 1.4)
60
- rails-dom-testing (~> 2.0)
61
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
62
- activejob (6.1.6)
63
- activesupport (= 6.1.6)
64
- globalid (>= 0.3.6)
65
- activemodel (6.1.6)
66
- activesupport (= 6.1.6)
67
- activerecord (6.1.6)
68
- activemodel (= 6.1.6)
69
- activesupport (= 6.1.6)
70
- activestorage (6.1.6)
71
- actionpack (= 6.1.6)
72
- activejob (= 6.1.6)
73
- activerecord (= 6.1.6)
74
- activesupport (= 6.1.6)
75
- marcel (~> 1.0)
76
- mini_mime (>= 1.1.0)
77
- activesupport (6.1.6)
78
- concurrent-ruby (~> 1.0, >= 1.0.2)
79
- i18n (>= 1.6, < 2)
80
- minitest (>= 5.1)
81
- tzinfo (~> 2.0)
82
- zeitwerk (~> 2.3)
83
- addressable (2.8.0)
84
- public_suffix (>= 2.0.2, < 5.0)
85
- ast (2.4.2)
86
- builder (3.2.4)
87
- concurrent-ruby (1.1.10)
88
- crack (0.4.5)
89
- rexml
90
- crass (1.0.6)
91
- daemons (1.4.1)
92
- diff-lcs (1.5.0)
93
- erubi (1.10.0)
94
- eventmachine (1.2.7)
95
- globalid (1.0.0)
96
- activesupport (>= 5.0)
97
- haml (5.2.2)
98
- temple (>= 0.8.0)
99
- tilt
100
- haml_lint (0.40.0)
101
- haml (>= 4.0, < 5.3)
102
- parallel (~> 1.10)
103
- rainbow
104
- rubocop (>= 0.50.0)
105
- sysexits (~> 1.1)
106
- hashdiff (1.0.1)
107
- i18n (1.10.0)
108
- concurrent-ruby (~> 1.0)
109
- json (2.6.2)
110
- loofah (2.18.0)
111
- crass (~> 1.0.2)
112
- nokogiri (>= 1.5.9)
113
- mail (2.7.1)
114
- mini_mime (>= 0.1.1)
115
- marcel (1.0.2)
116
- method_source (1.0.0)
117
- mini_mime (1.1.2)
118
- mini_portile2 (2.8.0)
119
- minitest (5.15.0)
120
- mustermann (1.1.1)
121
- ruby2_keywords (~> 0.0.1)
122
- nio4r (2.5.8)
123
- nokogiri (1.13.6)
124
- mini_portile2 (~> 2.8.0)
125
- racc (~> 1.4)
126
- parallel (1.22.1)
127
- parser (3.1.2.0)
128
- ast (~> 2.4.1)
129
- public_suffix (4.0.7)
130
- racc (1.6.0)
131
- rack (2.2.3.1)
132
- rack-protection (2.2.0)
133
- rack
134
- rack-test (1.1.0)
135
- rack (>= 1.0, < 3)
136
- rails (6.1.6)
137
- actioncable (= 6.1.6)
138
- actionmailbox (= 6.1.6)
139
- actionmailer (= 6.1.6)
140
- actionpack (= 6.1.6)
141
- actiontext (= 6.1.6)
142
- actionview (= 6.1.6)
143
- activejob (= 6.1.6)
144
- activemodel (= 6.1.6)
145
- activerecord (= 6.1.6)
146
- activestorage (= 6.1.6)
147
- activesupport (= 6.1.6)
148
- bundler (>= 1.15.0)
149
- railties (= 6.1.6)
150
- sprockets-rails (>= 2.0.0)
151
- rails-dom-testing (2.0.3)
152
- activesupport (>= 4.2.0)
153
- nokogiri (>= 1.6)
154
- rails-html-sanitizer (1.4.2)
155
- loofah (~> 2.3)
156
- railties (6.1.6)
157
- actionpack (= 6.1.6)
158
- activesupport (= 6.1.6)
159
- method_source
160
- rake (>= 12.2)
161
- thor (~> 1.0)
162
- rainbow (3.1.1)
163
- rake (13.0.6)
164
- regexp_parser (2.5.0)
165
- rexml (3.2.5)
166
- rspec (3.11.0)
167
- rspec-core (~> 3.11.0)
168
- rspec-expectations (~> 3.11.0)
169
- rspec-mocks (~> 3.11.0)
170
- rspec-core (3.11.0)
171
- rspec-support (~> 3.11.0)
172
- rspec-expectations (3.11.0)
173
- diff-lcs (>= 1.2.0, < 2.0)
174
- rspec-support (~> 3.11.0)
175
- rspec-mocks (3.11.1)
176
- diff-lcs (>= 1.2.0, < 2.0)
177
- rspec-support (~> 3.11.0)
178
- rspec-support (3.11.0)
179
- rubocop (1.30.0)
180
- parallel (~> 1.10)
181
- parser (>= 3.1.0.0)
182
- rainbow (>= 2.2.2, < 4.0)
183
- regexp_parser (>= 1.8, < 3.0)
184
- rexml (>= 3.2.5, < 4.0)
185
- rubocop-ast (>= 1.18.0, < 2.0)
186
- ruby-progressbar (~> 1.7)
187
- unicode-display_width (>= 1.4.0, < 3.0)
188
- rubocop-ast (1.18.0)
189
- parser (>= 3.1.1.0)
190
- rubocop-performance (1.14.0)
191
- rubocop (>= 1.7.0, < 2.0)
192
- rubocop-ast (>= 0.4.0)
193
- rubocop-rails (2.14.2)
194
- activesupport (>= 4.2.0)
195
- rack (>= 1.1)
196
- rubocop (>= 1.7.0, < 2.0)
197
- rubocop-rake (0.6.0)
198
- rubocop (~> 1.0)
199
- rubocop-rspec (2.11.1)
200
- rubocop (~> 1.19)
201
- ruby-progressbar (1.11.0)
202
- ruby2_keywords (0.0.5)
203
- sham_rack (1.4.1)
204
- rack
205
- sinatra (2.2.0)
206
- mustermann (~> 1.0)
207
- rack (~> 2.2)
208
- rack-protection (= 2.2.0)
209
- tilt (~> 2.0)
210
- sprockets (4.0.3)
211
- concurrent-ruby (~> 1.0)
212
- rack (> 1, < 3)
213
- sprockets-rails (3.4.2)
214
- actionpack (>= 5.2)
215
- activesupport (>= 5.2)
216
- sprockets (>= 3.0.0)
217
- sqlite3 (1.4.2)
218
- sysexits (1.2.0)
219
- temple (0.8.2)
220
- thin (1.8.1)
221
- daemons (~> 1.0, >= 1.0.9)
222
- eventmachine (~> 1.0, >= 1.0.4)
223
- rack (>= 1, < 3)
224
- thor (1.2.1)
225
- tilt (2.0.10)
226
- tzinfo (2.0.4)
227
- concurrent-ruby (~> 1.0)
228
- unicode-display_width (2.1.0)
229
- webmock (3.14.0)
230
- addressable (>= 2.8.0)
231
- crack (>= 0.3.2)
232
- hashdiff (>= 0.4.0, < 2.0.0)
233
- webrick (1.7.0)
234
- websocket-driver (0.7.5)
235
- websocket-extensions (>= 0.1.0)
236
- websocket-extensions (0.1.5)
237
- yard (0.9.27)
238
- webrick (~> 1.7.0)
239
- zeitwerk (2.5.4)
240
-
241
- PLATFORMS
242
- ruby
243
-
244
- DEPENDENCIES
245
- copy_tuner_client!
246
- rails (~> 6.1)
247
- rake
248
- rspec
249
- sgcop!
250
- sham_rack
251
- sinatra
252
- sqlite3
253
- thin
254
- webmock
255
- yard
256
-
257
- BUNDLED WITH
258
- 2.2.33