feat(core): add config_base64 option (#622) [skip ci]

This commit is contained in:
Simon Lecoq
2021-10-26 08:40:32 -04:00
committed by GitHub
parent 04cf9b5f9e
commit a258b2d94a
2 changed files with 14 additions and 1 deletions

View File

@@ -6,9 +6,15 @@
//Setup //Setup
export default async function({login, q}, {conf, data, rest, graphql, plugins, queries, account, convert, template}, {pending, imports}) { export default async function({login, q}, {conf, data, rest, graphql, plugins, queries, account, convert, template}, {pending, imports}) {
//Load inputs //Load inputs
const {"config.animations":animations, "config.display":display, "config.timezone":_timezone, "debug.flags":dflags} = imports.metadata.plugins.core.inputs({data, account, q}) const {"config.animations":animations, "config.display":display, "config.timezone":_timezone, "config.base64":_base64, "debug.flags":dflags} = imports.metadata.plugins.core.inputs({data, account, q})
imports.metadata.templates[template].check({q, account, format:convert}) imports.metadata.templates[template].check({q, account, format:convert})
//Base64 images
if (!_base64) {
console.debug(`metrics/compute/${login} > base64 for images has been disabled`)
imports.imgb64 = url => url
}
//Init //Init
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, deployments:0, environments: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, deployments:0, environments:0}}
const avatar = imports.imgb64(data.user.avatarUrl) const avatar = imports.imgb64(data.user.avatarUrl)

View File

@@ -192,6 +192,13 @@ inputs:
type: boolean type: boolean
default: yes default: yes
# Encode images links into base64 data
# Advised to be true when generating images and false when generating texts or JSON
config_base64:
description: Encode images links into base64 data
type: boolean
default: yes
# Configure padding for output image (percentage value) # Configure padding for output image (percentage value)
# It can be used to add padding to generated metrics if rendering is cropped or has too much empty space # It can be used to add padding to generated metrics if rendering is cropped or has too much empty space
# Specify one value (for both width and height) or two values (one for width and one for height) # Specify one value (for both width and height) or two values (one for width and one for height)