diff --git a/source/plugins/core/index.mjs b/source/plugins/core/index.mjs index a0b4c3b49e8..df77386ad14 100644 --- a/source/plugins/core/index.mjs +++ b/source/plugins/core/index.mjs @@ -10,7 +10,7 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q imports.metadata.templates[template].check({q, account, format:convert}) //Init - const computed = {commits:0, sponsorships:0, licenses:{favorite:"", used:{}}, token:{}, repositories:{watchers:0, stargazers:0, issues_open:0, issues_closed:0, pr_open:0, pr_closed:0, pr_merged:0, forks:0, forked:0, releases:0}} + const computed = {commits:0, sponsorships:0, licenses:{favorite:"", used:{}, about:{}}, token:{}, repositories:{watchers:0, stargazers:0, issues_open:0, issues_closed:0, pr_open:0, pr_closed:0, pr_merged:0, forks:0, forked:0, releases:0}} const avatar = imports.imgb64(data.user.avatarUrl) data.computed = computed console.debug(`metrics/compute/${login} > formatting common metrics`) @@ -72,8 +72,10 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q if (repository.isFork) computed.repositories.forked++ //License - if (repository.licenseInfo) + if (repository.licenseInfo) { computed.licenses.used[repository.licenseInfo.spdxId] = (computed.licenses.used[repository.licenseInfo.spdxId] ?? 0) + 1 + computed.licenses.about[repository.licenseInfo.spdxId] = repository.licenseInfo + } } //Total disk usage diff --git a/source/templates/classic/partials/base.repositories.ejs b/source/templates/classic/partials/base.repositories.ejs index 93798ec118b..0bc7e238d3a 100644 --- a/source/templates/classic/partials/base.repositories.ejs +++ b/source/templates/classic/partials/base.repositories.ejs @@ -11,7 +11,7 @@
<% if (computed.licenses.favorite.length) { %> - Prefers <%= computed.licenses.favorite %> license + Prefers <%= f.license(computed.licenses.about[computed.licenses.favorite]) %> license <% } else { %> No license preference <% } %> diff --git a/source/templates/repository/partials/licenses.ejs b/source/templates/repository/partials/licenses.ejs index a8b96b1a5e8..c9d46abc96d 100644 --- a/source/templates/repository/partials/licenses.ejs +++ b/source/templates/repository/partials/licenses.ejs @@ -16,7 +16,7 @@
- <%= plugins.licenses.default?.spdxId ?? "No license provided" %> + <%= plugins.licenses.default ? f.license(plugins.licenses.default) : "No license provided" %>