Refactor plugins and erros
This commit is contained in:
@@ -144,7 +144,7 @@
|
||||
<div class="field <%= computed.plugins.lines.error ? 'error' : '' %>">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.72 3.22a.75.75 0 011.06 1.06L2.06 8l3.72 3.72a.75.75 0 11-1.06 1.06L.47 8.53a.75.75 0 010-1.06l4.25-4.25zm6.56 0a.75.75 0 10-1.06 1.06L13.94 8l-3.72 3.72a.75.75 0 101.06 1.06l4.25-4.25a.75.75 0 000-1.06l-4.25-4.25z"></path></svg>
|
||||
<% if (computed.plugins.lines.error) { %>
|
||||
<%= computed.plugins.lines.error %>
|
||||
<%= computed.plugins.lines.error.message %>
|
||||
<% } else { %>
|
||||
<%= computed.plugins.lines.added %> added, <%= computed.plugins.lines.deleted %> removed
|
||||
<% } %>
|
||||
@@ -168,7 +168,7 @@
|
||||
<div class="field <%= computed.plugins.traffic.error ? 'error' : '' %>">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M0 1.75A.75.75 0 01.75 1h4.253c1.227 0 2.317.59 3 1.501A3.744 3.744 0 0111.006 1h4.245a.75.75 0 01.75.75v10.5a.75.75 0 01-.75.75h-4.507a2.25 2.25 0 00-1.591.659l-.622.621a.75.75 0 01-1.06 0l-.622-.621A2.25 2.25 0 005.258 13H.75a.75.75 0 01-.75-.75V1.75zm8.755 3a2.25 2.25 0 012.25-2.25H14.5v9h-3.757c-.71 0-1.4.201-1.992.572l.004-7.322zm-1.504 7.324l.004-5.073-.002-2.253A2.25 2.25 0 005.003 2.5H1.5v9h3.757a3.75 3.75 0 011.994.574z"></path></svg>
|
||||
<% if (computed.plugins.traffic.error) { %>
|
||||
<%= computed.plugins.traffic.error %>
|
||||
<%= computed.plugins.traffic.error.message %>
|
||||
<% } else { %>
|
||||
<%= computed.plugins.traffic.views.count %> view<%= s(computed.plugins.traffic.views.count) %> in last two weeks
|
||||
<% } %>
|
||||
@@ -188,7 +188,7 @@
|
||||
<section>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.47.22A.75.75 0 015 0h6a.75.75 0 01.53.22l4.25 4.25c.141.14.22.331.22.53v6a.75.75 0 01-.22.53l-4.25 4.25A.75.75 0 0111 16H5a.75.75 0 01-.53-.22L.22 11.53A.75.75 0 010 11V5a.75.75 0 01.22-.53L4.47.22zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5H5.31zM8 4a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 8a1 1 0 100-2 1 1 0 000 2z"></path></svg>
|
||||
<%= computed.plugins.followup.error %>
|
||||
<%= computed.plugins.followup.error.message %>
|
||||
</div>
|
||||
</section>
|
||||
<% } else { %>
|
||||
@@ -219,7 +219,7 @@
|
||||
<section>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.47.22A.75.75 0 015 0h6a.75.75 0 01.53.22l4.25 4.25c.141.14.22.331.22.53v6a.75.75 0 01-.22.53l-4.25 4.25A.75.75 0 0111 16H5a.75.75 0 01-.53-.22L.22 11.53A.75.75 0 010 11V5a.75.75 0 01.22-.53L4.47.22zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5H5.31zM8 4a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 8a1 1 0 100-2 1 1 0 000 2z"></path></svg>
|
||||
<%= computed.plugins.followup.error %>
|
||||
<%= computed.plugins.followup.error.message %>
|
||||
</div>
|
||||
</section>
|
||||
<% } else { %>
|
||||
@@ -254,7 +254,7 @@
|
||||
<section>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.47.22A.75.75 0 015 0h6a.75.75 0 01.53.22l4.25 4.25c.141.14.22.331.22.53v6a.75.75 0 01-.22.53l-4.25 4.25A.75.75 0 0111 16H5a.75.75 0 01-.53-.22L.22 11.53A.75.75 0 010 11V5a.75.75 0 01.22-.53L4.47.22zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5H5.31zM8 4a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 8a1 1 0 100-2 1 1 0 000 2z"></path></svg>
|
||||
<%= computed.plugins.languages.error %>
|
||||
<%= computed.plugins.languages.error.message %>
|
||||
</div>
|
||||
</section>
|
||||
<% } else { %>
|
||||
@@ -297,7 +297,7 @@
|
||||
<section>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.47.22A.75.75 0 015 0h6a.75.75 0 01.53.22l4.25 4.25c.141.14.22.331.22.53v6a.75.75 0 01-.22.53l-4.25 4.25A.75.75 0 0111 16H5a.75.75 0 01-.53-.22L.22 11.53A.75.75 0 010 11V5a.75.75 0 01.22-.53L4.47.22zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5H5.31zM8 4a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 8a1 1 0 100-2 1 1 0 000 2z"></path></svg>
|
||||
<%= computed.plugins.pagespeed.error %>
|
||||
<%= computed.plugins.pagespeed.error.message %>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
@@ -336,7 +336,7 @@
|
||||
<section>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.47.22A.75.75 0 015 0h6a.75.75 0 01.53.22l4.25 4.25c.141.14.22.331.22.53v6a.75.75 0 01-.22.53l-4.25 4.25A.75.75 0 0111 16H5a.75.75 0 01-.53-.22L.22 11.53A.75.75 0 010 11V5a.75.75 0 01.22-.53L4.47.22zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5H5.31zM8 4a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 8a1 1 0 100-2 1 1 0 000 2z"></path></svg>
|
||||
<%= computed.plugins.habits.error %>
|
||||
<%= computed.plugins.habits.error.message %>
|
||||
</div>
|
||||
</section>
|
||||
<% } else { %>
|
||||
@@ -370,7 +370,7 @@
|
||||
<% if (computed.plugins.music.error) { %>
|
||||
<div class="field error">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M4.47.22A.75.75 0 015 0h6a.75.75 0 01.53.22l4.25 4.25c.141.14.22.331.22.53v6a.75.75 0 01-.22.53l-4.25 4.25A.75.75 0 0111 16H5a.75.75 0 01-.53-.22L.22 11.53A.75.75 0 010 11V5a.75.75 0 01.22-.53L4.47.22zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5H5.31zM8 4a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 018 4zm0 8a1 1 0 100-2 1 1 0 000 2z"></path></svg>
|
||||
<%= computed.plugins.music.error %>
|
||||
<%= computed.plugins.music.error.message %>
|
||||
</div>
|
||||
<% } else { %>
|
||||
<% if (computed.plugins.music.tracks.length) { %>
|
||||
|
||||
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 38 KiB |
@@ -6,15 +6,19 @@
|
||||
const avatar = imports.imgb64(data.user.avatarUrl)
|
||||
|
||||
//Plugins
|
||||
if (data.user.websiteUrl)
|
||||
imports.plugins.pagespeed({login, imports, url:data.user.websiteUrl, computed, pending, q}, plugins.pagespeed)
|
||||
imports.plugins.music({login, imports, data, computed, pending, q}, plugins.music)
|
||||
imports.plugins.lines({login, imports, repositories:data.user.repositories.nodes.map(({name}) => name), rest, computed, pending, q}, plugins.lines)
|
||||
imports.plugins.traffic({login, imports, repositories:data.user.repositories.nodes.map(({name}) => name), rest, computed, pending, q}, plugins.traffic)
|
||||
imports.plugins.habits({login, imports, rest, computed, pending, q}, plugins.habits)
|
||||
imports.plugins.selfskip({login, imports, rest, computed, pending, q}, plugins.selfskip)
|
||||
imports.plugins.languages({login, imports, data, computed, pending, q}, plugins.languages)
|
||||
imports.plugins.followup({login, imports, data, computed, pending, q}, plugins.followup)
|
||||
for (const name of Object.keys(imports.plugins)) {
|
||||
pending.push((async () => {
|
||||
try {
|
||||
computed.plugins[name] = await imports.plugins[name]({login, q, imports, data, computed, rest, graphql}, plugins[name])
|
||||
}
|
||||
catch (error) {
|
||||
computed.plugins[name] = error
|
||||
}
|
||||
finally {
|
||||
return {name, result:computed.plugins[name]}
|
||||
}
|
||||
})())
|
||||
}
|
||||
|
||||
//Iterate through user's repositories
|
||||
for (const repository of data.user.repositories.nodes) {
|
||||
|
||||
@@ -99,7 +99,7 @@ Last generated: <%= new Date().toGMTString() %>
|
||||
<div class="stdout"><%# -%>
|
||||
Total <%= user.repositories.totalCount %> repositor<%= s(user.repositories.totalCount, "y") %>
|
||||
<% if (computed.plugins.traffic) { if (computed.plugins.traffic.error) { -%>
|
||||
---- <b> </b> views <span class="error">(<%= computed.plugins.traffic.error %>)</span>
|
||||
---- <b> </b> views <span class="error">(<%= computed.plugins.traffic.error.message %>)</span>
|
||||
<% } else { -%>
|
||||
-r-- <b><%= `${computed.plugins.traffic.views.count}`.padStart(5) %></b> views
|
||||
<% }} -%>
|
||||
@@ -109,8 +109,8 @@ Total <%= user.repositories.totalCount %> repositor<%= s(user.repositories.total
|
||||
dr-x <b><%= `${user.packages.totalCount}`.padStart(5) %></b> package<%= s(user.packages.totalCount) %>
|
||||
dr-x <b><%= `${user.gists.totalCount}`.padStart(5) %></b> gist<%= s(user.gists.totalCount) %>
|
||||
<% if (computed.plugins.followup) { if (computed.plugins.followup.error) { -%>
|
||||
d--- <b> </b> ISSUES <span class="error">(<%= computed.plugins.followup.error %>)</span>
|
||||
d--- <b> </b> PULL_REQUESTS <span class="error">(<%= computed.plugins.followup.error %>)</span>
|
||||
d--- <b> </b> ISSUES <span class="error">(<%= computed.plugins.followup.error.message %>)</span>
|
||||
d--- <b> </b> PULL_REQUESTS <span class="error">(<%= computed.plugins.followup.error.message %>)</span>
|
||||
<% } else { -%>
|
||||
dr-x <b><%= `${computed.plugins.followup.issues.count}`.padStart(5) %></b> ISSUES
|
||||
-r-- <b><%= `${computed.plugins.followup.issues.open}`.padStart(5) %></b> ├── open
|
||||
@@ -124,7 +124,7 @@ dr-x LICENSE
|
||||
-r-- └── <%= computed.licenses.favorite %>
|
||||
<% } -%>
|
||||
<% if (computed.plugins.lines) { if (computed.plugins.lines.error) { %>
|
||||
<span class="diff error">@@ <%= computed.plugins.lines.error %> @@</span><% } else { %>
|
||||
<span class="diff error">@@ <%= computed.plugins.lines.error.message %> @@</span><% } else { %>
|
||||
<span class="diff">@@ -<%= computed.plugins.lines.deleted %> +<%= computed.plugins.lines.added %> @@</span>
|
||||
<% }} -%>
|
||||
</div><% } -%>
|
||||
@@ -133,7 +133,7 @@ dr-x LICENSE
|
||||
<div class="stdin"><%- meta.$ %> locale</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<% if (computed.plugins.languages.error) { -%>
|
||||
<span class="error"><%= computed.plugins.languages.error %></span><%# -%>
|
||||
<span class="error"><%= computed.plugins.languages.error.message %></span><%# -%>
|
||||
<% } else { for (const {name, value} of computed.plugins.languages.favorites) { -%>
|
||||
<b><%= name.toLocaleUpperCase().padEnd(12) %></b> [<%= "#".repeat(Math.ceil(100*value/5)).padEnd(20) %>] <%= (100*value).toFixed(2).padEnd(5) %>%
|
||||
<% }} -%>
|
||||
@@ -143,7 +143,7 @@ dr-x LICENSE
|
||||
<div class="stdin"><%- meta.$ %> curl -I <%= user.websiteUrl %></div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<% if (computed.plugins.pagespeed.error) { -%>
|
||||
<span class="error"><%= computed.plugins.pagespeed.error %></span><% } else { -%>
|
||||
<span class="error"><%= computed.plugins.pagespeed.error.message %></span><% } else { -%>
|
||||
<b>User-Agent</b>: Google PageSpeed API
|
||||
<b>Location</b>: <%= user.websiteUrl %>
|
||||
<% for (const {score, title} of computed.plugins.pagespeed.scores) { -%>
|
||||
|
||||
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Reference in New Issue
Block a user