string_tools 1.1.0 → 1.3.0

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: 210c99c75f04b03ef26c76343f29b29b6325c94d270904a276df3c50e438ef52
4
- data.tar.gz: 9a89a82fc8d20d222e67e44bb786941d860341e707bc5945d8867394fc8447e6
3
+ metadata.gz: 518b671cee6921170a923aec262e1da3552c586c87540db9d8ab232e90104eb1
4
+ data.tar.gz: 573cf234c034abf50ecc23c7ae016a0aafd63038c8b0af589a04e54b6077ddf3
5
5
  SHA512:
6
- metadata.gz: c25cd4f6a32ea07a771a8e59e17a3e28e370441065d592989754d5b67b0f79a9a429a8bc79b231aa23b7f7b20b3a76b2461a610d3a410f7f64401b8a6bb49634
7
- data.tar.gz: 140e95adee684c86f90e31a3780e4eca0c9110891160278412b5038ed30b533ebb2f1ca3cf2a45981d93632259ba55b98df8a8ef8b16edb1938541e6169b1dca
6
+ metadata.gz: 667b2621aadf33fd77f3b1d003105adb982959cfc30d5694626480e52704c68e87bf9c0171ec6d0fa44eb353966de1ea78e053d1c2ac6c4e2bc2705baadd41c5
7
+ data.tar.gz: 8f5f2d10969a4b30f80ec931f7f2451653e3437e7400caff6bc58621535af396eed2049532abd6f3c30e9a08927b4ef3e47b8adfb11456431e7d0706b216f289
data/CHANGELOG.md CHANGED
@@ -1,4 +1,22 @@
1
- # v1.1.0
1
+ # v1.3.0
2
+
3
+ * 2024-11-15 [771ba6b](../../commit/771ba6b) - __(git3-railsc)__ Release 1.3.0
4
+ * 2024-09-20 [cba6db7](../../commit/cba6db7) - __(bayerd412)__ feat(ck-editor video hosting): add rutube
5
+ https://jira.railsc.ru/browse/PC4-31420
6
+
7
+ * 2024-04-08 [be7e7fd](../../commit/be7e7fd) - __(Andrew N. Shalaev)__ Release v1.2.0
8
+ * 2023-11-29 [393bb13](../../commit/393bb13) - __(GIGrave)__ feature: add media to sanitize rules
9
+ https://jira.railsc.ru/browse/BPC-22916
10
+
11
+ * 2023-11-29 [06eb51e](../../commit/06eb51e) - __(GIGrave)__ Revert "feature: add string_tools config"
12
+ This reverts commit c0b9bf39ec3cf2fce28fe92c7892a0c47593ca09.
13
+
14
+ * 2023-11-29 [d1c00b9](../../commit/d1c00b9) - __(GIGrave)__ Revert "fix: add postgress to drone"
15
+ This reverts commit 33e5698fd48d5edf416df316e3466f9e6c58369f.
16
+
17
+ * 2023-11-02 [33e5698](../../commit/33e5698) - __(GIGrave)__ fix: add postgress to drone
18
+ * 2023-11-02 [c0b9bf3](../../commit/c0b9bf3) - __(GIGrave)__ feature: add string_tools config
19
+ https://jira.railsc.ru/browse/BPC-22612
2
20
 
3
21
  * 2023-10-16 [8ccb54a](../../commit/8ccb54a) - __(ArtemBorodinEvgenyevich)__ Release v1.1.0
4
22
  * 2023-08-29 [bed389b](../../commit/bed389b) - __(Terentev Aleksey)__ feat: sanitize links in alt of img tag
@@ -103,6 +121,29 @@ https://jira.railsc.ru/browse/PC4-16353
103
121
  # v3.0.1
104
122
 
105
123
 
124
+ # v1.2.0
125
+
126
+ * 2023-11-29 [393bb13](../../commit/393bb13) - __(GIGrave)__ feature: add media to sanitize rules
127
+ https://jira.railsc.ru/browse/BPC-22916
128
+
129
+ * 2023-11-29 [06eb51e](../../commit/06eb51e) - __(GIGrave)__ Revert "feature: add string_tools config"
130
+ This reverts commit c0b9bf39ec3cf2fce28fe92c7892a0c47593ca09.
131
+
132
+ * 2023-11-29 [d1c00b9](../../commit/d1c00b9) - __(GIGrave)__ Revert "fix: add postgress to drone"
133
+ This reverts commit 33e5698fd48d5edf416df316e3466f9e6c58369f.
134
+
135
+ * 2023-11-02 [33e5698](../../commit/33e5698) - __(GIGrave)__ fix: add postgress to drone
136
+ * 2023-11-02 [c0b9bf3](../../commit/c0b9bf3) - __(GIGrave)__ feature: add string_tools config
137
+ https://jira.railsc.ru/browse/BPC-22612
138
+
139
+ # v1.1.0
140
+
141
+ * 2023-08-29 [bed389b](../../commit/bed389b) - __(Terentev Aleksey)__ feat: sanitize links in alt of img tag
142
+ https://jira.railsc.ru/browse/PC4-29908
143
+
144
+ * 2023-08-11 [7848491](../../commit/7848491) - __(Terentev Aleksey)__ feat: add options for sanitize outer links in css
145
+ https://jira.railsc.ru/browse/PC4-29908
146
+
106
147
  # v1.0.0
107
148
 
108
149
  * 2023-06-15 [8e9fa48](../../commit/8e9fa48) - __(Andrew N. Shalaev)__ fix: convert to_utf8 correctly, without hidding errors
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module StringTools
3
- VERSION = '1.1.0'
3
+ VERSION = '1.3.0'
4
4
  end
data/lib/string_tools.rb CHANGED
@@ -181,7 +181,11 @@ module StringTools
181
181
  str,
182
182
  :attributes => attributes,
183
183
  :elements => elements,
184
- :css => {:properties => Sanitize::Config::RELAXED[:css][:properties], protocols: protocols},
184
+ :css => {
185
+ at_rules_with_styles: ['media'],
186
+ properties: Sanitize::Config::RELAXED[:css][:properties],
187
+ protocols: protocols,
188
+ },
185
189
  :remove_contents => remove_contents || Set['style', 'script'],
186
190
  :allow_comments => false,
187
191
  :transformers => transformers
@@ -222,6 +226,9 @@ module StringTools
222
226
  end
223
227
 
224
228
  class IframeNormalizer
229
+ HOSTING_REG = %r{^https?:\/\/(www\.)?(?:(rutube\.ru\/(video|play|embed))|
230
+ (youtu((?:be|\.be|be\-nocookie)(?:\/|\.com\/(watch|shorts|embed)))))}x.freeze
231
+
225
232
  def initialize(attributes)
226
233
  @attributes = attributes
227
234
  end
@@ -231,7 +238,7 @@ module StringTools
231
238
 
232
239
  return unless node.name == 'iframe'
233
240
 
234
- unless node[:src] =~ %r{^(http|https):?\/\/(www\.)?youtube?\.com\/}
241
+ unless node[:src] =~ HOSTING_REG
235
242
  node.unlink
236
243
  return
237
244
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: string_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey D.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-16 00:00:00.000000000 Z
11
+ date: 2024-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack