zendesk_apps_support 4.6.3 → 4.6.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 513c653a0a44ec4201b3683bec006c88a34f2950
|
4
|
+
data.tar.gz: 7fc5b30973b7cb1b8c25d3a489b21d549785b516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6eef964a47a771ed2247b0d4e8ab5dc5ab70ab4eb280c85618b2c272d2b534dd7db0c88d028ac8011c755cbbf4d527534448498f207f8689e01315ea4b7539b
|
7
|
+
data.tar.gz: c1262f2ea2c41ad5c1d96280197a86d08fc603fef97fb439756766b7457708b55ab46b3b248654ba45c6185bc84c477e04d16591f0d9e03e2319b9090926e494
|
data/config/locales/en.yml
CHANGED
@@ -126,3 +126,5 @@ en:
|
|
126
126
|
is deployed.
|
127
127
|
sanitised_svg: The markup in %{svg} has been edited for use in Zendesk
|
128
128
|
and may not display as intended.
|
129
|
+
bitmap_in_svg: "%{svg} contains an embedded bitmap and cannot be used
|
130
|
+
as an app icon. It has been replaced with a default placeholder icon."
|
@@ -214,6 +214,10 @@ parts:
|
|
214
214
|
key: "txt.apps.admin.warning.app_build.sanitised_svg"
|
215
215
|
title: "App builder job: warning that contents of svg have been sanitised and overwritten"
|
216
216
|
value: "The markup in %{svg} has been edited for use in Zendesk and may not display as intended."
|
217
|
+
- translation:
|
218
|
+
key: "txt.apps.admin.warning.app_build.bitmap_in_svg"
|
219
|
+
title: "App builder job: warning that svg contains an embedded bitmap image and cannot be used"
|
220
|
+
value: "%{svg} contains an embedded bitmap and cannot be used as an app icon. It has been replaced with a default placeholder icon."
|
217
221
|
- translation:
|
218
222
|
key: "txt.apps.admin.error.app_build.invalid_version"
|
219
223
|
title: "App builder job: invalid framework version"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
3
|
+
viewBox="0 0 18 18" style="enable-background:new 0 0 18 18;" xml:space="preserve">
|
4
|
+
<path id="Fill-3" d="M1.5,6.1C1.3,5.9,1,6,1,6.4l0,7c0,0.3,0.2,0.7,0.5,0.9l6,3.6C7.8,18.1,8,18,8,17.6l0-7.1c0-0.3-0.2-0.7-0.5-0.9
|
5
|
+
L1.5,6.1z"/>
|
6
|
+
<path id="Fill-5" d="M10.5,17.9c-0.3,0.2-0.5,0-0.5-0.3l0-7c0-0.3,0.2-0.7,0.5-0.9l6-3.6C16.8,5.9,17,6,17,6.4l0,7.1
|
7
|
+
c0,0.3-0.2,0.7-0.5,0.9L10.5,17.9z"/>
|
8
|
+
<path id="Fill-1" d="M2.2,3.7c-0.3,0.2-0.3,0.4,0,0.6l6.2,3.6C8.7,8,9.2,8,9.4,7.9l6.3-3.6c0.3-0.2,0.3-0.4,0-0.6L9.5,0.1
|
9
|
+
C9.2,0,8.8,0,8.5,0.1L2.2,3.7z"/>
|
10
|
+
</svg>
|
@@ -4,6 +4,8 @@ require 'loofah'
|
|
4
4
|
module ZendeskAppsSupport
|
5
5
|
module Validations
|
6
6
|
module Svg
|
7
|
+
PLACEHOLDER_SVG_MARKUP = File.read(File.expand_path('../../assets/default_app_logo.svg', __FILE__))
|
8
|
+
|
7
9
|
# whitelist elements and attributes used in Zendesk Garden assets
|
8
10
|
Loofah::HTML5::WhiteList::ALLOWED_ELEMENTS_WITH_LIBXML2.add 'symbol'
|
9
11
|
Loofah::HTML5::WhiteList::ACCEPTABLE_CSS_PROPERTIES.add 'position'
|
@@ -31,27 +33,43 @@ module ZendeskAppsSupport
|
|
31
33
|
end
|
32
34
|
|
33
35
|
class << self
|
36
|
+
def contains_embedded_bitmap?(markup)
|
37
|
+
Nokogiri::XML(markup).css('//image').any?
|
38
|
+
end
|
39
|
+
|
40
|
+
def rewrite_svg(svg, new_markup, package, errors)
|
41
|
+
warning_string = if contains_embedded_bitmap?(svg.read)
|
42
|
+
'txt.apps.admin.warning.app_build.bitmap_in_svg'
|
43
|
+
else
|
44
|
+
'txt.apps.admin.warning.app_build.sanitised_svg'
|
45
|
+
end
|
46
|
+
|
47
|
+
package.warnings << I18n.t(warning_string, svg: svg.relative_path)
|
48
|
+
compressed_new_markup = new_markup.tr("\n", '').squeeze(' ').gsub(/\>\s+\</, '><')
|
49
|
+
IO.write(svg.absolute_path, compressed_new_markup)
|
50
|
+
rescue
|
51
|
+
errors << ValidationError.new(:dirty_svg, svg: svg.relative_path)
|
52
|
+
end
|
53
|
+
|
34
54
|
def call(package)
|
35
55
|
errors = []
|
36
56
|
|
37
57
|
package.svg_files.each do |svg|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
rescue
|
54
|
-
errors << ValidationError.new(:dirty_svg, svg: svg.relative_path)
|
58
|
+
if contains_embedded_bitmap?(svg.read)
|
59
|
+
rewrite_svg(svg, PLACEHOLDER_SVG_MARKUP, package, errors)
|
60
|
+
else
|
61
|
+
markup = Loofah.xml_fragment(svg.read)
|
62
|
+
.scrub!(@strip_declaration)
|
63
|
+
.scrub!(@strip_spaces_between_css_attrs)
|
64
|
+
.to_xml.strip
|
65
|
+
|
66
|
+
clean_markup = Loofah.xml_fragment(markup)
|
67
|
+
.scrub!(:prune)
|
68
|
+
.scrub!(@empty_malformed_markup)
|
69
|
+
.to_xml
|
70
|
+
|
71
|
+
next if clean_markup == markup
|
72
|
+
rewrite_svg(svg, clean_markup, package, errors)
|
55
73
|
end
|
56
74
|
end
|
57
75
|
errors
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zendesk_apps_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.6.
|
4
|
+
version: 4.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James A. Rosen
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-12-13 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: i18n
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- lib/zendesk_apps_support/app_file.rb
|
225
225
|
- lib/zendesk_apps_support/app_requirement.rb
|
226
226
|
- lib/zendesk_apps_support/app_version.rb
|
227
|
+
- lib/zendesk_apps_support/assets/default_app_logo.svg
|
227
228
|
- lib/zendesk_apps_support/assets/default_styles.scss
|
228
229
|
- lib/zendesk_apps_support/assets/default_template.html.erb
|
229
230
|
- lib/zendesk_apps_support/assets/installed.js.erb
|
@@ -273,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
273
274
|
version: 1.3.6
|
274
275
|
requirements: []
|
275
276
|
rubyforge_project:
|
276
|
-
rubygems_version: 2.6.
|
277
|
+
rubygems_version: 2.6.13
|
277
278
|
signing_key:
|
278
279
|
specification_version: 4
|
279
280
|
summary: Support to help you develop Zendesk Apps.
|