onebox 1.9.15 → 1.9.16
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 +4 -4
- data/Gemfile.lock +2 -2
- data/README.md +1 -1
- data/lib/onebox/engine/github_commit_onebox.rb +7 -4
- data/lib/onebox/engine/github_issue_onebox.rb +9 -2
- data/lib/onebox/engine/github_pullrequest_onebox.rb +6 -1
- data/lib/onebox/sanitize_config.rb +2 -1
- data/lib/onebox/version.rb +1 -1
- data/templates/githubcommit.mustache +36 -20
- data/templates/githubissue.mustache +35 -24
- data/templates/githubpullrequest.mustache +33 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d132e970ee3bf4b66a61cdac190169b51fb1208148494eafcfbbdf483467f44
|
4
|
+
data.tar.gz: 439181659be99f1d3150b9377dc2dbf49a73a2606255554c5b1d4f4f542d7b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae2e84808088cc38680fc62862d565f9ae409e0f1889d32f472fd070cf4e1cae6a6407576652fc11d22d4d6a3f082989286f404a4c61f2c84b7a08839fd0ff93
|
7
|
+
data.tar.gz: 0b955b5a6ce936396740423744cde0e0611a6d4258d974f4f56382efc8a02692250a72e04b356ce0f4fd808eb7d85137147d1a91c774d17a19e794e4edcf2c86
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -184,7 +184,7 @@ Adding Support for a new URL
|
|
184
184
|
Whitelisted Generic Onebox caveats
|
185
185
|
----------------------------------
|
186
186
|
|
187
|
-
The Whitelisted Generic Onebox has some caveats for
|
187
|
+
The Whitelisted Generic Onebox has some caveats for its use, beyond simply whitelisting the domain.
|
188
188
|
|
189
189
|
1. The domain must be whitelisted
|
190
190
|
2. The URL you're oneboxing cannot be a root url (e.g. `http://example.com` won't work, but `http://example.com/page` will)
|
@@ -7,7 +7,7 @@ module Onebox
|
|
7
7
|
include LayoutSupport
|
8
8
|
include JSON
|
9
9
|
|
10
|
-
matches_regexp Regexp.new("^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/
|
10
|
+
matches_regexp Regexp.new("^https?://(?:www\.)?(?:(?:\w)+\.)?(github)\.com(?:/)?(?:.)*/commit/")
|
11
11
|
always_https
|
12
12
|
|
13
13
|
def url
|
@@ -19,9 +19,9 @@ module Onebox
|
|
19
19
|
def match
|
20
20
|
return @match if @match
|
21
21
|
|
22
|
-
@match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/
|
22
|
+
@match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/commit/(?<sha>[^/]+)})
|
23
23
|
|
24
|
-
@match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<pr>[^/]+)/
|
24
|
+
@match = @url.match(%{github\.com/(?<owner>[^/]+)/(?<repository>[^/]+)/pull/(?<pr>[^/]+)/commit/(?<sha>[^/]+)}) if @match.nil?
|
25
25
|
|
26
26
|
@match
|
27
27
|
end
|
@@ -42,7 +42,10 @@ module Onebox
|
|
42
42
|
end
|
43
43
|
|
44
44
|
ulink = URI(link)
|
45
|
-
|
45
|
+
committed_at = Time.parse(result['commit']['author']['date'])
|
46
|
+
result['committed_at'] = committed_at.strftime("%I:%M%p - %d %b %y %Z")
|
47
|
+
result['committed_at_date'] = committed_at.strftime("%F")
|
48
|
+
result['committed_at_time'] = committed_at.strftime("%T")
|
46
49
|
result['domain'] = "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}"
|
47
50
|
result
|
48
51
|
end
|
@@ -31,6 +31,9 @@ module Onebox
|
|
31
31
|
short_content = content_words[0..max_words].join(" ")
|
32
32
|
short_content += "..." if content_words.length > max_words
|
33
33
|
|
34
|
+
created_at = Time.parse(@raw['created_at'])
|
35
|
+
closed_at = Time.parse(@raw['closed_at']) if @raw['closed_at']
|
36
|
+
|
34
37
|
ulink = URI(link)
|
35
38
|
{
|
36
39
|
link: @url,
|
@@ -38,8 +41,12 @@ module Onebox
|
|
38
41
|
content: short_content.gsub("<br>", "\n"),
|
39
42
|
labels: @raw["labels"],
|
40
43
|
user: @raw['user'],
|
41
|
-
created_at:
|
42
|
-
|
44
|
+
created_at: created_at.strftime("%I:%M%p - %d %b %y %Z"),
|
45
|
+
created_at_date: created_at.strftime("%F"),
|
46
|
+
created_at_time: created_at.strftime("%T"),
|
47
|
+
closed_at: closed_at&.strftime("%I:%M%p - %d %b %y %Z"),
|
48
|
+
closed_at_date: closed_at&.strftime("%F"),
|
49
|
+
closed_at_time: closed_at&.strftime("%T"),
|
43
50
|
closed_by: @raw['closed_by'],
|
44
51
|
avatar: "https://avatars1.githubusercontent.com/u/#{@raw['user']['id']}?v=2&s=96",
|
45
52
|
domain: "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}",
|
@@ -23,7 +23,12 @@ module Onebox
|
|
23
23
|
def data
|
24
24
|
result = raw.clone
|
25
25
|
result['link'] = link
|
26
|
-
|
26
|
+
|
27
|
+
created_at = Time.parse(result['created_at'])
|
28
|
+
result['created_at'] = created_at.strftime("%I:%M%p - %d %b %y %Z")
|
29
|
+
result['created_at_date'] = created_at.strftime("%F")
|
30
|
+
result['created_at_time'] = created_at.strftime("%T")
|
31
|
+
|
27
32
|
ulink = URI(link)
|
28
33
|
result['domain'] = "#{ulink.host}/#{ulink.path.split('/')[1]}/#{ulink.path.split('/')[2]}"
|
29
34
|
result
|
@@ -17,7 +17,8 @@ class Sanitize
|
|
17
17
|
'video' => %w[controls height loop width autoplay muted poster],
|
18
18
|
'path' => %w[d],
|
19
19
|
'svg' => ['aria-hidden', 'width', 'height', 'viewbox'],
|
20
|
-
'div' => [:data], # any data-* attributes
|
20
|
+
'div' => [:data], # any data-* attributes,
|
21
|
+
'span' => [:data], # any data-* attributes
|
21
22
|
},
|
22
23
|
|
23
24
|
add_attributes: {
|
data/lib/onebox/version.rb
CHANGED
@@ -1,25 +1,41 @@
|
|
1
|
-
<
|
1
|
+
<div class="github-row">
|
2
|
+
<div class="github-icon-container" title="Commit">
|
3
|
+
<svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" version="1.1" aria-hidden="true"><path fill-rule="evenodd" d="M10.86 7c-.45-1.72-2-3-3.86-3-1.86 0-3.41 1.28-3.86 3H0v2h3.14c.45 1.72 2 3 3.86 3 1.86 0 3.41-1.28 3.86-3H14V7h-3.14zM7 10.2c-1.22 0-2.2-.98-2.2-2.2 0-1.22.98-2.2 2.2-2.2 1.22 0 2.2.98 2.2 2.2 0 1.22-.98 2.2-2.2 2.2z"></path></svg>
|
4
|
+
</div>
|
2
5
|
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
</a>
|
8
|
-
{{/author.avatar_url}}
|
9
|
-
<a href="{{html_url}}" target="_blank">{{title}}</a>
|
10
|
-
</h4>
|
6
|
+
<div class="github-info-container">
|
7
|
+
<h4>
|
8
|
+
<a href="{{html_url}}" target="_blank">{{title}}</a>
|
9
|
+
</h4>
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
{{
|
11
|
+
<div class="github-info">
|
12
|
+
<div class="date">
|
13
|
+
committed <span class="discourse-local-date" data-format='ll' data-date="{{committed_at_date}}" data-time="{{committed_at_time}}" data-timezone="UTC">{{committed_at}}</span>
|
14
|
+
</div>
|
15
15
|
|
16
|
-
<div class="
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
<div class="user">
|
17
|
+
<a href="{{author.html_url}}" target="_blank">
|
18
|
+
<img alt="{{author.login}}" src="{{author.avatar_url}}" class="onebox-avatar-inline" width="20" height="20">
|
19
|
+
{{author.login}}
|
20
|
+
</a>
|
21
|
+
|
22
|
+
</div>
|
20
23
|
|
21
|
-
<div class="
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
<div class="lines" title="changed {{files.length}} files with {{stats.additions}} additions and {{stats.deletions}} deletions">
|
25
|
+
<a href="{{html_url}}/files" target="_blank">
|
26
|
+
<span class="added">+{{stats.additions}}</span>
|
27
|
+
<span class="removed">-{{stats.deletions}}</span>
|
28
|
+
</a>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
</div>
|
25
33
|
</div>
|
34
|
+
|
35
|
+
|
36
|
+
{{#message}}
|
37
|
+
<div class="github-row">
|
38
|
+
<pre class="github-content" style="white-space: normal;">{{message}}</pre>
|
39
|
+
</div>
|
40
|
+
{{/message}}
|
41
|
+
|
@@ -1,29 +1,40 @@
|
|
1
|
-
<
|
1
|
+
<div class="github-row">
|
2
|
+
<div class="github-icon-container" title="Issue">
|
3
|
+
<svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" version="1.1" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
|
4
|
+
</div>
|
2
5
|
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
<a href="{{link}}" target="_blank">{{title}}</a>
|
8
|
-
</h4>
|
6
|
+
<div class="github-info-container">
|
7
|
+
<h4>
|
8
|
+
<a href="{{link}}" target="_blank">{{title}}</a>
|
9
|
+
</h4>
|
9
10
|
|
10
|
-
<div class="
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
</div>
|
21
|
-
</div>
|
11
|
+
<div class="github-info">
|
12
|
+
<div class="date">
|
13
|
+
opened <span class="discourse-local-date" data-format='ll' data-date="{{created_at_date}}" data-time="{{created_at_time}}" data-timezone="UTC">{{created_at}}</span>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
{{#closed_at}}
|
17
|
+
<div class="date">
|
18
|
+
closed <span class="discourse-local-date" data-format='ll' data-date="{{closed_at_date}}" data-time="{{closed_at_time}}" data-timezone="UTC">{{closed_at}}</span>
|
19
|
+
</div>
|
20
|
+
{{/closed_at}}
|
22
21
|
|
23
|
-
<
|
22
|
+
<div class="user">
|
23
|
+
<a href="{{user.html_url}}" target="_blank">
|
24
|
+
<img alt="{{user.login}}" src="{{user.avatar_url}}" class="onebox-avatar-inline" width="20" height="20">
|
25
|
+
{{user.login}}
|
26
|
+
</a>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</div>
|
24
31
|
|
25
|
-
<div class=
|
26
|
-
|
27
|
-
<span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">{{name}}</span>
|
28
|
-
{{/labels}}
|
32
|
+
<div class="github-row">
|
33
|
+
<p class='github-content'>{{content}}</p>
|
29
34
|
</div>
|
35
|
+
|
36
|
+
{{#labels}}
|
37
|
+
<div class='labels'>
|
38
|
+
<span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;">{{name}}</span>
|
39
|
+
</div>
|
40
|
+
{{/labels}}
|
@@ -1,22 +1,36 @@
|
|
1
|
-
<
|
1
|
+
<div class="github-row">
|
2
|
+
<div class="github-icon-container" title="Pull Request">
|
3
|
+
<svg width="60" height="60" class="github-icon" viewBox="0 0 12 16" version="1.1" aria-hidden="true"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
|
4
|
+
</div>
|
2
5
|
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
</a>
|
8
|
-
{{/user.avatar_url}}
|
9
|
-
<a href="{{html_url}}" target="_blank">{{title}}</a>
|
10
|
-
</h4>
|
6
|
+
<div class="github-info-container">
|
7
|
+
<h4>
|
8
|
+
<a href="{{html_url}}" target="_blank">{{title}}</a>
|
9
|
+
</h4>
|
11
10
|
|
12
|
-
<div class="
|
13
|
-
|
14
|
-
|
15
|
-
</div>
|
11
|
+
<div class="branches">
|
12
|
+
<code>{{base.label}}</code> ← <code>{{head.label}}</code>
|
13
|
+
</div>
|
16
14
|
|
17
|
-
<div class="github-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
<div class="github-info">
|
16
|
+
<div class="date">
|
17
|
+
opened <span class="discourse-local-date" data-format='ll' data-date="{{created_at_date}}" data-time="{{created_at_time}}" data-timezone="UTC">{{created_at}}</span>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="user">
|
21
|
+
<a href="{{user.html_url}}" target="_blank">
|
22
|
+
<img alt="{{user.login}}" src="{{user.avatar_url}}" class="onebox-avatar-inline" width="20" height="20">
|
23
|
+
{{user.login}}
|
24
|
+
</a>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="lines" title="{{commits}} commits changed {{changed_files}} files with {{additions}} additions and {{deletions}} deletions">
|
28
|
+
<a href="{{html_url}}/files" target="_blank">
|
29
|
+
<span class="added">+{{additions}}</span>
|
30
|
+
<span class="removed">-{{deletions}}</span>
|
31
|
+
</a>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
</div>
|
36
|
+
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onebox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joanna Zeta
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-10-
|
13
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: multi_json
|