Code formatting (#280)

This commit is contained in:
Simon Lecoq
2021-04-29 14:32:34 +02:00
committed by GitHub
parent 92090b60b5
commit ce18af8573
98 changed files with 10278 additions and 9807 deletions

View File

@@ -2,12 +2,12 @@
import core from "@actions/core" import core from "@actions/core"
import github from "@actions/github" import github from "@actions/github"
import octokit from "@octokit/graphql" import octokit from "@octokit/graphql"
import setup from "../metrics/setup.mjs"
import mocks from "../mocks/index.mjs"
import metrics from "../metrics/index.mjs"
import fs from "fs/promises" import fs from "fs/promises"
import paths from "path" import paths from "path"
import sgit from "simple-git" import sgit from "simple-git"
import metrics from "../metrics/index.mjs"
import setup from "../metrics/setup.mjs"
import mocks from "../mocks/index.mjs"
process.on("unhandledRejection", error => { process.on("unhandledRejection", error => {
throw error throw error
}) })
@@ -18,11 +18,15 @@
//Info logger //Info logger
const info = (left, right, {token = false} = {}) => console.log(`${`${left}`.padEnd(56 + 9 * (/0m$/.test(left)))}${ const info = (left, right, {token = false} = {}) => console.log(`${`${left}`.padEnd(56 + 9 * (/0m$/.test(left)))}${
Array.isArray(right) ? right.join(", ") || "(none)" : Array.isArray(right)
right === undefined ? "(default)" : ? right.join(", ") || "(none)"
token ? /^MOCKED/.test(right) ? "(MOCKED TOKEN)" : /^NOT_NEEDED$/.test(right) ? "(NOT NEEDED)" : (right ? "(provided)" : "(missing)") : : right === undefined
typeof right === "object" ? JSON.stringify(right) : ? "(default)"
right : token
? /^MOCKED/.test(right) ? "(MOCKED TOKEN)" : /^NOT_NEEDED$/.test(right) ? "(NOT NEEDED)" : (right ? "(provided)" : "(missing)")
: typeof right === "object"
? JSON.stringify(right)
: right
}`) }`)
info.section = (left = "", right = " ") => info(`\x1b[36m${left}\x1b[0m`, right) info.section = (left = "", right = " ") => info(`\x1b[36m${left}\x1b[0m`, right)
info.group = ({metadata, name, inputs}) => { info.group = ({metadata, name, inputs}) => {
@@ -65,14 +69,28 @@
//Core inputs //Core inputs
const { const {
user:_user, repo:_repo, token, user:_user,
template, query, "setup.community.templates":_templates, repo:_repo,
filename:_filename, optimize, verify, "markdown.cache":_markdown_cache, token,
debug, "debug.flags":dflags, "use.mocked.data":mocked, dryrun, template,
query,
"setup.community.templates":_templates,
filename:_filename,
optimize,
verify,
"markdown.cache":_markdown_cache,
debug,
"debug.flags":dflags,
"use.mocked.data":mocked,
dryrun,
"plugins.errors.fatal":die, "plugins.errors.fatal":die,
"committer.token":_token, "committer.branch":_branch, "committer.message":_message, "committer.gist":_gist, "committer.token":_token,
"committer.branch":_branch,
"committer.message":_message,
"committer.gist":_gist,
"use.prebuilt.image":_image, "use.prebuilt.image":_image,
retries, "retries.delay":retries_delay, retries,
"retries.delay":retries_delay,
"output.action":_action, "output.action":_action,
...config ...config
} = metadata.plugins.core.inputs.action({core}) } = metadata.plugins.core.inputs.action({core})
@@ -111,8 +129,11 @@
//Test token validity //Test token validity
else if (!/^NOT_NEEDED$/.test(token)) { else if (!/^NOT_NEEDED$/.test(token)) {
const {headers} = await api.rest.request("HEAD /") const {headers} = await api.rest.request("HEAD /")
if (!("x-oauth-scopes" in headers)) if (!("x-oauth-scopes" in headers)) {
throw new Error("GitHub API did not send any \"x-oauth-scopes\" header back from provided \"token\". It means that your token may not be valid or you're using GITHUB_TOKEN which cannot be used since metrics will fetch data outside of this repository scope. Use a personal access token instead (see https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/setup/action/setup.md for more informations).") throw new Error(
'GitHub API did not send any "x-oauth-scopes" header back from provided "token". It means that your token may not be valid or you\'re using GITHUB_TOKEN which cannot be used since metrics will fetch data outside of this repository scope. Use a personal access token instead (see https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/setup/action/setup.md for more informations).',
)
}
info("Token validity", "seems ok") info("Token validity", "seems ok")
} }
//Extract octokits //Extract octokits
@@ -179,17 +200,21 @@
} }
else else
throw error throw error
} }
//Retrieve previous render SHA to be able to update file content through API //Retrieve previous render SHA to be able to update file content through API
committer.sha = null committer.sha = null
try { try {
const {repository:{object:{oid}}} = await graphql(` const {repository:{object:{oid}}} = await graphql(
`
query Sha { query Sha {
repository(owner: "${github.context.repo.owner}", name: "${github.context.repo.repo}") { repository(owner: "${github.context.repo.owner}", name: "${github.context.repo.repo}") {
object(expression: "${committer.head}:${filename}") { ... on Blob { oid } } object(expression: "${committer.head}:${filename}") { ... on Blob { oid } }
} }
} }
`, {headers:{authorization:`token ${committer.token}`}}) `,
{headers:{authorization:`token ${committer.token}`}},
)
committer.sha = oid committer.sha = oid
} }
catch (error) { catch (error) {
@@ -200,6 +225,7 @@
else else
info("Dry-run", true) info("Dry-run", true)
//SVG file //SVG file
conf.settings.optimize = optimize conf.settings.optimize = optimize
info("SVG output", filename) info("SVG output", filename)
@@ -297,13 +323,16 @@
console.debug(`Processing ${path}`) console.debug(`Processing ${path}`)
let sha = null let sha = null
try { try {
const {repository:{object:{oid}}} = await graphql(` const {repository:{object:{oid}}} = await graphql(
`
query Sha { query Sha {
repository(owner: "${github.context.repo.owner}", name: "${github.context.repo.repo}") { repository(owner: "${github.context.repo.owner}", name: "${github.context.repo.repo}") {
object(expression: "${committer.head}:${path}") { ... on Blob { oid } } object(expression: "${committer.head}:${path}") { ... on Blob { oid } }
} }
} }
`, {headers:{authorization:`token ${committer.token}`}}) `,
{headers:{authorization:`token ${committer.token}`}},
)
sha = oid sha = oid
} }
catch (error) { catch (error) {
@@ -311,8 +340,11 @@
} }
finally { finally {
await committer.rest.repos.createOrUpdateFileContents({ await committer.rest.repos.createOrUpdateFileContents({
...github.context.repo, path, content, ...github.context.repo,
message:`${committer.message} (cache)`, ...(sha ? {sha} : {}), path,
content,
message:`${committer.message} (cache)`,
...(sha ? {sha} : {}),
branch:committer.pr ? committer.head : committer.branch, branch:committer.pr ? committer.head : committer.branch,
}) })
rendered = rendered.replace(match, `<img src="https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/blob/${committer.branch}/${path}">`) rendered = rendered.replace(match, `<img src="https://github.com/${github.context.repo.owner}/${github.context.repo.repo}/blob/${committer.branch}/${path}">`)
@@ -342,7 +374,9 @@
//Commit metrics //Commit metrics
if (committer.commit) { if (committer.commit) {
await committer.rest.repos.createOrUpdateFileContents({ await committer.rest.repos.createOrUpdateFileContents({
...github.context.repo, path:filename, message:committer.message, ...github.context.repo,
path:filename,
message:committer.message,
content:Buffer.from(rendered).toString("base64"), content:Buffer.from(rendered).toString("base64"),
branch:committer.pr ? committer.head : committer.branch, branch:committer.pr ? committer.head : committer.branch,
...(committer.sha ? {sha:committer.sha} : {}), ...(committer.sha ? {sha:committer.sha} : {}),
@@ -379,6 +413,7 @@
} }
else else
throw error throw error
} }
info("Pull request number", number) info("Pull request number", number)
//Merge pull request //Merge pull request

View File

@@ -1,15 +1,14 @@
//Imports //Imports
import * as utils from "./utils.mjs"
import ejs from "ejs" import ejs from "ejs"
import util from "util"
import SVGO from "svgo" import SVGO from "svgo"
import util from "util"
import xmlformat from "xml-formatter" import xmlformat from "xml-formatter"
import * as utils from "./utils.mjs"
//Setup //Setup
export default async function metrics({login, q}, {graphql, rest, plugins, conf, die = false, verify = false, convert = null}, {Plugins, Templates}) { export default async function metrics({login, q}, {graphql, rest, plugins, conf, die = false, verify = false, convert = null}, {Plugins, Templates}) {
//Compute rendering //Compute rendering
try { try {
//Debug //Debug
login = login.replace(/[\n\r]/g, "") login = login.replace(/[\n\r]/g, "")
console.debug(`metrics/compute/${login} > start`) console.debug(`metrics/compute/${login} > start`)
@@ -28,9 +27,19 @@
const pending = [] const pending = []
const {queries} = conf const {queries} = conf
const data = {animated:true, base:{}, config:{}, errors:[], plugins:{}, computed:{}} const data = {animated:true, base:{}, config:{}, errors:[], plugins:{}, computed:{}}
const imports = {plugins:Plugins, templates:Templates, metadata:conf.metadata, ...utils, ...(/markdown/.test(convert) ? {imgb64(url, options) { const imports = {
plugins:Plugins,
templates:Templates,
metadata:conf.metadata,
...utils,
...(/markdown/.test(convert)
? {
imgb64(url, options) {
return options?.force ? utils.imgb64(...arguments) : url return options?.force ? utils.imgb64(...arguments) : url
}} : null)} },
}
: null),
}
const experimental = new Set(decodeURIComponent(q["experimental.features"] ?? "").split(" ").map(x => x.trim().toLocaleLowerCase()).filter(x => x)) const experimental = new Set(decodeURIComponent(q["experimental.features"] ?? "").split(" ").map(x => x.trim().toLocaleLowerCase()).filter(x => x))
if (conf.settings["debug.headless"]) if (conf.settings["debug.headless"])
imports.puppeteer.headless = false imports.puppeteer.headless = false
@@ -94,7 +103,7 @@
} }
//Translate action syntax to web syntax //Translate action syntax to web syntax
let parts = [] let parts = []
if (q.base === true) if (q.base === true);
({parts} = conf.settings.plugins.base) ({parts} = conf.settings.plugins.base)
if (typeof q.base === "string") if (typeof q.base === "string")
parts = q.base.split(",").map(x => x.trim()) parts = q.base.split(",").map(x => x.trim())
@@ -147,7 +156,9 @@
if ((conf.settings?.optimize) && (!q.raw)) { if ((conf.settings?.optimize) && (!q.raw)) {
console.debug(`metrics/compute/${login} > optimize`) console.debug(`metrics/compute/${login} > optimize`)
if (experimental.has("--optimize")) { if (experimental.has("--optimize")) {
const {error, data:optimized} = await SVGO.optimize(rendered, {multipass:true, plugins:SVGO.extendDefaultPlugins([ const {error, data:optimized} = await SVGO.optimize(rendered, {
multipass:true,
plugins:SVGO.extendDefaultPlugins([
//Additional cleanup //Additional cleanup
{name:"cleanupListOfValues"}, {name:"cleanupListOfValues"},
{name:"removeRasterImages"}, {name:"removeRasterImages"},
@@ -155,7 +166,8 @@
//Force CSS style consistency //Force CSS style consistency
{name:"inlineStyles", active:false}, {name:"inlineStyles", active:false},
{name:"removeViewBox", active:false}, {name:"removeViewBox", active:false},
])}) ]),
})
if (error) if (error)
throw new Error(`Could not optimize SVG: \n${error}`) throw new Error(`Could not optimize SVG: \n${error}`)
rendered = optimized rendered = optimized
@@ -163,6 +175,7 @@
} }
else else
console.debug(`metrics/compute/${login} > optimize > this feature is currently disabled due to display issues (use --optimize flag in experimental features to force enable it)`) console.debug(`metrics/compute/${login} > optimize > this feature is currently disabled due to display issues (use --optimize flag in experimental features to force enable it)`)
} }
//Verify svg //Verify svg
if (verify) { if (verify) {
@@ -190,4 +203,3 @@
throw error throw error
} }
} }

View File

@@ -1,8 +1,8 @@
//Imports //Imports
import fs from "fs" import fs from "fs"
import yaml from "js-yaml"
import path from "path" import path from "path"
import url from "url" import url from "url"
import yaml from "js-yaml"
//Defined categories //Defined categories
const categories = ["core", "github", "social", "other"] const categories = ["core", "github", "social", "other"]
@@ -76,7 +76,8 @@
throw {error:{message:`Not supported for: ${context}`, instance:new Error()}} throw {error:{message:`Not supported for: ${context}`, instance:new Error()}}
} }
//Inputs checks //Inputs checks
const result = Object.fromEntries(Object.entries(inputs).map(([key, {type, format, default:defaulted, min, max, values}]) => [ const result = Object.fromEntries(
Object.entries(inputs).map(([key, {type, format, default:defaulted, min, max, values}]) => [
//Format key //Format key
metadata.to.query(key, {name}), metadata.to.query(key, {name}),
//Format value //Format value
@@ -153,7 +154,8 @@
} }
} }
})(defaults[key] ?? defaulted), })(defaults[key] ?? defaulted),
])) ]),
)
logger(`metrics/inputs > ${name} > ${JSON.stringify(result)}`) logger(`metrics/inputs > ${name} > ${JSON.stringify(result)}`)
return result return result
} }
@@ -174,13 +176,15 @@
}) })
//Action descriptor //Action descriptor
meta.action = Object.fromEntries(Object.entries(inputs).map(([key, value]) => [ meta.action = Object.fromEntries(
Object.entries(inputs).map(([key, value]) => [
key, key,
{ {
comment:comments[key] ?? "", comment:comments[key] ?? "",
descriptor:yaml.dump({[key]:Object.fromEntries(Object.entries(value).filter(([key]) => ["description", "default", "required"].includes(key)))}, {quotingType:'"', noCompatMode:true}), descriptor:yaml.dump({[key]:Object.fromEntries(Object.entries(value).filter(([key]) => ["description", "default", "required"].includes(key)))}, {quotingType:'"', noCompatMode:true}),
}, },
])) ]),
)
//Action inputs //Action inputs
meta.inputs.action = function({core}) { meta.inputs.action = function({core}) {
@@ -202,7 +206,8 @@
//Web metadata //Web metadata
{ {
meta.web = Object.fromEntries(Object.entries(inputs).map(([key, {type, description:text, example, default:defaulted, min = 0, max = 9999, values}]) => [ meta.web = Object.fromEntries(
Object.entries(inputs).map(([key, {type, description:text, example, default:defaulted, min = 0, max = 9999, values}]) => [
//Format key //Format key
metadata.to.query(key), metadata.to.query(key),
//Value descriptor //Value descriptor
@@ -225,7 +230,8 @@
return null return null
} }
})(), })(),
]).filter(([key, value]) => (value)&&(key !== name))) ]).filter(([key, value]) => (value) && (key !== name)),
)
} }
//Readme metadata //Readme metadata

View File

@@ -1,12 +1,12 @@
//Imports //Imports
import fs from "fs"
import metadata from "./metadata.mjs"
import path from "path"
import processes from "child_process"
import util from "util"
import url from "url"
import yaml from "js-yaml"
import OctokitRest from "@octokit/rest" import OctokitRest from "@octokit/rest"
import processes from "child_process"
import fs from "fs"
import yaml from "js-yaml"
import path from "path"
import url from "url"
import util from "util"
import metadata from "./metadata.mjs"
//Templates and plugins //Templates and plugins
const Templates = {} const Templates = {}
@@ -14,7 +14,6 @@
/**Setup */ /**Setup */
export default async function({log = true, nosettings = false, community = {}} = {}) { export default async function({log = true, nosettings = false, community = {}} = {}) {
//Paths //Paths
const __metrics = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "../../..") const __metrics = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "../../..")
const __statics = path.join(__metrics, "source/app/web/statics") const __statics = path.join(__metrics, "source/app/web/statics")
@@ -52,6 +51,8 @@
} }
else else
logger("metrics/setup > load settings.json > (missing)") logger("metrics/setup > load settings.json > (missing)")
if (!conf.settings.templates) if (!conf.settings.templates)
conf.settings.templates = {default:"classic", enabled:[]} conf.settings.templates = {default:"classic", enabled:[]}
if (!conf.settings.plugins) if (!conf.settings.plugins)
@@ -104,10 +105,13 @@
} }
else else
logger(`metrics/setup > @${name} could not extends ${inherit} as it does not exist`) logger(`metrics/setup > @${name} could not extends ${inherit} as it does not exist`)
} }
} }
else else
logger(`metrics/setup > @${name}/template.mjs does not exist`) logger(`metrics/setup > @${name}/template.mjs does not exist`)
//Clean remote repository //Clean remote repository
logger(`metrics/setup > clean ${repo}@${branch}`) logger(`metrics/setup > clean ${repo}@${branch}`)
await fs.promises.rmdir(path.join(__templates, ".community"), {recursive:true}) await fs.promises.rmdir(path.join(__templates, ".community"), {recursive:true})
@@ -122,6 +126,7 @@
else else
logger("metrics/setup > no community templates to install") logger("metrics/setup > no community templates to install")
//Load templates //Load templates
for (const name of await fs.promises.readdir(__templates)) { for (const name of await fs.promises.readdir(__templates)) {
//Search for templates //Search for templates
@@ -201,7 +206,8 @@
for (const [key, value] of Object.entries(vars)) for (const [key, value] of Object.entries(vars))
queried = queried.replace(new RegExp(`[$]${key}`, "g"), value) queried = queried.replace(new RegExp(`[$]${key}`, "g"), value)
return queried return queried
}) }
)
} }
} }
@@ -220,12 +226,13 @@
} }
//Set no token property //Set no token property
Object.defineProperty(conf.settings, "notoken", {get() { Object.defineProperty(conf.settings, "notoken", {
get() {
return conf.settings.token === "NOT_NEEDED" return conf.settings.token === "NOT_NEEDED"
}}) },
})
//Conf //Conf
logger("metrics/setup > setup > success") logger("metrics/setup > setup > success")
return {Templates, Plugins, conf} return {Templates, Plugins, conf}
} }

View File

@@ -1,29 +1,29 @@
//Imports //Imports
import fs from "fs/promises" import fs from "fs/promises"
import prism_lang from "prismjs/components/index.js"
import axios from "axios"
import processes from "child_process"
import fss from "fs" import fss from "fs"
import GIFEncoder from "gifencoder"
import jimp from "jimp"
import marked from "marked"
import nodechartist from "node-chartist"
import opengraph from "open-graph-scraper"
import os from "os" import os from "os"
import paths from "path" import paths from "path"
import url from "url" import PNG from "png-js"
import util from "util" import prism from "prismjs"
import processes from "child_process"
import axios from "axios"
import _puppeteer from "puppeteer" import _puppeteer from "puppeteer"
import rss from "rss-parser"
import htmlsanitize from "sanitize-html"
import git from "simple-git" import git from "simple-git"
import twemojis from "twemoji-parser" import twemojis from "twemoji-parser"
import jimp from "jimp" import url from "url"
import opengraph from "open-graph-scraper" import util from "util"
import rss from "rss-parser"
import nodechartist from "node-chartist"
import GIFEncoder from "gifencoder"
import PNG from "png-js"
import marked from "marked"
import htmlsanitize from "sanitize-html"
import prism from "prismjs"
import prism_lang from "prismjs/components/index.js"
prism_lang() prism_lang()
//Exports //Exports
export {fs, os, paths, url, util, processes, axios, git, opengraph, jimp, rss} export {axios, fs, git, jimp, opengraph, os, paths, processes, rss, url, util}
/**Returns module __dirname */ /**Returns module __dirname */
export function __module(module) { export function __module(module) {
@@ -71,9 +71,11 @@
/**Percentage formatter */ /**Percentage formatter */
export function percentage(n, {rescale = true} = {}) { export function percentage(n, {rescale = true} = {}) {
return `${(n*(rescale ? 100 : 1)).toFixed(2) return `${
(n * (rescale ? 100 : 1)).toFixed(2)
.replace(/(?<=[.])(?<decimal>[1-9]*)0+$/, "$<decimal>") .replace(/(?<=[.])(?<decimal>[1-9]*)0+$/, "$<decimal>")
.replace(/[.]$/, "")}%` .replace(/[.]$/, "")
}%`
} }
format.percentage = percentage format.percentage = percentage
@@ -173,13 +175,16 @@
//Markdown mode //Markdown mode
switch (mode) { switch (mode) {
case "inline": { case "inline": {
rendered = htmlsanitize(htmlsanitize(rendered, { rendered = htmlsanitize(
htmlsanitize(rendered, {
allowedTags:["h1", "h2", "h3", "h4", "h5", "h6", "br", "blockquote", "code", "span"], allowedTags:["h1", "h2", "h3", "h4", "h5", "h6", "br", "blockquote", "code", "span"],
allowedAttributes:{code:["class"], span:["class"]}, allowedAttributes:{code:["class"], span:["class"]},
}), { }),
{
allowedAttributes:{code:["class"], span:["class"]}, allowedAttributes:{code:["class"], span:["class"]},
transformTags:{h1:"b", h2:"b", h3:"b", h4:"b", h5:"b", h6:"b", blockquote:"i"}, transformTags:{h1:"b", h2:"b", h3:"b", h4:"b", h5:"b", h6:"b", blockquote:"i"},
}) },
)
break break
} }
default: default:
@@ -257,11 +262,13 @@
page.on("console", ({_text:text}) => console.debug(`metrics/svg/pdf > puppeteer > ${text}`)) page.on("console", ({_text:text}) => console.debug(`metrics/svg/pdf > puppeteer > ${text}`))
await page.setContent(`<main class="markdown-body">${rendered}</main>`, {waitUntil:["load", "domcontentloaded", "networkidle2"]}) await page.setContent(`<main class="markdown-body">${rendered}</main>`, {waitUntil:["load", "domcontentloaded", "networkidle2"]})
console.debug("metrics/svg/pdf > loaded svg successfully") console.debug("metrics/svg/pdf > loaded svg successfully")
await page.addStyleTag({content:` await page.addStyleTag({
content:`
main { margin: ${(Array.isArray(paddings) ? paddings : paddings.split(",")).join(" ")}; } main { margin: ${(Array.isArray(paddings) ? paddings : paddings.split(",")).join(" ")}; }
main svg { height: 1em; width: 1em; } main svg { height: 1em; width: 1em; }
${await fs.readFile(paths.join(__module(import.meta.url), "../../../node_modules", "@primer/css/dist/markdown.css")).catch(_ => "")}${style} ${await fs.readFile(paths.join(__module(import.meta.url), "../../../node_modules", "@primer/css/dist/markdown.css")).catch(_ => "")}${style}
`}) `,
})
rendered = await page.pdf() rendered = await page.pdf()
//Result //Result
await page.close() await page.close()

View File

@@ -11,9 +11,11 @@
get digital() { get digital() {
return `${this.hours}:${this.minutes}` return `${this.hours}:${this.minutes}`
}, },
hours:faker.datatype.number(1000), minutes:faker.datatype.number(1000), hours:faker.datatype.number(1000),
minutes:faker.datatype.number(1000),
name:array ? faker.random.arrayElement(array) : faker.random.words(2).replace(/ /g, "-").toLocaleLowerCase(), name:array ? faker.random.arrayElement(array) : faker.random.words(2).replace(/ /g, "-").toLocaleLowerCase(),
percent:0, total_seconds:faker.datatype.number(1000000), percent:0,
total_seconds:faker.datatype.number(1000000),
})) }))
results = results.filter(({name}) => elements.includes(name) ? false : (elements.push(name), true)) results = results.filter(({name}) => elements.includes(name) ? false : (elements.push(name), true))
let percents = 100 let percents = 100

View File

@@ -118,6 +118,5 @@
}, },
}) })
} }
} }
} }

View File

@@ -1,14 +1,16 @@
/**Mocked data */ /**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) { export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > base/repositories") console.debug("metrics/compute/mocks > mocking graphql api result > base/repositories")
return /after: "MOCKED_CURSOR"/m.test(query) ? ({ return /after: "MOCKED_CURSOR"/m.test(query)
? ({
user:{ user:{
repositories:{ repositories:{
edges:[], edges:[],
nodes:[], nodes:[],
}, },
}, },
}) : ({ })
: ({
user:{ user:{
repositories:{ repositories:{
edges:[ edges:[

View File

@@ -1,14 +1,16 @@
/**Mocked data */ /**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) { export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > gists/default") console.debug("metrics/compute/mocks > mocking graphql api result > gists/default")
return /after: "MOCKED_CURSOR"/m.test(query) ? ({ return /after: "MOCKED_CURSOR"/m.test(query)
? ({
user:{ user:{
gists:{ gists:{
edges:[], edges:[],
nodes:[], nodes:[],
}, },
}, },
}) : ({ })
: ({
user:{ user:{
gists:{ gists:{
edges:[ edges:[

View File

@@ -1,13 +1,15 @@
/**Mocked data */ /**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) { export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > notable/contributions") console.debug("metrics/compute/mocks > mocking graphql api result > notable/contributions")
return /after: "MOCKED_CURSOR"/m.test(query) ? ({ return /after: "MOCKED_CURSOR"/m.test(query)
? ({
user:{ user:{
repositoriesContributedTo:{ repositoriesContributedTo:{
edges:[], edges:[],
}, },
}, },
}) : ({ })
: ({
user:{ user:{
repositoriesContributedTo:{ repositoriesContributedTo:{
edges:[ edges:[

View File

@@ -2,13 +2,15 @@
export default function({faker, query, login = faker.internet.userName()}) { export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > people/default") console.debug("metrics/compute/mocks > mocking graphql api result > people/default")
const type = query.match(/(?<type>followers|following)[(]/)?.groups?.type ?? "(unknown type)" const type = query.match(/(?<type>followers|following)[(]/)?.groups?.type ?? "(unknown type)"
return /after: "MOCKED_CURSOR"/m.test(query) ? ({ return /after: "MOCKED_CURSOR"/m.test(query)
? ({
user:{ user:{
[type]:{ [type]:{
edges:[], edges:[],
}, },
}, },
}) : ({ })
: ({
user:{ user:{
[type]:{ [type]:{
edges:new Array(Math.ceil(20 + 80 * Math.random())).fill(null).map((login = faker.internet.userName()) => ({ edges:new Array(Math.ceil(20 + 80 * Math.random())).fill(null).map((login = faker.internet.userName()) => ({

View File

@@ -2,7 +2,8 @@
export default function({faker, query, login = faker.internet.userName()}) { export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > people/repository") console.debug("metrics/compute/mocks > mocking graphql api result > people/repository")
const type = query.match(/(?<type>stargazers|watchers)[(]/)?.groups?.type ?? "(unknown type)" const type = query.match(/(?<type>stargazers|watchers)[(]/)?.groups?.type ?? "(unknown type)"
return /after: "MOCKED_CURSOR"/m.test(query) ? ({ return /after: "MOCKED_CURSOR"/m.test(query)
? ({
user:{ user:{
repository:{ repository:{
[type]:{ [type]:{
@@ -10,7 +11,8 @@
}, },
}, },
}, },
}) : ({ })
: ({
user:{ user:{
repository:{ repository:{
[type]:{ [type]:{

View File

@@ -2,14 +2,16 @@
export default function({faker, query, login = faker.internet.userName()}) { export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > people/sponsors") console.debug("metrics/compute/mocks > mocking graphql api result > people/sponsors")
const type = query.match(/(?<type>sponsorshipsAsSponsor|sponsorshipsAsMaintainer)[(]/)?.groups?.type ?? "(unknown type)" const type = query.match(/(?<type>sponsorshipsAsSponsor|sponsorshipsAsMaintainer)[(]/)?.groups?.type ?? "(unknown type)"
return /after: "MOCKED_CURSOR"/m.test(query) ? ({ return /after: "MOCKED_CURSOR"/m.test(query)
? ({
user:{ user:{
login, login,
[type]:{ [type]:{
edges:[], edges:[],
}, },
}, },
}) : ({ })
: ({
user:{ user:{
login, login,
[type]:{ [type]:{

View File

@@ -2,14 +2,16 @@
export default function({faker, query, login = faker.internet.userName()}) { export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > reactions/default") console.debug("metrics/compute/mocks > mocking graphql api result > reactions/default")
const type = query.match(/(?<type>issues|issueComments)[(]/)?.groups?.type ?? "(unknown type)" const type = query.match(/(?<type>issues|issueComments)[(]/)?.groups?.type ?? "(unknown type)"
return /after: "MOCKED_CURSOR"/m.test(query) ? ({ return /after: "MOCKED_CURSOR"/m.test(query)
? ({
user:{ user:{
[type]:{ [type]:{
edges:[], edges:[],
nodes:[], nodes:[],
}, },
}, },
}) : ({ })
: ({
user:{ user:{
[type]:{ [type]:{
edges:new Array(100).fill(null).map(_ => ({ edges:new Array(100).fill(null).map(_ => ({

View File

@@ -1,13 +1,15 @@
/**Mocked data */ /**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) { export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > stargazers/default") console.debug("metrics/compute/mocks > mocking graphql api result > stargazers/default")
return /after: "MOCKED_CURSOR"/m.test(query) ? ({ return /after: "MOCKED_CURSOR"/m.test(query)
? ({
repository:{ repository:{
stargazers:{ stargazers:{
edges:[], edges:[],
}, },
}, },
}) : ({ })
: ({
repository:{ repository:{
stargazers:{ stargazers:{
edges:new Array(faker.datatype.number({min:50, max:100})).fill(null).map(() => ({ edges:new Array(faker.datatype.number({min:50, max:100})).fill(null).map(() => ({

View File

@@ -9,7 +9,8 @@
status:"200 OK", status:"200 OK",
"x-oauth-scopes":"repo", "x-oauth-scopes":"repo",
}, },
data:page < 2 ? new Array(per_page).fill(null).map(() => ({ data:page < 2
? new Array(per_page).fill(null).map(() => ({
sha:"MOCKED_SHA", sha:"MOCKED_SHA",
get author() { get author() {
return this.commit.author return this.commit.author
@@ -29,6 +30,7 @@
date:`${faker.date.recent(14)}`, date:`${faker.date.recent(14)}`,
}, },
}, },
})) : [], }))
: [],
}) })
} }

View File

@@ -48,7 +48,7 @@
{ {
sha:"MOCKED_SHA", sha:"MOCKED_SHA",
filename:faker.system.fileName(), filename:faker.system.fileName(),
patch:"@@ -0,0 +1,5 @@\n+//Imports\n+ import app from \"./src/app.mjs\"\n+\n+//Start app\n+ await app()\n\\ No newline at end of file", patch:'@@ -0,0 +1,5 @@\n+//Imports\n+ import app from "./src/app.mjs"\n+\n+//Start app\n+ await app()\n\\ No newline at end of file',
}, },
], ],
}, },

View File

@@ -1,17 +1,16 @@
//Imports //Imports
import fs from "fs/promises"
import axios from "axios" import axios from "axios"
import faker from "faker" import faker from "faker"
import paths from "path" import paths from "path"
import urls from "url"
import rss from "rss-parser" import rss from "rss-parser"
import fs from "fs/promises" import urls from "url"
//Mocked state //Mocked state
let mocked = false let mocked = false
//Mocking //Mocking
export default async function({graphql, rest}) { export default async function({graphql, rest}) {
//Check if already mocked //Check if already mocked
if (mocked) if (mocked)
return {graphql, rest} return {graphql, rest}
@@ -29,6 +28,7 @@
} }
else else
mocks[entry.replace(/[.]mjs$/, "")] = (await import(urls.pathToFileURL(paths.join(directory, entry)).href)).default mocks[entry.replace(/[.]mjs$/, "")] = (await import(urls.pathToFileURL(paths.join(directory, entry)).href)).default
} }
return mocks return mocks
} }
@@ -73,6 +73,7 @@
} }
else else
mocker({path:`${path}.${key}`, mocks:mocks[key], mocked:mocked[key]}) mocker({path:`${path}.${key}`, mocks:mocks[key], mocked:mocked[key]})
} }
} }
mocker({mocks:mocks.github.rest, mocked:rest}) mocker({mocks:mocks.github.rest, mocked:rest})
@@ -147,4 +148,3 @@
//Return mocked elements //Return mocked elements
return {graphql, rest} return {graphql, rest}
} }

View File

@@ -1,18 +1,17 @@
//Imports //Imports
import octokit from "@octokit/graphql" import octokit from "@octokit/graphql"
import OctokitRest from "@octokit/rest" import OctokitRest from "@octokit/rest"
import compression from "compression"
import express from "express" import express from "express"
import ratelimit from "express-rate-limit" import ratelimit from "express-rate-limit"
import compression from "compression"
import cache from "memory-cache" import cache from "memory-cache"
import util from "util" import util from "util"
import metrics from "../metrics/index.mjs"
import setup from "../metrics/setup.mjs" import setup from "../metrics/setup.mjs"
import mocks from "../mocks/index.mjs" import mocks from "../mocks/index.mjs"
import metrics from "../metrics/index.mjs"
/**App */ /**App */
export default async function({mock, nosettings} = {}) { export default async function({mock, nosettings} = {}) {
//Load configuration settings //Load configuration settings
const {conf, Plugins, Templates} = await setup({nosettings}) const {conf, Plugins, Templates} = await setup({nosettings})
const {token, maxusers = 0, restricted = [], debug = false, cached = 30 * 60 * 1000, port = 3000, ratelimiter = null, plugins = null} = conf.settings const {token, maxusers = 0, restricted = [], debug = false, cached = 30 * 60 * 1000, port = 3000, ratelimiter = null, plugins = null} = conf.settings
@@ -80,9 +79,11 @@
//Base routes //Base routes
const limiter = ratelimit({max:debug ? Number.MAX_SAFE_INTEGER : 60, windowMs:60 * 1000, headers:false}) const limiter = ratelimit({max:debug ? Number.MAX_SAFE_INTEGER : 60, windowMs:60 * 1000, headers:false})
const metadata = Object.fromEntries(Object.entries(conf.metadata.plugins) const metadata = Object.fromEntries(
Object.entries(conf.metadata.plugins)
.map(([key, value]) => [key, Object.fromEntries(Object.entries(value).filter(([key]) => ["name", "icon", "categorie", "web", "supports"].includes(key)))]) .map(([key, value]) => [key, Object.fromEntries(Object.entries(value).filter(([key]) => ["name", "icon", "categorie", "web", "supports"].includes(key)))])
.map(([key, value]) => [key, key === "core" ? {...value, web:Object.fromEntries(Object.entries(value.web).filter(([key]) => /^config[.]/.test(key)).map(([key, value]) => [key.replace(/^config[.]/, ""), value]))} : value])) .map(([key, value]) => [key, key === "core" ? {...value, web:Object.fromEntries(Object.entries(value.web).filter(([key]) => /^config[.]/.test(key)).map(([key, value]) => [key.replace(/^config[.]/, ""), value]))} : value]),
)
const enabled = Object.entries(metadata).filter(([_name, {categorie}]) => categorie !== "core").map(([name]) => ({name, enabled:plugins[name]?.enabled ?? false})) const enabled = Object.entries(metadata).filter(([_name, {categorie}]) => categorie !== "core").map(([name]) => ({name, enabled:plugins[name]?.enabled ?? false}))
const templates = Object.entries(Templates).map(([name]) => ({name, enabled:(conf.settings.templates.enabled.length ? conf.settings.templates.enabled.includes(name) : true) ?? false})) const templates = Object.entries(Templates).map(([name]) => ({name, enabled:(conf.settings.templates.enabled.length ? conf.settings.templates.enabled.includes(name) : true) ?? false}))
const actions = {flush:new Map()} const actions = {flush:new Map()}
@@ -172,16 +173,26 @@
} }
//Compute metrics //Compute metrics
console.debug(`metrics/app/${login}/insights > compute insights`) console.debug(`metrics/app/${login}/insights > compute insights`)
const json = await metrics({ const json = await metrics(
login, q:{ {
login,
q:{
template:"classic", template:"classic",
achievements:true, "achievements.threshold":"X", achievements:true,
isocalendar:true, "isocalendar.duration":"full-year", "achievements.threshold":"X",
languages:true, "languages.limit":0, isocalendar:true,
activity:true, "activity.limit":100, "activity.days":0, "isocalendar.duration":"full-year",
languages:true,
"languages.limit":0,
activity:true,
"activity.limit":100,
"activity.days":0,
notable:true, notable:true,
}, },
}, {graphql, rest, plugins:{achievements:{enabled:true}, isocalendar:{enabled:true}, languages:{enabled:true}, activity:{enabled:true, markdown:"extended"}, notable:{enabled:true}}, conf, convert:"json"}, {Plugins, Templates}) },
{graphql, rest, plugins:{achievements:{enabled:true}, isocalendar:{enabled:true}, languages:{enabled:true}, activity:{enabled:true, markdown:"extended"}, notable:{enabled:true}}, conf, convert:"json"},
{Plugins, Templates},
)
//Cache //Cache
if ((!debug) && (cached)) { if ((!debug) && (cached)) {
const maxage = Math.round(Number(req.query.cache)) const maxage = Math.round(Number(req.query.cache))
@@ -232,6 +243,8 @@
} }
else else
pending.set(login, new Promise(_solve => solve = _solve)) pending.set(login, new Promise(_solve => solve = _solve))
//Read cached data if possible //Read cached data if possible
if ((!debug) && (cached) && (cache.get(login))) { if ((!debug) && (cached) && (cache.get(login))) {
console.debug(`metrics/app/${login} > using cached image`) console.debug(`metrics/app/${login} > using cached image`)
@@ -258,7 +271,10 @@
const q = req.query const q = req.query
console.debug(`metrics/app/${login} > ${util.inspect(q, {depth:Infinity, maxStringLength:256})}`) console.debug(`metrics/app/${login} > ${util.inspect(q, {depth:Infinity, maxStringLength:256})}`)
const {rendered, mime} = await metrics({login, q}, { const {rendered, mime} = await metrics({login, q}, {
graphql, rest, plugins, conf, graphql,
rest,
plugins,
conf,
die:q["plugins.errors.fatal"] ?? false, die:q["plugins.errors.fatal"] ?? false,
verify:q.verify ?? false, verify:q.verify ?? false,
convert:["svg", "jpeg", "png", "json", "markdown", "markdown-pdf"].includes(q["config.output"]) ? q["config.output"] : null, convert:["svg", "jpeg", "png", "json", "markdown", "markdown-pdf"].includes(q["config.output"]) ? q["config.output"] : null,
@@ -299,8 +315,9 @@
console.error(error) console.error(error)
return res.status(500).send("Internal Server Error: failed to process metrics correctly") return res.status(500).send("Internal Server Error: failed to process metrics correctly")
} }
//After rendering
finally { finally {
//After rendering
solve?.() solve?.()
} }
}) })

View File

@@ -7,15 +7,17 @@
//Palette //Palette
try { try {
this.palette = (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") this.palette = (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
} catch (error) {} }
catch (error) {}
//User //User
const user = location.pathname.split("/").pop() const user = location.pathname.split("/").pop()
if ((user) && (user !== "about")) { if ((user) && (user !== "about")) {
this.user = user this.user = user
await this.search() await this.search()
} }
else else {
this.searchable = true this.searchable = true
}
//Embed //Embed
this.embed = !!(new URLSearchParams(location.search).get("embed")) this.embed = !!(new URLSearchParams(location.search).get("embed"))
//Init //Init
@@ -44,8 +46,8 @@
handler(current, previous) { handler(current, previous) {
document.querySelector("body").classList.remove(previous) document.querySelector("body").classList.remove(previous)
document.querySelector("body").classList.add(current) document.querySelector("body").classList.add(current)
} },
} },
}, },
//Methods //Methods
methods: { methods: {
@@ -59,16 +61,16 @@
const baseUrl = String.raw`https?:\/\/(?:www\.)?github.com\/([\w.-]+\/[\w.-]+)\/` const baseUrl = String.raw`https?:\/\/(?:www\.)?github.com\/([\w.-]+\/[\w.-]+)\/`
return value return value
.replace( .replace(
RegExp(baseUrl + String.raw`(?:issues|pull|discussions)\/(\d+)(?:\?\S+)?(#\S+)?`, 'g'), RegExp(baseUrl + String.raw`(?:issues|pull|discussions)\/(\d+)(?:\?\S+)?(#\S+)?`, "g"),
(_, repo, id, comment) => (options?.repo === repo ? '' : repo) + `#${id}` + (comment ? ` (comment)` : '') (_, repo, id, comment) => (options?.repo === repo ? "" : repo) + `#${id}` + (comment ? ` (comment)` : ""),
) // -> 'lowlighter/metrics#123' ) // -> 'lowlighter/metrics#123'
.replace( .replace(
RegExp(baseUrl + String.raw`commit\/([\da-f]+)`, 'g'), RegExp(baseUrl + String.raw`commit\/([\da-f]+)`, "g"),
(_, repo, sha) => (options?.repo === repo ? '' : repo + '@') + sha (_, repo, sha) => (options?.repo === repo ? "" : repo + "@") + sha,
) // -> 'lowlighter/metrics@123abc' ) // -> 'lowlighter/metrics@123abc'
.replace( .replace(
RegExp(baseUrl + String.raw`compare\/(\S+...\S+)`, 'g'), RegExp(baseUrl + String.raw`compare\/(\S+...\S+)`, "g"),
(_, repo, tags) => (options?.repo === repo ? '' : repo + '@') + tags (_, repo, tags) => (options?.repo === repo ? "" : repo + "@") + tags,
) // -> 'lowlighter/metrics@1.0...1.1' ) // -> 'lowlighter/metrics@1.0...1.1'
} }
return value return value
@@ -86,7 +88,7 @@
finally { finally {
this.pending = false this.pending = false
} }
} },
}, },
//Computed properties //Computed properties
computed: { computed: {
@@ -124,7 +126,7 @@
}, },
preview() { preview() {
return /-preview$/.test(this.version) return /-preview$/.test(this.version)
} },
}, },
//Data initialization //Data initialization
data: { data: {
@@ -138,6 +140,6 @@
metrics: null, metrics: null,
pending: false, pending: false,
error: null, error: null,
} },
}) })
})() })()

View File

@@ -12,7 +12,8 @@
try { try {
this.config.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone this.config.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone
this.palette = (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light") this.palette = (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
} catch (error) {} }
catch (error) {}
//Init //Init
await Promise.all([ await Promise.all([
//GitHub limit tracker //GitHub limit tracker
@@ -67,8 +68,8 @@
handler(current, previous) { handler(current, previous) {
document.querySelector("body").classList.remove(previous) document.querySelector("body").classList.remove(previous)
document.querySelector("body").classList.add(current) document.querySelector("body").classList.add(current)
} },
} },
}, },
//Data initialization //Data initialization
data: { data: {
@@ -93,14 +94,16 @@
"base.community": "Community stats", "base.community": "Community stats",
"base.repositories": "Repositories metrics", "base.repositories": "Repositories metrics",
"base.metadata": "Metadata", "base.metadata": "Metadata",
...Object.fromEntries(Object.entries(metadata).map(([key, {name}]) => [key, name])) ...Object.fromEntries(Object.entries(metadata).map(([key, { name }]) => [key, name])),
}, },
options: { options: {
descriptions: { ...(Object.assign({}, ...Object.entries(metadata).flatMap(([key, { web }]) => web))) }, descriptions: { ...(Object.assign({}, ...Object.entries(metadata).flatMap(([key, { web }]) => web))) },
...(Object.fromEntries(Object.entries( ...(Object.fromEntries(
Object.assign({}, ...Object.entries(metadata).flatMap(([key, {web}]) => web))) Object.entries(
.map(([key, {defaulted}]) => [key, defaulted]) Object.assign({}, ...Object.entries(metadata).flatMap(([key, { web }]) => web)),
)) )
.map(([key, { defaulted }]) => [key, defaulted]),
)),
}, },
}, },
templates: { templates: {
@@ -108,7 +111,7 @@
selected: "classic", selected: "classic",
placeholder: { placeholder: {
timeout: null, timeout: null,
image:"" image: "",
}, },
descriptions: { descriptions: {
classic: "Classic template", classic: "Classic template",
@@ -188,9 +191,13 @@
` template: ${this.templates.selected}`, ` template: ${this.templates.selected}`,
` base: ${Object.entries(this.plugins.enabled.base).filter(([key, value]) => value).map(([key]) => key).join(", ") || '""'}`, ` base: ${Object.entries(this.plugins.enabled.base).filter(([key, value]) => value).map(([key]) => key).join(", ") || '""'}`,
...[ ...[
...Object.entries(this.plugins.options).filter(([key, value]) => (key in metadata.base.web)&&(value !== metadata.base.web[key]?.defaulted)).map(([key, value]) => ` ${key.replace(/[.]/, "_")}: ${typeof value === "boolean" ? {true:"yes", false:"no"}[value] : value}`), ...Object.entries(this.plugins.options).filter(([key, value]) => (key in metadata.base.web) && (value !== metadata.base.web[key]?.defaulted)).map(([key, value]) =>
` ${key.replace(/[.]/, "_")}: ${typeof value === "boolean" ? { true: "yes", false: "no" }[value] : value}`
),
...Object.entries(this.plugins.enabled).filter(([key, value]) => (key !== "base") && (value)).map(([key]) => ` plugin_${key}: yes`), ...Object.entries(this.plugins.enabled).filter(([key, value]) => (key !== "base") && (value)).map(([key]) => ` plugin_${key}: yes`),
...Object.entries(this.plugins.options).filter(([key, value]) => value).filter(([key, value]) => this.plugins.enabled[key.split(".")[0]]).map(([key, value]) => ` plugin_${key.replace(/[.]/, "_")}: ${typeof value === "boolean" ? {true:"yes", false:"no"}[value] : value}`), ...Object.entries(this.plugins.options).filter(([key, value]) => value).filter(([key, value]) => this.plugins.enabled[key.split(".")[0]]).map(([key, value]) =>
` plugin_${key.replace(/[.]/, "_")}: ${typeof value === "boolean" ? { true: "yes", false: "no" }[value] : value}`
),
...Object.entries(this.config).filter(([key, value]) => (value) && (value !== metadata.core.web[key]?.defaulted)).map(([key, value]) => ` config_${key.replace(/[.]/, "_")}: ${typeof value === "boolean" ? { true: "yes", false: "no" }[value] : value}`), ...Object.entries(this.config).filter(([key, value]) => (value) && (value !== metadata.core.web[key]?.defaulted)).map(([key, value]) => ` config_${key.replace(/[.]/, "_")}: ${typeof value === "boolean" ? { true: "yes", false: "no" }[value] : value}`),
].sort(), ].sort(),
].join("\n") ].join("\n")
@@ -211,7 +218,7 @@
//Is in preview mode //Is in preview mode
preview() { preview() {
return /-preview$/.test(this.version) return /-preview$/.test(this.version)
} },
}, },
//Methods //Methods
methods: { methods: {
@@ -244,7 +251,8 @@
await axios.get(`/.uncache?&token=${(await axios.get(`/.uncache?user=${this.user}`)).data.token}`) await axios.get(`/.uncache?&token=${(await axios.get(`/.uncache?user=${this.user}`)).data.token}`)
this.generated.content = (await axios.get(this.url)).data this.generated.content = (await axios.get(this.url)).data
this.generated.error = null this.generated.error = null
} catch (error) { }
catch (error) {
this.generated.error = { code: error.response.status, message: error.response.data } this.generated.error = { code: error.response.status, message: error.response.data }
} }
finally { finally {

View File

@@ -1,4 +1,4 @@
(function ({axios, faker, ejs} = {axios:globalThis.axios, faker:globalThis.faker, ejs:globalThis.ejs}) { ;(function({ axios, faker, ejs } = { axios: globalThis.axios, faker: globalThis.faker, ejs: globalThis.ejs }) {
//Load assets //Load assets
const cached = new Map() const cached = new Map()
async function load(url) { async function load(url) {
@@ -29,7 +29,9 @@
const options = set.plugins.options const options = set.plugins.options
const data = { const data = {
//Template elements //Template elements
style, fonts, errors:[], style,
fonts,
errors: [],
partials: new Set([...(set.config.order || "").split(",").map(x => x.trim()).filter(x => partials.includes(x)), ...partials]), partials: new Set([...(set.config.order || "").split(",").map(x => x.trim()).filter(x => partials.includes(x)), ...partials]),
//Plural helper //Plural helper
s(value, end = "") { s(value, end = "") {
@@ -37,9 +39,10 @@
}, },
//Formatter helper //Formatter helper
f(n, { sign = false } = {}) { f(n, { sign = false } = {}) {
for (const {u, v} of [{u:"b", v:10**9}, {u:"m", v:10**6}, {u:"k", v:10**3}]) for (const { u, v } of [{ u: "b", v: 10 ** 9 }, { u: "m", v: 10 ** 6 }, { u: "k", v: 10 ** 3 }]) {
if (n / v >= 1) if (n / v >= 1)
return `${(sign) && (n > 0) ? "+" : ""}${(n / v).toFixed(2).substr(0, 4).replace(/[.]0*$/, "")}${u}` return `${(sign) && (n > 0) ? "+" : ""}${(n / v).toFixed(2).substr(0, 4).replace(/[.]0*$/, "")}${u}`
}
return `${(sign) && (n > 0) ? "+" : ""}${n}` return `${(sign) && (n > 0) ? "+" : ""}${n}`
}, },
//Trap for includes //Trap for includes
@@ -76,7 +79,7 @@
registration: `${faker.datatype.number({ min: 2, max: 10 })} years ago`, registration: `${faker.datatype.number({ min: 2, max: 10 })} years ago`,
cakeday: false, cakeday: false,
calendar: new Array(14).fill(null).map(_ => ({ color: faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"]) })), calendar: new Array(14).fill(null).map(_ => ({ color: faker.random.arrayElement(["#ebedf0", "#9be9a8", "#40c463", "#30a14e", "#216e39"]) })),
avatar:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
}, },
//User data //User data
account: "user", account: "user",
@@ -108,12 +111,13 @@
followers: { totalCount: faker.datatype.number(1000) }, followers: { totalCount: faker.datatype.number(1000) },
following: { totalCount: faker.datatype.number(1000) }, following: { totalCount: faker.datatype.number(1000) },
issueComments: { totalCount: faker.datatype.number(1000) }, issueComments: { totalCount: faker.datatype.number(1000) },
organizations:{totalCount:faker.datatype.number(10)} organizations: { totalCount: faker.datatype.number(10) },
}, },
//Plugins //Plugins
plugins: { plugins: {
//Tweets //Tweets
...(set.plugins.enabled.tweets ? ({ ...(set.plugins.enabled.tweets
? ({
tweets: { tweets: {
username: options["tweets.user"] || "(attached Twitter account)", username: options["tweets.user"] || "(attached Twitter account)",
profile: { profile: {
@@ -129,90 +133,179 @@
id: faker.datatype.number(100000000000000).toString(), id: faker.datatype.number(100000000000000).toString(),
created_at: faker.date.recent(), created_at: faker.date.recent(),
entities: { entities: {
mentions: [ {start:22, end:33, username:"lowlighter"} ] mentions: [{ start: 22, end: 33, username: "lowlighter" }],
}, },
text: 'Checkout metrics from <span class="mention">@lowlighter</span> ! <span class="hashtag">#GitHub</span> ', text: 'Checkout metrics from <span class="mention">@lowlighter</span> ! <span class="hashtag">#GitHub</span> ',
mentions: ["lowlighter"] mentions: ["lowlighter"],
}, },
...new Array(Number(options["tweets.limit"]) - 1).fill(null).map(_ => ({ ...new Array(Number(options["tweets.limit"]) - 1).fill(null).map(_ => ({
id: faker.datatype.number(100000000000000).toString(), id: faker.datatype.number(100000000000000).toString(),
created_at: faker.date.recent(), created_at: faker.date.recent(),
text: faker.lorem.paragraph(), text: faker.lorem.paragraph(),
mentions:[] mentions: [],
})), })),
] ],
} },
}) : null), })
: null),
//Lines //Lines
...(set.plugins.enabled.lines ? ({ ...(set.plugins.enabled.lines
? ({
lines: { lines: {
added: `${faker.datatype.number(100)}.${faker.datatype.number(9)}k`, added: `${faker.datatype.number(100)}.${faker.datatype.number(9)}k`,
deleted: `${faker.datatype.number(100)}.${faker.datatype.number(9)}k`, deleted: `${faker.datatype.number(100)}.${faker.datatype.number(9)}k`,
} },
}) : null), })
: null),
//Traffic //Traffic
...(set.plugins.enabled.traffic ? ({ ...(set.plugins.enabled.traffic
? ({
traffic: { traffic: {
views: { views: {
count: `${faker.datatype.number({ min: 10, max: 100 })}.${faker.datatype.number(9)}k`, count: `${faker.datatype.number({ min: 10, max: 100 })}.${faker.datatype.number(9)}k`,
uniques: `${faker.datatype.number(10)}.${faker.datatype.number(9)}k`, uniques: `${faker.datatype.number(10)}.${faker.datatype.number(9)}k`,
} },
} },
}) : null), })
: null),
//Follow-up //Follow-up
...(set.plugins.enabled.followup ? ({ ...(set.plugins.enabled.followup
? ({
followup: { followup: {
sections: options["followup.sections"].split(",").map(x => x.trim()).filter(x => ["user", "repositories"].includes(x)), sections: options["followup.sections"].split(",").map(x => x.trim()).filter(x => ["user", "repositories"].includes(x)),
issues:{get count() { return this.open + this.closed }, open:faker.datatype.number(1000), closed:faker.datatype.number(1000)}, issues: {
pr:{get count() { return this.open + this.merged }, open:faker.datatype.number(1000), closed:faker.datatype.number(1000), merged:faker.datatype.number(1000)}, get count() {
return this.open + this.closed
},
open: faker.datatype.number(1000),
closed: faker.datatype.number(1000),
},
pr: {
get count() {
return this.open + this.merged
},
open: faker.datatype.number(1000),
closed: faker.datatype.number(1000),
merged: faker.datatype.number(1000),
},
user: { user: {
issues:{get count() { return this.open + this.closed }, open:faker.datatype.number(1000), closed:faker.datatype.number(1000)}, issues: {
pr:{get count() { return this.open + this.merged }, open:faker.datatype.number(1000), closed:faker.datatype.number(1000), merged:faker.datatype.number(1000)}, get count() {
} return this.open + this.closed
} },
}) : null), open: faker.datatype.number(1000),
closed: faker.datatype.number(1000),
},
pr: {
get count() {
return this.open + this.merged
},
open: faker.datatype.number(1000),
closed: faker.datatype.number(1000),
merged: faker.datatype.number(1000),
},
},
},
})
: null),
//Notable //Notable
...(set.plugins.enabled.notable ? ({ ...(set.plugins.enabled.notable
? ({
notable: { notable: {
contributions: new Array(2 + faker.datatype.number(2)).fill(null).map(_ => ({ name: faker.lorem.slug(), avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" })), contributions: new Array(2 + faker.datatype.number(2)).fill(null).map(_ => ({ name: faker.lorem.slug(), avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" })),
} },
}) : null), })
: null),
//Gists //Gists
...(set.plugins.enabled.gists ? ({ ...(set.plugins.enabled.gists
? ({
gists: { gists: {
totalCount: faker.datatype.number(100), totalCount: faker.datatype.number(100),
stargazers: faker.datatype.number(1000), stargazers: faker.datatype.number(1000),
forks: faker.datatype.number(100), forks: faker.datatype.number(100),
files: faker.datatype.number(100), files: faker.datatype.number(100),
comments:faker.datatype.number(1000) comments: faker.datatype.number(1000),
} },
}) : null), })
: null),
//Reactions //Reactions
...(set.plugins.enabled.reactions ? ({ ...(set.plugins.enabled.reactions
? ({
reactions: { reactions: {
list: { list: {
HEART:{value:faker.datatype.number(100), get percentage() { return this.score }, score:faker.datatype.number(100)/100}, HEART: {
THUMBS_UP:{value:faker.datatype.number(100), get percentage() { return this.score }, score:faker.datatype.number(100)/100}, value: faker.datatype.number(100),
THUMBS_DOWN:{value:faker.datatype.number(100), get percentage() { return this.score }, score:faker.datatype.number(100)/100}, get percentage() {
LAUGH:{value:faker.datatype.number(100), get percentage() { return this.score }, score:faker.datatype.number(100)/100}, return this.score
CONFUSED:{value:faker.datatype.number(100), get percentage() { return this.score }, score:faker.datatype.number(100)/100}, },
EYES:{value:faker.datatype.number(100), get percentage() { return this.score }, score:faker.datatype.number(100)/100}, score: faker.datatype.number(100) / 100,
ROCKET:{value:faker.datatype.number(100), get percentage() { return this.score }, score:faker.datatype.number(100)/100}, },
HOORAY:{value:faker.datatype.number(100), get percentage() { return this.score }, score:faker.datatype.number(100)/100}, THUMBS_UP: {
value: faker.datatype.number(100),
get percentage() {
return this.score
},
score: faker.datatype.number(100) / 100,
},
THUMBS_DOWN: {
value: faker.datatype.number(100),
get percentage() {
return this.score
},
score: faker.datatype.number(100) / 100,
},
LAUGH: {
value: faker.datatype.number(100),
get percentage() {
return this.score
},
score: faker.datatype.number(100) / 100,
},
CONFUSED: {
value: faker.datatype.number(100),
get percentage() {
return this.score
},
score: faker.datatype.number(100) / 100,
},
EYES: {
value: faker.datatype.number(100),
get percentage() {
return this.score
},
score: faker.datatype.number(100) / 100,
},
ROCKET: {
value: faker.datatype.number(100),
get percentage() {
return this.score
},
score: faker.datatype.number(100) / 100,
},
HOORAY: {
value: faker.datatype.number(100),
get percentage() {
return this.score
},
score: faker.datatype.number(100) / 100,
},
}, },
comments: options["reactions.limit"], comments: options["reactions.limit"],
details: options["reactions.details"], details: options["reactions.details"],
days:options["reactions.days"] days: options["reactions.days"],
} },
}) : null), })
: null),
//Achievements //Achievements
...(set.plugins.enabled.achievements ? ({ ...(set.plugins.enabled.achievements
? ({
achievements: { achievements: {
list: new Array(8).fill(null).map(_ => ({ list: new Array(8).fill(null).map(_ => ({
title: faker.lorem.word(), title: faker.lorem.word(),
unlock: null, unlock: null,
text: faker.lorem.sentence(), text: faker.lorem.sentence(),
icon:`<g xmlns="http://www.w3.org/2000/svg" stroke-linecap="round" stroke-width="2" fill="none" fill-rule="evenodd"><g stroke-linejoin="round"><g stroke="#79B8FF"><path d="M8 43a3 3 0 100 6 3 3 0 000-6zm40 0a3.001 3.001 0 10.002 6.002A3.001 3.001 0 0048 43zm-18 3h-4.971m-11.045 0H11M45 46h-4"/></g><path stroke="#2088FF" d="M13 51h28M36.992 45.276l6.375-8.017c1.488.63 3.272.29 4.414-.977a3.883 3.883 0 00.658-4.193l-1.96 2.174-1.936-.151-.406-1.955 1.96-2.173a3.898 3.898 0 00-4.107 1.092 3.886 3.886 0 00-.512 4.485l-7.317 7.169c-1.32 1.314-.807 2.59-.236 3.105.67.601 1.888.845 3.067-.56z"/><g stroke="#2088FF"><path d="M12.652 31.063l9.442 12.578a.512.512 0 01-.087.716l-2.396 1.805a.512.512 0 01-.712-.114L9.46 33.47l-.176-3.557 3.37 1.15zM17.099 43.115l2.395-1.806"/></g></g><path d="M25.68 36.927v-2.54a2.227 2.227 0 01.37-1.265c-.526-.04-3.84-.371-3.84-4.302 0-1.013.305-1.839.915-2.477a4.989 4.989 0 01-.146-1.86c.087-.882.946-.823 2.577.178 1.277-.47 2.852-.47 4.725 0 .248-.303 2.434-1.704 2.658-.268.047.296.016.946-.093 1.95.516.524.776 1.358.78 2.501.007 2.261-1.26 3.687-3.8 4.278.24.436.355.857.346 1.264a117.57 117.57 0 000 2.614c2.43-.744 4.228-2.06 5.395-3.95.837-1.356 1.433-2.932 1.433-4.865 0-2.886-1.175-4.984-2.5-6.388C32.714 19.903 30.266 19 28 19a9.094 9.094 0 00-6.588 2.897C20.028 23.393 19 25.507 19 28.185c0 2.026.701 3.945 1.773 5.38 1.228 1.643 2.864 2.764 4.907 3.362zM52.98 25.002l-3.07 3.065-1.49-1.485M6.98 25.002l-3.07 3.065-1.49-1.485" stroke="#2088FF" stroke-linejoin="round"/><path d="M19.001 11V9a2 2 0 012-2h14a2 2 0 012 2v2m-21 12.028v-10.03a2 2 0 012-1.998h20a2 2 0 012 2v10.028" stroke="#79B8FF" stroke-linejoin="round"/><path stroke="#79B8FF" d="M28.001 7V3M15.039 7.797c-5.297 3.406-9.168 8.837-10.517 15.2m46.737-.936c-1.514-5.949-5.25-11.01-10.273-14.248"/></g>`, icon:
`<g xmlns="http://www.w3.org/2000/svg" stroke-linecap="round" stroke-width="2" fill="none" fill-rule="evenodd"><g stroke-linejoin="round"><g stroke="#79B8FF"><path d="M8 43a3 3 0 100 6 3 3 0 000-6zm40 0a3.001 3.001 0 10.002 6.002A3.001 3.001 0 0048 43zm-18 3h-4.971m-11.045 0H11M45 46h-4"/></g><path stroke="#2088FF" d="M13 51h28M36.992 45.276l6.375-8.017c1.488.63 3.272.29 4.414-.977a3.883 3.883 0 00.658-4.193l-1.96 2.174-1.936-.151-.406-1.955 1.96-2.173a3.898 3.898 0 00-4.107 1.092 3.886 3.886 0 00-.512 4.485l-7.317 7.169c-1.32 1.314-.807 2.59-.236 3.105.67.601 1.888.845 3.067-.56z"/><g stroke="#2088FF"><path d="M12.652 31.063l9.442 12.578a.512.512 0 01-.087.716l-2.396 1.805a.512.512 0 01-.712-.114L9.46 33.47l-.176-3.557 3.37 1.15zM17.099 43.115l2.395-1.806"/></g></g><path d="M25.68 36.927v-2.54a2.227 2.227 0 01.37-1.265c-.526-.04-3.84-.371-3.84-4.302 0-1.013.305-1.839.915-2.477a4.989 4.989 0 01-.146-1.86c.087-.882.946-.823 2.577.178 1.277-.47 2.852-.47 4.725 0 .248-.303 2.434-1.704 2.658-.268.047.296.016.946-.093 1.95.516.524.776 1.358.78 2.501.007 2.261-1.26 3.687-3.8 4.278.24.436.355.857.346 1.264a117.57 117.57 0 000 2.614c2.43-.744 4.228-2.06 5.395-3.95.837-1.356 1.433-2.932 1.433-4.865 0-2.886-1.175-4.984-2.5-6.388C32.714 19.903 30.266 19 28 19a9.094 9.094 0 00-6.588 2.897C20.028 23.393 19 25.507 19 28.185c0 2.026.701 3.945 1.773 5.38 1.228 1.643 2.864 2.764 4.907 3.362zM52.98 25.002l-3.07 3.065-1.49-1.485M6.98 25.002l-3.07 3.065-1.49-1.485" stroke="#2088FF" stroke-linejoin="round"/><path d="M19.001 11V9a2 2 0 012-2h14a2 2 0 012 2v2m-21 12.028v-10.03a2 2 0 012-1.998h20a2 2 0 012 2v10.028" stroke="#79B8FF" stroke-linejoin="round"/><path stroke="#79B8FF" d="M28.001 7V3M15.039 7.797c-5.297 3.406-9.168 8.837-10.517 15.2m46.737-.936c-1.514-5.949-5.25-11.01-10.273-14.248"/></g>`,
rank: faker.random.arrayElement(["A", "B", "C", "X", "$"]), rank: faker.random.arrayElement(["A", "B", "C", "X", "$"]),
progress: faker.datatype.number(100) / 100, progress: faker.datatype.number(100) / 100,
value: faker.datatype.number(1000), value: faker.datatype.number(1000),
@@ -220,61 +313,78 @@
.filter(({ rank }) => options["achievements.secrets"] ? true : rank !== "$") .filter(({ rank }) => options["achievements.secrets"] ? true : rank !== "$")
.filter(({ rank }) => ({ S: 5, A: 4, B: 3, C: 2, $: 1, X: 0 }[rank] >= { S: 5, A: 4, B: 3, C: 2, $: 1, X: 0 }[options["achievements.threshold"]])) .filter(({ rank }) => ({ S: 5, A: 4, B: 3, C: 2, $: 1, X: 0 }[rank] >= { S: 5, A: 4, B: 3, C: 2, $: 1, X: 0 }[options["achievements.threshold"]]))
.sort((a, b) => ({ S: 5, A: 4, B: 3, C: 2, $: 1, X: 0 }[b.rank] + b.progress * 0.99) - ({ S: 5, A: 4, B: 3, C: 2, $: 1, X: 0 }[a.rank] + a.progress * 0.99)) .sort((a, b) => ({ S: 5, A: 4, B: 3, C: 2, $: 1, X: 0 }[b.rank] + b.progress * 0.99) - ({ S: 5, A: 4, B: 3, C: 2, $: 1, X: 0 }[a.rank] + a.progress * 0.99))
.slice(0, options["achievements.limit"] || Infinity) .slice(0, options["achievements.limit"] || Infinity),
, },
} })
}) : null), : null),
//Introduction //Introduction
...(set.plugins.enabled.introduction ? ({ ...(set.plugins.enabled.introduction
? ({
introduction: { introduction: {
mode: "user", mode: "user",
title: options["introduction.title"], title: options["introduction.title"],
text: faker.lorem.sentences(), text: faker.lorem.sentences(),
} },
}) : null), })
: null),
//Languages //Languages
...(set.plugins.enabled.languages ? ({ ...(set.plugins.enabled.languages
? ({
languages: { languages: {
details: options["languages.details"].split(",").map(x => x.trim()).filter(x => x), details: options["languages.details"].split(",").map(x => x.trim()).filter(x => x),
get colors() { return Object.fromEntries(Object.entries(this.favorites).map(([key, {color}]) => [key, color])) }, get colors() {
return Object.fromEntries(Object.entries(this.favorites).map(([key, { color }]) => [key, color]))
},
total: faker.datatype.number(10000), total: faker.datatype.number(10000),
get stats() { return Object.fromEntries(Object.entries(this.favorites).map(([key, {value}]) => [key, value])) }, get stats() {
favorites:distribution(7).map((value, index, array) => ({name:faker.lorem.word(), color:faker.internet.color(), value, size:faker.datatype.number(1000000), x:array.slice(0, index).reduce((a, b) => a + b, 0)})) return Object.fromEntries(Object.entries(this.favorites).map(([key, { value }]) => [key, value]))
} },
}) : null), favorites: distribution(7).map((value, index, array) => ({ name: faker.lorem.word(), color: faker.internet.color(), value, size: faker.datatype.number(1000000), x: array.slice(0, index).reduce((a, b) => a + b, 0) })),
},
})
: null),
//RSS //RSS
...(set.plugins.enabled.rss ? ({ ...(set.plugins.enabled.rss
? ({
rss: { rss: {
source: faker.lorem.words(), source: faker.lorem.words(),
description: faker.lorem.paragraph(), description: faker.lorem.paragraph(),
link: options["rss.source"], link: options["rss.source"],
feed: new Array(Number(options["rss.limit"])).fill(null).map(_ => ({ feed: new Array(Number(options["rss.limit"])).fill(null).map(_ => ({
title: faker.lorem.sentence(), title: faker.lorem.sentence(),
date:faker.date.recent() date: faker.date.recent(),
})), })),
} },
}) : null), })
: null),
//Stock price //Stock price
...(set.plugins.enabled.stock ? ({ ...(set.plugins.enabled.stock
? ({
stock: { stock: {
chart: "(stock chart is not displayed in placeholder)", chart: "(stock chart is not displayed in placeholder)",
currency: "USD", currency: "USD",
price: faker.datatype.number(10000) / 100, price: faker.datatype.number(10000) / 100,
previous: faker.datatype.number(10000) / 100, previous: faker.datatype.number(10000) / 100,
get delta() { return this.price-this.previous }, get delta() {
return this.price - this.previous
},
symbol: options["stock.symbol"], symbol: options["stock.symbol"],
company: faker.company.companyName(), company: faker.company.companyName(),
interval: options["stock.interval"], interval: options["stock.interval"],
duration: options["stock.duration"], duration: options["stock.duration"],
} },
}) : null), })
: null),
//Habits //Habits
...(set.plugins.enabled.habits ? ({ ...(set.plugins.enabled.habits
? ({
habits: { habits: {
facts: options["habits.facts"], facts: options["habits.facts"],
charts: options["habits.charts"], charts: options["habits.charts"],
commits: { commits: {
get hour() { return Object.keys(this.hours).filter(key => /^\d+$/.test(key)).map(key => [key, this.hours[key]]).sort((a, b) => b[1] - a[1]).shift()?.[0] }, get hour() {
return Object.keys(this.hours).filter(key => /^\d+$/.test(key)).map(key => [key, this.hours[key]]).sort((a, b) => b[1] - a[1]).shift()?.[0]
},
hours: { hours: {
[faker.datatype.number(24)]: faker.datatype.number(10), [faker.datatype.number(24)]: faker.datatype.number(10),
[faker.datatype.number(24)]: faker.datatype.number(10), [faker.datatype.number(24)]: faker.datatype.number(10),
@@ -283,9 +393,13 @@
[faker.datatype.number(24)]: faker.datatype.number(10), [faker.datatype.number(24)]: faker.datatype.number(10),
[faker.datatype.number(24)]: faker.datatype.number(10), [faker.datatype.number(24)]: faker.datatype.number(10),
[faker.datatype.number(24)]: faker.datatype.number(10), [faker.datatype.number(24)]: faker.datatype.number(10),
get max() { return Object.keys(this).filter(key => /^\d+$/.test(key)).map(key => [key, this[key]]).sort((a, b) => b[1] - a[1]).shift()?.[1] } get max() {
return Object.keys(this).filter(key => /^\d+$/.test(key)).map(key => [key, this[key]]).sort((a, b) => b[1] - a[1]).shift()?.[1]
},
},
get day() {
return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][Object.keys(this.days).filter(key => /^\d+$/.test(key)).map(key => [key, this.days[key]]).sort((a, b) => b[1] - a[1]).shift()?.[0]]
}, },
get day() { return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][Object.keys(this.days).filter(key => /^\d+$/.test(key)).map(key => [key, this.days[key]]).sort((a, b) => b[1] - a[1]).shift()?.[0]] },
days: { days: {
"0": faker.datatype.number(10), "0": faker.datatype.number(10),
"1": faker.datatype.number(10), "1": faker.datatype.number(10),
@@ -294,19 +408,27 @@
"4": faker.datatype.number(10), "4": faker.datatype.number(10),
"5": faker.datatype.number(10), "5": faker.datatype.number(10),
"6": faker.datatype.number(10), "6": faker.datatype.number(10),
get max() { return Object.keys(this).filter(key => /^\d+$/.test(key)).map(key => [key, this[key]]).sort((a, b) => b[1] - a[1]).shift()?.[1] } get max() {
return Object.keys(this).filter(key => /^\d+$/.test(key)).map(key => [key, this[key]]).sort((a, b) => b[1] - a[1]).shift()?.[1]
},
}, },
}, },
indents: { style: "spaces", spaces: 1, tabs: 0 }, indents: { style: "spaces", spaces: 1, tabs: 0 },
linguist: { linguist: {
available: true, available: true,
get ordered() { return Object.entries(this.languages) }, get ordered() {
get languages() { return Object.fromEntries(distribution(4).map(value => [faker.lorem.word(), value])) }, return Object.entries(this.languages)
} },
} get languages() {
}) : null), return Object.fromEntries(distribution(4).map(value => [faker.lorem.word(), value]))
},
},
},
})
: null),
//People //People
...(set.plugins.enabled.people ? ({ ...(set.plugins.enabled.people
? ({
get people() { get people() {
const types = options["people.types"].split(",").map(x => x.trim()) const types = options["people.types"].split(",").map(x => x.trim())
.map(x => ({ followed: "following", sponsors: "sponsorshipsAsMaintainer", sponsored: "sponsorshipsAsSponsor", sponsoring: "sponsorshipsAsSponsor" })[x] ?? x) .map(x => ({ followed: "following", sponsors: "sponsorshipsAsMaintainer", sponsored: "sponsorshipsAsSponsor", sponsoring: "sponsorshipsAsSponsor" })[x] ?? x)
@@ -319,17 +441,19 @@
new Array(Number(options["people.limit"])).fill(null).map(_ => ({ new Array(Number(options["people.limit"])).fill(null).map(_ => ({
login: faker.internet.userName(), login: faker.internet.userName(),
avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==", avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
})) })),
]))), ]))),
thanks: options["people.thanks"].split(",").map(x => x.trim()).map(login => ({ thanks: options["people.thanks"].split(",").map(x => x.trim()).map(login => ({
login, login,
avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==", avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
})) })),
} }
} },
}) : null), })
: null),
//Music //Music
...(set.plugins.enabled.music ? ({ ...(set.plugins.enabled.music
? ({
music: { music: {
provider: "(music provider)", provider: "(music provider)",
mode: "Suggested tracks", mode: "Suggested tracks",
@@ -337,11 +461,13 @@
name: faker.random.words(5), name: faker.random.words(5),
artist: faker.random.words(), artist: faker.random.words(),
artwork: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==", artwork: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
})) })),
} },
}) : null), })
: null),
//Nightscout //Nightscout
...(set.plugins.enabled.nightscout ? ({ ...(set.plugins.enabled.nightscout
? ({
nightscout: { nightscout: {
url: options["nightscout.url"] != null && options["nightscout.url"] != "https://example.herokuapp.com" ? options["nightscout.url"] : "https://testapp.herokuapp.com/", url: options["nightscout.url"] != null && options["nightscout.url"] != "https://example.herokuapp.com" ? options["nightscout.url"] : "https://testapp.herokuapp.com/",
data: new Array(12).fill(null).map(_ => ({ data: new Array(12).fill(null).map(_ => ({
@@ -353,10 +479,12 @@
alert: faker.random.arrayElement(["Normal", "Urgent High", "Urgent Low", "High", "Low"]), alert: faker.random.arrayElement(["Normal", "Urgent High", "Urgent Low", "High", "Low"]),
arrowHumanReadable: faker.random.arrayElement(["↑↑", "↑", "↗", "→", "↘", "↓", "↓↓"]), arrowHumanReadable: faker.random.arrayElement(["↑↑", "↑", "↗", "→", "↘", "↓", "↓↓"]),
})), })),
} },
}) : null), })
: null),
//Pagespeed //Pagespeed
...(set.plugins.enabled.pagespeed ? ({ ...(set.plugins.enabled.pagespeed
? ({
pagespeed: { pagespeed: {
url: options["pagespeed.url"] || "(attached website url)", url: options["pagespeed.url"] || "(attached website url)",
detailed: options["pagespeed.detailed"] || false, detailed: options["pagespeed.detailed"] || false,
@@ -364,7 +492,7 @@
{ score: faker.datatype.float({ max: 1 }), title: "Performance" }, { score: faker.datatype.float({ max: 1 }), title: "Performance" },
{ score: faker.datatype.float({ max: 1 }), title: "Accessibility" }, { score: faker.datatype.float({ max: 1 }), title: "Accessibility" },
{ score: faker.datatype.float({ max: 1 }), title: "Best Practices" }, { score: faker.datatype.float({ max: 1 }), title: "Best Practices" },
{score:faker.datatype.float({max:1}), title:"SEO"} { score: faker.datatype.float({ max: 1 }), title: "SEO" },
], ],
metrics: { metrics: {
observedFirstContentfulPaint: faker.datatype.number(500), observedFirstContentfulPaint: faker.datatype.number(500),
@@ -401,13 +529,15 @@
interactive: faker.datatype.number(1000), interactive: faker.datatype.number(1000),
observedNavigationStartTs: faker.time.recent(), observedNavigationStartTs: faker.time.recent(),
observedNavigationStart: faker.datatype.number(10), observedNavigationStart: faker.datatype.number(10),
observedFirstMeaningfulPaintTs:faker.time.recent() observedFirstMeaningfulPaintTs: faker.time.recent(),
}, },
screenshot:options["pagespeed.screenshot"] ? "data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" : null screenshot: options["pagespeed.screenshot"] ? "data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" : null,
} },
}) : null), })
: null),
//Projects //Projects
...(set.plugins.enabled.projects ? ({ ...(set.plugins.enabled.projects
? ({
projects: { projects: {
totalCount: options["projects.limit"] + faker.datatype.number(10), totalCount: options["projects.limit"] + faker.datatype.number(10),
descriptions: options["projects.descriptions"], descriptions: options["projects.descriptions"],
@@ -415,12 +545,22 @@
name: faker.lorem.sentence(), name: faker.lorem.sentence(),
description: faker.lorem.paragraph(), description: faker.lorem.paragraph(),
updated: `${2 + faker.datatype.number(8)} days ago`, updated: `${2 + faker.datatype.number(8)} days ago`,
progress:{enabled:true, todo:faker.datatype.number(50), doing:faker.datatype.number(50), done:faker.datatype.number(50), get total() { return this.todo + this.doing + this.done } } progress: {
})) enabled: true,
} todo: faker.datatype.number(50),
}) : null), doing: faker.datatype.number(50),
done: faker.datatype.number(50),
get total() {
return this.todo + this.doing + this.done
},
},
})),
},
})
: null),
//Posts //Posts
...(set.plugins.enabled.posts ? ({ ...(set.plugins.enabled.posts
? ({
posts: { posts: {
source: options["posts.source"], source: options["posts.source"],
descriptions: options["posts.descriptions"], descriptions: options["posts.descriptions"],
@@ -430,22 +570,26 @@
description: faker.lorem.paragraph(), description: faker.lorem.paragraph(),
date: faker.date.recent(), date: faker.date.recent(),
image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==", image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
})) })),
} },
}) : null), })
: null),
//Topics //Topics
...(set.plugins.enabled.topics ? ({ ...(set.plugins.enabled.topics
? ({
topics: { topics: {
mode: options["topics.mode"], mode: options["topics.mode"],
list: new Array(Number(options["topics.limit"]) || 20).fill(null).map(_ => ({ list: new Array(Number(options["topics.limit"]) || 20).fill(null).map(_ => ({
name: faker.lorem.words(2), name: faker.lorem.words(2),
description: faker.lorem.sentence(), description: faker.lorem.sentence(),
icon:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==" icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
})) })),
} },
}) : null), })
: null),
//Stars //Stars
...(set.plugins.enabled.stars ? ({ ...(set.plugins.enabled.stars
? ({
stars: { stars: {
repositories: [ repositories: [
{ {
@@ -464,9 +608,9 @@
}, },
stargazerCount: faker.datatype.number(10000), stargazerCount: faker.datatype.number(10000),
licenseInfo: { nickname: null, name: "MIT License" }, licenseInfo: { nickname: null, name: "MIT License" },
primaryLanguage:{color:"#f1e05a", name:"JavaScript"} primaryLanguage: { color: "#f1e05a", name: "JavaScript" },
}, },
starred:"1 day ago" starred: "1 day ago",
}, },
...new Array(Number(options["stars.limit"]) - 1).fill(null).map((_, i) => ({ ...new Array(Number(options["stars.limit"]) - 1).fill(null).map((_, i) => ({
starredAt: faker.date.recent(), starredAt: faker.date.recent(),
@@ -484,30 +628,40 @@
}, },
stargazerCount: faker.datatype.number(10000), stargazerCount: faker.datatype.number(10000),
licenseInfo: { nickname: null, name: "License" }, licenseInfo: { nickname: null, name: "License" },
primaryLanguage:{color:faker.internet.color(), name:faker.lorem.word()} primaryLanguage: { color: faker.internet.color(), name: faker.lorem.word() },
}, },
starred:`${i+2} days ago` starred: `${i + 2} days ago`,
})), })),
] ],
} },
}) : null), })
: null),
//Stars //Stars
...(set.plugins.enabled.stargazers ? ({ ...(set.plugins.enabled.stargazers
? ({
get stargazers() { get stargazers() {
const dates = [] const dates = []
let total = faker.datatype.number(1000) let total = faker.datatype.number(1000)
const result = { const result = {
total: { total: {
dates: {}, dates: {},
get max() { return Math.max(...dates.map(date => this.dates[date])) }, get max() {
get min() { return Math.min(...dates.map(date => this.dates[date])) }, return Math.max(...dates.map(date => this.dates[date]))
},
get min() {
return Math.min(...dates.map(date => this.dates[date]))
},
}, },
increments: { increments: {
dates: {}, dates: {},
get max() { return Math.max(...dates.map(date => this.dates[date])) }, get max() {
get min() { return Math.min(...dates.map(date => this.dates[date])) }, return Math.max(...dates.map(date => this.dates[date]))
}, },
months:["", "Jan.", "Feb.", "Mar.", "Apr.", "May", "June", "July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."] get min() {
return Math.min(...dates.map(date => this.dates[date]))
},
},
months: ["", "Jan.", "Feb.", "Mar.", "Apr.", "May", "June", "July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."],
} }
for (let d = -14; d <= 0; d++) { for (let d = -14; d <= 0; d++) {
const date = new Date(Date.now() - d * 24 * 60 * 60 * 1000).toISOString().substring(0, 10) const date = new Date(Date.now() - d * 24 * 60 * 60 * 1000).toISOString().substring(0, 10)
@@ -515,16 +669,19 @@
result.total.dates[date] = (total += (result.increments.dates[date] = faker.datatype.number(100))) result.total.dates[date] = (total += (result.increments.dates[date] = faker.datatype.number(100)))
} }
return result return result
} },
}) : null), })
: null),
//Wakatime //Wakatime
...(set.plugins.enabled.wakatime ? ({ ...(set.plugins.enabled.wakatime
? ({
get wakatime() { get wakatime() {
const stats = (array) => { const stats = array => {
const elements = [] const elements = []
let results = new Array(4 + faker.datatype.number(2)).fill(null).map(_ => ({ let results = new Array(4 + faker.datatype.number(2)).fill(null).map(_ => ({
name: array ? faker.random.arrayElement(array) : faker.random.words(2).replace(/ /g, "-").toLocaleLowerCase(), name: array ? faker.random.arrayElement(array) : faker.random.words(2).replace(/ /g, "-").toLocaleLowerCase(),
percent:0, total_seconds:faker.datatype.number(1000000), percent: 0,
total_seconds: faker.datatype.number(1000000),
})) }))
let percents = 100 let percents = 100
for (const result of results) { for (const result of results) {
@@ -544,10 +701,12 @@
projects: stats(), projects: stats(),
os: stats(["Mac", "Windows", "Linux"]), os: stats(["Mac", "Windows", "Linux"]),
} }
} },
}) : null), })
: null),
//Anilist //Anilist
...(set.plugins.enabled.anilist ? ({ ...(set.plugins.enabled.anilist
? ({
anilist: { anilist: {
user: { user: {
stats: { stats: {
@@ -567,7 +726,7 @@
genres: new Array(4).fill(null).map(_ => ({ genre: faker.lorem.word() })), genres: new Array(4).fill(null).map(_ => ({ genre: faker.lorem.word() })),
}, },
get lists() { get lists() {
const media = (type) => ({ const media = type => ({
name: faker.lorem.words(), name: faker.lorem.words(),
type, type,
status: faker.random.arrayElement(["FINISHED", "RELEASING", "NOT_YET_RELEASED", "CANCELLED", "HIATUS"]), status: faker.random.arrayElement(["FINISHED", "RELEASING", "NOT_YET_RELEASED", "CANCELLED", "HIATUS"]),
@@ -582,28 +741,39 @@
const sections = options["anilist.sections"].split(",").map(x => x.trim()).filter(x => x) const sections = options["anilist.sections"].split(",").map(x => x.trim()).filter(x => x)
const medias = options["anilist.medias"].split(",").map(x => x.trim()).filter(x => x) const medias = options["anilist.medias"].split(",").map(x => x.trim()).filter(x => x)
return { return {
...(medias.includes("anime") ? {anime:{ ...(medias.includes("anime")
? {
anime: {
...(sections.includes("watching") ? { watching: new Array(Number(options["anilist.limit"]) || 4).fill(null).map(_ => media("ANIME")) } : {}), ...(sections.includes("watching") ? { watching: new Array(Number(options["anilist.limit"]) || 4).fill(null).map(_ => media("ANIME")) } : {}),
...(sections.includes("favorites") ? { favorites: new Array(Number(options["anilist.limit"]) || 4).fill(null).map(_ => media("ANIME")) } : {}), ...(sections.includes("favorites") ? { favorites: new Array(Number(options["anilist.limit"]) || 4).fill(null).map(_ => media("ANIME")) } : {}),
}} : {}), },
...(medias.includes("manga") ? {manga:{ }
: {}),
...(medias.includes("manga")
? {
manga: {
...(sections.includes("reading") ? { reading: new Array(Number(options["anilist.limit"]) || 4).fill(null).map(_ => media("MANGA")) } : {}), ...(sections.includes("reading") ? { reading: new Array(Number(options["anilist.limit"]) || 4).fill(null).map(_ => media("MANGA")) } : {}),
...(sections.includes("favorites") ? { favorites: new Array(Number(options["anilist.limit"]) || 4).fill(null).map(_ => media("MANGA")) } : {}), ...(sections.includes("favorites") ? { favorites: new Array(Number(options["anilist.limit"]) || 4).fill(null).map(_ => media("MANGA")) } : {}),
}} : {}), },
}
: {}),
} }
}, },
characters: new Array(11).fill(null).map(_ => ({ characters: new Array(11).fill(null).map(_ => ({
name: faker.name.findName(), name: faker.name.findName(),
artwork: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==", artwork: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
})), })),
sections:options["anilist.sections"].split(",").map(x => x.trim()).filter(x => x) sections: options["anilist.sections"].split(",").map(x => x.trim()).filter(x => x),
} },
}) : null), })
: null),
//Activity //Activity
...(set.plugins.enabled.activity ? ({ ...(set.plugins.enabled.activity
? ({
activity: { activity: {
timestamps: options["activity.timestamps"], timestamps: options["activity.timestamps"],
events:new Array(Number(options["activity.limit"])).fill(null).map(_ => [ events: new Array(Number(options["activity.limit"])).fill(null).map(_ =>
[
{ {
type: "push", type: "push",
repo: `${faker.random.word()}/${faker.random.word()}`, repo: `${faker.random.word()}/${faker.random.word()}`,
@@ -661,7 +831,8 @@
user: set.user, user: set.user,
number: faker.datatype.number(100), number: faker.datatype.number(100),
title: faker.lorem.sentence(), title: faker.lorem.sentence(),
lines:{added:faker.datatype.number(1000), deleted:faker.datatype.number(1000)}, files:{changed:faker.datatype.number(10)}, lines: { added: faker.datatype.number(1000), deleted: faker.datatype.number(1000) },
files: { changed: faker.datatype.number(10) },
timestamp: faker.date.recent(), timestamp: faker.date.recent(),
}, },
{ {
@@ -721,21 +892,26 @@
action: "started", action: "started",
timestamp: faker.date.recent(), timestamp: faker.date.recent(),
}, },
][Math.floor(Math.random()*15)]) ][Math.floor(Math.random() * 15)]
} ),
}) : null), },
})
: null),
//Isocalendar //Isocalendar
...(set.plugins.enabled.isocalendar ? ({ ...(set.plugins.enabled.isocalendar
? ({
isocalendar: { isocalendar: {
streak: { max: 30 + faker.datatype.number(20), current: faker.datatype.number(30) }, streak: { max: 30 + faker.datatype.number(20), current: faker.datatype.number(30) },
max: 10 + faker.datatype.number(40), max: 10 + faker.datatype.number(40),
average: faker.datatype.float(10), average: faker.datatype.float(10),
svg: "(isometric calendar is not displayed in placeholder)", svg: "(isometric calendar is not displayed in placeholder)",
duration:options["isocalendar.duration"] duration: options["isocalendar.duration"],
} },
}) : null), })
: null),
//Stackoverflow //Stackoverflow
...(set.plugins.enabled.stackoverflow ? ({ ...(set.plugins.enabled.stackoverflow
? ({
stackoverflow: { stackoverflow: {
sections: options["stackoverflow.sections"].split(",").map(x => x.trim()).filter(x => x), sections: options["stackoverflow.sections"].split(",").map(x => x.trim()).filter(x => x),
lines: options["stackoverflow.lines"], lines: options["stackoverflow.lines"],
@@ -763,7 +939,7 @@
question: { question: {
title: faker.lorem.sentence(), title: faker.lorem.sentence(),
tags: [faker.lorem.slug(), faker.lorem.slug()], tags: [faker.lorem.slug(), faker.lorem.slug()],
} },
})), })),
get ["answers-recent"]() { get ["answers-recent"]() {
return this["answers-top"] return this["answers-top"]
@@ -791,21 +967,25 @@
get ["questions-recent"]() { get ["questions-recent"]() {
return this["questions-top"] return this["questions-top"]
}, },
} },
}) : null), })
: null),
}, },
} }
//Formatters //Formatters
data.f.bytes = function(n) { data.f.bytes = function(n) {
for (const {u, v} of [{u:"E", v:10**18}, {u:"P", v:10**15}, {u:"T", v:10**12}, {u:"G", v:10**9}, {u:"M", v:10**6}, {u:"k", v:10**3}]) for (const { u, v } of [{ u: "E", v: 10 ** 18 }, { u: "P", v: 10 ** 15 }, { u: "T", v: 10 ** 12 }, { u: "G", v: 10 ** 9 }, { u: "M", v: 10 ** 6 }, { u: "k", v: 10 ** 3 }]) {
if (n / v >= 1) if (n / v >= 1)
return `${(n / v).toFixed(2).substr(0, 4).replace(/[.]0*$/, "")} ${u}B` return `${(n / v).toFixed(2).substr(0, 4).replace(/[.]0*$/, "")} ${u}B`
}
return `${n} byte${n > 1 ? "s" : ""}` return `${n} byte${n > 1 ? "s" : ""}`
} }
data.f.percentage = function(n, { rescale = true } = {}) { data.f.percentage = function(n, { rescale = true } = {}) {
return `${(n*(rescale ? 100 : 1)).toFixed(2) return `${
(n * (rescale ? 100 : 1)).toFixed(2)
.replace(/[.]([1-9]*)(0+)$/, (m, a, b) => `.${a}`) .replace(/[.]([1-9]*)(0+)$/, (m, a, b) => `.${a}`)
.replace(/[.]$/, "")}%` .replace(/[.]$/, "")
}%`
} }
data.f.ellipsis = function(text, { length = 20 } = {}) { data.f.ellipsis = function(text, { length = 20 } = {}) {
text = `${text}` text = `${text}`

View File

@@ -25,7 +25,11 @@
.filter(a => (!only.length) || ((only.length) && (only.includes(a.title.toLocaleLowerCase())))) .filter(a => (!only.length) || ((only.length) && (only.includes(a.title.toLocaleLowerCase()))))
.filter(a => !ignored.includes(a.title.toLocaleLowerCase())) .filter(a => !ignored.includes(a.title.toLocaleLowerCase()))
.sort((a, b) => (order[b.rank] + b.progress * 0.99) - (order[a.rank] + a.progress * 0.99)) .sort((a, b) => (order[b.rank] + b.progress * 0.99) - (order[a.rank] + a.progress * 0.99))
.map(({title, unlock, ...achievement}) => ({title:({S:`Master ${title.toLocaleLowerCase()}`, A:`Super ${title.toLocaleLowerCase()}`, B:`Great ${title.toLocaleLowerCase()}`}[achievement.rank] ?? title), unlock:!/invalid date/i.test(unlock) ? `${imports.date(unlock, {timeStyle:"short", timeZone:data.config.timezone?.name})} on ${imports.date(unlock, {dateStyle:"short", timeZone:data.config.timezone?.name})}` : null, ...achievement})) .map(({title, unlock, ...achievement}) => ({
title:({S:`Master ${title.toLocaleLowerCase()}`, A:`Super ${title.toLocaleLowerCase()}`, B:`Great ${title.toLocaleLowerCase()}`}[achievement.rank] ?? title),
unlock:!/invalid date/i.test(unlock) ? `${imports.date(unlock, {timeStyle:"short", timeZone:data.config.timezone?.name})} on ${imports.date(unlock, {dateStyle:"short", timeZone:data.config.timezone?.name})}` : null,
...achievement,
}))
.map(({icon, ...achievement}) => ({icon:icon.replace(/#primary/g, colors[achievement.rank][0]).replace(/#secondary/g, colors[achievement.rank][1]), ...achievement})) .map(({icon, ...achievement}) => ({icon:icon.replace(/#primary/g, colors[achievement.rank][0]).replace(/#secondary/g, colors[achievement.rank][1]), ...achievement}))
.slice(0, limit || Infinity) .slice(0, limit || Infinity)
return {list:achievements} return {list:achievements}
@@ -49,7 +53,8 @@
/**Leaderboards */ /**Leaderboards */
function leaderboard({user, type, requirement}) { function leaderboard({user, type, requirement}) {
return requirement ? { return requirement
? {
user:1 + user, user:1 + user,
total:total[type], total:total[type],
type, type,
@@ -59,7 +64,8 @@
get percentile() { get percentile() {
return 100 * (this.user / this.top) return 100 * (this.user / this.top)
}, },
} : null }
: null
} }
/**Total extracter */ /**Total extracter */

View File

@@ -1,3 +1,3 @@
//Exports //Exports
export {default as user} from "./users.mjs"
export {default as organization} from "./organizations.mjs" export {default as organization} from "./organizations.mjs"
export {default as user} from "./users.mjs"

View File

@@ -1,6 +1,5 @@
/**Achievements list for users accounts */ /**Achievements list for users accounts */
export default async function({list, login, data, computed, imports, graphql, queries, rank, leaderboard}) { export default async function({list, login, data, computed, imports, graphql, queries, rank, leaderboard}) {
//Initialization //Initialization
const {organization} = await graphql(queries.achievements.organizations({login})) const {organization} = await graphql(queries.achievements.organizations({login}))
const scores = {followers:0, created:organization.repositories.totalCount, stars:organization.popular.nodes?.[0]?.stargazers?.totalCount ?? 0, forks:Math.max(0, ...data.user.repositories.nodes.map(({forkCount}) => forkCount))} const scores = {followers:0, created:organization.repositories.totalCount, stars:organization.popular.nodes?.[0]?.stargazers?.totalCount ?? 0, forks:Math.max(0, ...data.user.repositories.nodes.map(({forkCount}) => forkCount))}
@@ -14,8 +13,10 @@
list.push({ list.push({
title:"Developers", title:"Developers",
text:`Published ${value} public repositor${imports.s(value, "y")}`, text:`Published ${value} public repositor${imports.s(value, "y")}`,
icon:"<g stroke-linecap=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><g stroke=\"#primary\"><path d=\"M20 24l-3.397 3.398a.85.85 0 000 1.203L20.002 32M37.015 24l3.399 3.398a.85.85 0 010 1.203L37.014 32\" stroke-linejoin=\"round\"/><path d=\"M31.029 21.044L25.976 35.06\"/></g><path stroke=\"#secondary\" stroke-linejoin=\"round\" d=\"M23.018 10h8.984M26 47h5M8 16h16m9 0h15.725M8 41h13\"/><path d=\"M5.027 34.998c.673 2.157 1.726 4.396 2.81 6.02m43.38-19.095C50.7 19.921 49.866 17.796 48.79 16\" stroke=\"#secondary\"/><path stroke=\"#primary\" stroke-linejoin=\"round\" d=\"M26 41h17\"/><path d=\"M7.183 16C5.186 19.582 4 23.619 4 28M42.608 47.02c2.647-1.87 5.642-5.448 7.295-9.18C51.52 34.191 52.071 30.323 52 28\" stroke=\"#primary\"/><path stroke=\"#primary\" stroke-linejoin=\"round\" d=\"M7.226 16H28M13.343 47H21\"/><path d=\"M13.337 47.01a24.364 24.364 0 006.19 3.45 24.527 24.527 0 007.217 1.505c2.145.108 4.672-.05 7.295-.738\" stroke=\"#primary\"/><path stroke=\"#primary\" stroke-linejoin=\"round\" d=\"M36 47h6.647M12 10h6M37 10h6.858\"/><path d=\"M43.852 10c-4.003-3.667-9.984-6.054-16.047-6-2.367.021-4.658.347-6.81 1.045\" stroke=\"#primary\"/><path stroke=\"#secondary\" stroke-linejoin=\"round\" d=\"M5.041 35h4.962M47 22h4.191\"/></g>", icon:'<g stroke-linecap="round" stroke-width="2" fill="none" fill-rule="evenodd"><g stroke="#primary"><path d="M20 24l-3.397 3.398a.85.85 0 000 1.203L20.002 32M37.015 24l3.399 3.398a.85.85 0 010 1.203L37.014 32" stroke-linejoin="round"/><path d="M31.029 21.044L25.976 35.06"/></g><path stroke="#secondary" stroke-linejoin="round" d="M23.018 10h8.984M26 47h5M8 16h16m9 0h15.725M8 41h13"/><path d="M5.027 34.998c.673 2.157 1.726 4.396 2.81 6.02m43.38-19.095C50.7 19.921 49.866 17.796 48.79 16" stroke="#secondary"/><path stroke="#primary" stroke-linejoin="round" d="M26 41h17"/><path d="M7.183 16C5.186 19.582 4 23.619 4 28M42.608 47.02c2.647-1.87 5.642-5.448 7.295-9.18C51.52 34.191 52.071 30.323 52 28" stroke="#primary"/><path stroke="#primary" stroke-linejoin="round" d="M7.226 16H28M13.343 47H21"/><path d="M13.337 47.01a24.364 24.364 0 006.19 3.45 24.527 24.527 0 007.217 1.505c2.145.108 4.672-.05 7.295-.738" stroke="#primary"/><path stroke="#primary" stroke-linejoin="round" d="M36 47h6.647M12 10h6M37 10h6.858"/><path d="M43.852 10c-4.003-3.667-9.984-6.054-16.047-6-2.367.021-4.658.347-6.81 1.045" stroke="#primary"/><path stroke="#secondary" stroke-linejoin="round" d="M5.041 35h4.962M47 22h4.191"/></g>',
...rank(value, [1, 50, 100, 200]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 50, 100, 200]),
value,
unlock:new Date(unlock?.createdAt),
leaderboard:leaderboard({user:ranks.created_rank.userCount, requirement:scores.created >= requirements.created, type:"users"}), leaderboard:leaderboard({user:ranks.created_rank.userCount, requirement:scores.created >= requirements.created, type:"users"}),
}) })
} }
@@ -27,8 +28,10 @@
list.push({ list.push({
title:"Forkers", title:"Forkers",
text:`Forked ${value} public repositor${imports.s(value, "y")}`, text:`Forked ${value} public repositor${imports.s(value, "y")}`,
icon:"<g stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M37.303 21.591a5.84 5.84 0 00-1.877-1.177 6.138 6.138 0 00-4.432 0 5.822 5.822 0 00-1.879 1.177L28 22.638l-1.115-1.047c-1.086-1.018-2.559-1.59-4.094-1.59-1.536 0-3.008.572-4.094 1.59-1.086 1.02-1.696 2.4-1.696 3.84 0 1.441.61 2.823 1.696 3.841l1.115 1.046L28 38l8.189-7.682 1.115-1.046a5.422 5.422 0 001.256-1.761 5.126 5.126 0 000-4.157 5.426 5.426 0 00-1.256-1.763z\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M15.967 42.705A18.922 18.922 0 0028 47a18.92 18.92 0 0011.076-3.56m-.032-30.902A18.914 18.914 0 0028 9c-4.09 0-7.876 1.292-10.976 3.49\" stroke=\"#secondary\" stroke-linecap=\"round\"/><g transform=\"translate(7 10)\" stroke=\"#primary\"><path d=\"M6 0v7c0 2.21-1.343 3-3 3s-3-.79-3-3V0\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke-linecap=\"round\" d=\"M3 0v19.675\"/><rect stroke-linejoin=\"round\" x=\"1\" y=\"20\" width=\"4\" height=\"16\" rx=\"2\"/></g><g transform=\"translate(43 10)\" stroke=\"#primary\"><path stroke-linecap=\"round\" d=\"M2 15.968v3.674\"/><path d=\"M4 15.642H0L.014 4.045A4.05 4.05 0 014.028 0L4 15.642z\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><rect stroke-linejoin=\"round\" y=\"19.968\" width=\"4\" height=\"16\" rx=\"2\"/></g><path d=\"M41.364 8.062A23.888 23.888 0 0028 4a23.89 23.89 0 00-11.95 3.182M4.75 22.021A24.045 24.045 0 004 28c0 1.723.182 3.404.527 5.024m10.195 14.971A23.888 23.888 0 0028 52c4.893 0 9.444-1.464 13.239-3.979m9-10.98A23.932 23.932 0 0052 28c0-2.792-.477-5.472-1.353-7.964\" stroke=\"#secondary\" stroke-linecap=\"round\"/></g>", icon:'<g stroke-width="2" fill="none" fill-rule="evenodd"><path d="M37.303 21.591a5.84 5.84 0 00-1.877-1.177 6.138 6.138 0 00-4.432 0 5.822 5.822 0 00-1.879 1.177L28 22.638l-1.115-1.047c-1.086-1.018-2.559-1.59-4.094-1.59-1.536 0-3.008.572-4.094 1.59-1.086 1.02-1.696 2.4-1.696 3.84 0 1.441.61 2.823 1.696 3.841l1.115 1.046L28 38l8.189-7.682 1.115-1.046a5.422 5.422 0 001.256-1.761 5.126 5.126 0 000-4.157 5.426 5.426 0 00-1.256-1.763z" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><path d="M15.967 42.705A18.922 18.922 0 0028 47a18.92 18.92 0 0011.076-3.56m-.032-30.902A18.914 18.914 0 0028 9c-4.09 0-7.876 1.292-10.976 3.49" stroke="#secondary" stroke-linecap="round"/><g transform="translate(7 10)" stroke="#primary"><path d="M6 0v7c0 2.21-1.343 3-3 3s-3-.79-3-3V0" stroke-linecap="round" stroke-linejoin="round"/><path stroke-linecap="round" d="M3 0v19.675"/><rect stroke-linejoin="round" x="1" y="20" width="4" height="16" rx="2"/></g><g transform="translate(43 10)" stroke="#primary"><path stroke-linecap="round" d="M2 15.968v3.674"/><path d="M4 15.642H0L.014 4.045A4.05 4.05 0 014.028 0L4 15.642z" stroke-linecap="round" stroke-linejoin="round"/><rect stroke-linejoin="round" y="19.968" width="4" height="16" rx="2"/></g><path d="M41.364 8.062A23.888 23.888 0 0028 4a23.89 23.89 0 00-11.95 3.182M4.75 22.021A24.045 24.045 0 004 28c0 1.723.182 3.404.527 5.024m10.195 14.971A23.888 23.888 0 0028 52c4.893 0 9.444-1.464 13.239-3.979m9-10.98A23.932 23.932 0 0052 28c0-2.792-.477-5.472-1.353-7.964" stroke="#secondary" stroke-linecap="round"/></g>',
...rank(value, [1, 10, 30, 50]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 10, 30, 50]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -40,8 +43,10 @@
list.push({ list.push({
title:"Managers", title:"Managers",
text:`Created ${value} user project${imports.s(value)}`, text:`Created ${value} user project${imports.s(value)}`,
icon:"<g stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M29 16V8.867C29 7.705 29.627 7 30.692 7h18.616C50.373 7 51 7.705 51 8.867v38.266C51 48.295 50.373 49 49.308 49H30.692C29.627 49 29 48.295 29 47.133V39m-4-23V9c0-1.253-.737-2-2-2H7c-1.263 0-2 .747-2 2v34c0 1.253.737 2 2 2h16c1.263 0 2-.747 2-2v-4\" stroke=\"#secondary\" stroke-linecap=\"round\"/><path stroke=\"#secondary\" d=\"M51.557 12.005h-22M5 12.005h21\"/><path d=\"M14 33V22c0-1.246.649-2 1.73-2h28.54c1.081 0 1.73.754 1.73 2v11c0 1.246-.649 2-1.73 2H15.73c-1.081 0-1.73-.754-1.73-2z\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M19 29v-3c0-.508.492-1 1-1h3c.508 0 1 .492 1 1v3c0 .508-.492 1-1 1h-3c-.508-.082-1-.492-1-1z\" stroke=\"#primary\"/><path stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M28.996 27.998h12M9.065 20.04a7.062 7.062 0 00-.023 1.728m.775 2.517c.264.495.584.954.954 1.369\"/></g>", icon:'<g stroke-width="2" fill="none" fill-rule="evenodd"><path d="M29 16V8.867C29 7.705 29.627 7 30.692 7h18.616C50.373 7 51 7.705 51 8.867v38.266C51 48.295 50.373 49 49.308 49H30.692C29.627 49 29 48.295 29 47.133V39m-4-23V9c0-1.253-.737-2-2-2H7c-1.263 0-2 .747-2 2v34c0 1.253.737 2 2 2h16c1.263 0 2-.747 2-2v-4" stroke="#secondary" stroke-linecap="round"/><path stroke="#secondary" d="M51.557 12.005h-22M5 12.005h21"/><path d="M14 33V22c0-1.246.649-2 1.73-2h28.54c1.081 0 1.73.754 1.73 2v11c0 1.246-.649 2-1.73 2H15.73c-1.081 0-1.73-.754-1.73-2z" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><path d="M19 29v-3c0-.508.492-1 1-1h3c.508 0 1 .492 1 1v3c0 .508-.492 1-1 1h-3c-.508-.082-1-.492-1-1z" stroke="#primary"/><path stroke="#primary" stroke-linecap="round" stroke-linejoin="round" d="M28.996 27.998h12M9.065 20.04a7.062 7.062 0 00-.023 1.728m.775 2.517c.264.495.584.954.954 1.369"/></g>',
...rank(value, [1, 2, 4, 8]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 2, 4, 8]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -53,8 +58,10 @@
list.push({ list.push({
title:"Packagers", title:"Packagers",
text:`Created ${value} package${imports.s(value)}`, text:`Created ${value} package${imports.s(value)}`,
icon:"<g fill=\"none\"><path fill=\"#secondary\" d=\"M28.53 27.64l-11.2 6.49V21.15l11.23-6.48z\"/><path d=\"M40.4 34.84c-.17 0-.34-.04-.5-.13l-11.24-6.44a.99.99 0 01-.37-1.36.99.99 0 011.36-.37l11.24 6.44c.48.27.65.89.37 1.36-.17.32-.51.5-.86.5z\" fill=\"#primary\"/><path d=\"M29.16 28.4c-.56 0-1-.45-1-1.01l.08-12.47c0-.55.49-1 1.01-.99.55 0 1 .45.99 1.01l-.08 12.47c0 .55-.45.99-1 .99z\" fill=\"#primary\"/><path d=\"M18.25 34.65a.996.996 0 01-.5-1.86l10.91-6.25a.997.997 0 11.99 1.73l-10.91 6.25c-.15.09-.32.13-.49.13z\" fill=\"#primary\"/><path d=\"M29.19 41.37c-.17 0-.35-.04-.5-.13l-11.23-6.49c-.31-.18-.5-.51-.5-.87V20.91c0-.36.19-.69.5-.87l11.23-6.49c.31-.18.69-.18 1 0l11.23 6.49c.31.18.5.51.5.87v12.97c0 .36-.19.69-.5.87l-11.23 6.49c-.15.08-.32.13-.5.13zm-10.23-8.06l10.23 5.91 10.23-5.91V21.49l-10.23-5.91-10.23 5.91v11.82zM40.5 11.02c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm-23.19 4.36c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.42 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm23.37 43.8c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.42 3.18-3.18 3.18zm0-4.35c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm-23.06 4.11c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zM6.18 30.72C4.43 30.72 3 29.29 3 27.54c0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm45.64 4.36c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18z\" fill=\"#primary\"/><path d=\"M29.1 10.21c-.55 0-1-.45-1-1V3.52c0-.55.45-1 1-1s1 .45 1 1v5.69c0 .56-.45 1-1 1zM7.44 20.95c-.73 0-1.32-.59-1.32-1.32v-5.38l4.66-2.69c.63-.37 1.44-.15 1.8.48.36.63.15 1.44-.48 1.8l-3.34 1.93v3.86c0 .73-.59 1.32-1.32 1.32zm4 22.68c-.22 0-.45-.06-.66-.18l-4.66-2.69v-5.38c0-.73.59-1.32 1.32-1.32.73 0 1.32.59 1.32 1.32v3.86l3.34 1.93c.63.36.85 1.17.48 1.8-.24.42-.68.66-1.14.66zm17.64 10.39l-4.66-2.69c-.63-.36-.85-1.17-.48-1.8.36-.63 1.17-.85 1.8-.48l3.34 1.93 3.34-1.93a1.32 1.32 0 011.8.48c.36.63.15 1.44-.48 1.8l-4.66 2.69zm17.64-10.39a1.32 1.32 0 01-.66-2.46l3.34-1.93v-3.86c0-.73.59-1.32 1.32-1.32.73 0 1.32.59 1.32 1.32v5.38l-4.66 2.69c-.21.12-.44.18-.66.18zm4-22.68c-.73 0-1.32-.59-1.32-1.32v-3.86l-3.34-1.93c-.63-.36-.85-1.17-.48-1.8.36-.63 1.17-.85 1.8-.48l4.66 2.69v5.38c0 .73-.59 1.32-1.32 1.32z\" fill=\"#secondary\"/><path d=\"M33.08 6.15c-.22 0-.45-.06-.66-.18l-3.34-1.93-3.34 1.93c-.63.36-1.44.15-1.8-.48a1.32 1.32 0 01.48-1.8L29.08 1l4.66 2.69c.63.36.85 1.17.48 1.8a1.3 1.3 0 01-1.14.66zm-3.99 47.3c-.55 0-1-.45-1-1v-7.13c0-.55.45-1 1-1s1 .45 1 1v7.13c0 .55-.44 1-1 1zM13.86 19.71c-.17 0-.34-.04-.5-.13L7.2 16a1 1 0 011-1.73l6.17 3.58c.48.28.64.89.36 1.37-.19.31-.52.49-.87.49zm36.63 21.23c-.17 0-.34-.04-.5-.13l-6.17-3.57a.998.998 0 01-.36-1.37c.28-.48.89-.64 1.37-.36L51 39.08c.48.28.64.89.36 1.37-.19.31-.52.49-.87.49zM44.06 19.8c-.35 0-.68-.18-.87-.5-.28-.48-.11-1.09.36-1.37l6.17-3.57c.48-.28 1.09-.11 1.37.36.28.48.11 1.09-.36 1.37l-6.17 3.57c-.16.1-.33.14-.5.14zM7.43 41.03c-.35 0-.68-.18-.87-.5-.28-.48-.11-1.09.36-1.37l6.17-3.57c.48-.28 1.09-.11 1.37.36.28.48.11 1.09-.36 1.37l-6.17 3.57c-.15.09-.33.14-.5.14z\" fill=\"#secondary\"/></g>", icon:'<g fill="none"><path fill="#secondary" d="M28.53 27.64l-11.2 6.49V21.15l11.23-6.48z"/><path d="M40.4 34.84c-.17 0-.34-.04-.5-.13l-11.24-6.44a.99.99 0 01-.37-1.36.99.99 0 011.36-.37l11.24 6.44c.48.27.65.89.37 1.36-.17.32-.51.5-.86.5z" fill="#primary"/><path d="M29.16 28.4c-.56 0-1-.45-1-1.01l.08-12.47c0-.55.49-1 1.01-.99.55 0 1 .45.99 1.01l-.08 12.47c0 .55-.45.99-1 .99z" fill="#primary"/><path d="M18.25 34.65a.996.996 0 01-.5-1.86l10.91-6.25a.997.997 0 11.99 1.73l-10.91 6.25c-.15.09-.32.13-.49.13z" fill="#primary"/><path d="M29.19 41.37c-.17 0-.35-.04-.5-.13l-11.23-6.49c-.31-.18-.5-.51-.5-.87V20.91c0-.36.19-.69.5-.87l11.23-6.49c.31-.18.69-.18 1 0l11.23 6.49c.31.18.5.51.5.87v12.97c0 .36-.19.69-.5.87l-11.23 6.49c-.15.08-.32.13-.5.13zm-10.23-8.06l10.23 5.91 10.23-5.91V21.49l-10.23-5.91-10.23 5.91v11.82zM40.5 11.02c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm-23.19 4.36c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.42 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm23.37 43.8c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.42 3.18-3.18 3.18zm0-4.35c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm-23.06 4.11c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zM6.18 30.72C4.43 30.72 3 29.29 3 27.54c0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm45.64 4.36c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18z" fill="#primary"/><path d="M29.1 10.21c-.55 0-1-.45-1-1V3.52c0-.55.45-1 1-1s1 .45 1 1v5.69c0 .56-.45 1-1 1zM7.44 20.95c-.73 0-1.32-.59-1.32-1.32v-5.38l4.66-2.69c.63-.37 1.44-.15 1.8.48.36.63.15 1.44-.48 1.8l-3.34 1.93v3.86c0 .73-.59 1.32-1.32 1.32zm4 22.68c-.22 0-.45-.06-.66-.18l-4.66-2.69v-5.38c0-.73.59-1.32 1.32-1.32.73 0 1.32.59 1.32 1.32v3.86l3.34 1.93c.63.36.85 1.17.48 1.8-.24.42-.68.66-1.14.66zm17.64 10.39l-4.66-2.69c-.63-.36-.85-1.17-.48-1.8.36-.63 1.17-.85 1.8-.48l3.34 1.93 3.34-1.93a1.32 1.32 0 011.8.48c.36.63.15 1.44-.48 1.8l-4.66 2.69zm17.64-10.39a1.32 1.32 0 01-.66-2.46l3.34-1.93v-3.86c0-.73.59-1.32 1.32-1.32.73 0 1.32.59 1.32 1.32v5.38l-4.66 2.69c-.21.12-.44.18-.66.18zm4-22.68c-.73 0-1.32-.59-1.32-1.32v-3.86l-3.34-1.93c-.63-.36-.85-1.17-.48-1.8.36-.63 1.17-.85 1.8-.48l4.66 2.69v5.38c0 .73-.59 1.32-1.32 1.32z" fill="#secondary"/><path d="M33.08 6.15c-.22 0-.45-.06-.66-.18l-3.34-1.93-3.34 1.93c-.63.36-1.44.15-1.8-.48a1.32 1.32 0 01.48-1.8L29.08 1l4.66 2.69c.63.36.85 1.17.48 1.8a1.3 1.3 0 01-1.14.66zm-3.99 47.3c-.55 0-1-.45-1-1v-7.13c0-.55.45-1 1-1s1 .45 1 1v7.13c0 .55-.44 1-1 1zM13.86 19.71c-.17 0-.34-.04-.5-.13L7.2 16a1 1 0 011-1.73l6.17 3.58c.48.28.64.89.36 1.37-.19.31-.52.49-.87.49zm36.63 21.23c-.17 0-.34-.04-.5-.13l-6.17-3.57a.998.998 0 01-.36-1.37c.28-.48.89-.64 1.37-.36L51 39.08c.48.28.64.89.36 1.37-.19.31-.52.49-.87.49zM44.06 19.8c-.35 0-.68-.18-.87-.5-.28-.48-.11-1.09.36-1.37l6.17-3.57c.48-.28 1.09-.11 1.37.36.28.48.11 1.09-.36 1.37l-6.17 3.57c-.16.1-.33.14-.5.14zM7.43 41.03c-.35 0-.68-.18-.87-.5-.28-.48-.11-1.09.36-1.37l6.17-3.57c.48-.28 1.09-.11 1.37.36.28.48.11 1.09-.36 1.37l-6.17 3.57c-.15.09-.33.14-.5.14z" fill="#secondary"/></g>',
...rank(value, [1, 20, 50, 100]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 20, 50, 100]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -66,8 +73,10 @@
list.push({ list.push({
title:"Maintainers", title:"Maintainers",
text:`Maintaining a repository with ${value} star${imports.s(value)}`, text:`Maintaining a repository with ${value} star${imports.s(value)}`,
icon:"<g transform=\"translate(4 4)\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M39 15h.96l4.038 3-.02-3H45a2 2 0 002-2V3a2 2 0 00-2-2H31a2 2 0 00-2 2v4.035\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M36 5.014l-3 3 3 3M40 5.014l3 3-3 3\"/><path d=\"M6 37a1 1 0 110 2 1 1 0 010-2m7 0a1 1 0 110 2 1 1 0 010-2m-2.448 1a1 1 0 11-2 0 1 1 0 012 0z\" fill=\"#primary\"/><path d=\"M1.724 15.05A23.934 23.934 0 000 24c0 .686.029 1.366.085 2.037m19.92 21.632c1.3.218 2.634.331 3.995.331a23.92 23.92 0 009.036-1.76m13.207-13.21A23.932 23.932 0 0048 24c0-1.363-.114-2.7-.332-4M25.064.022a23.932 23.932 0 00-10.073 1.725\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\"/><path d=\"M19 42.062V43a2 2 0 01-2 2H9.04l-4.038 3 .02-3H3a2 2 0 01-2-2V33a2 2 0 012-2h4.045\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M6 0a6 6 0 110 12A6 6 0 016 0z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" d=\"M6 3v6M3 6h6\"/><path d=\"M42 36a6 6 0 110 12 6 6 0 010-12z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M44.338 40.663l-3.336 3.331-1.692-1.686M31 31c-.716-2.865-3.578-5-7-5-3.423 0-6.287 2.14-7 5\"/><path d=\"M24 16a5 5 0 110 10 5 5 0 010-10z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\"/><circle stroke=\"#primary\" stroke-width=\"2\" cx=\"24\" cy=\"24\" r=\"14\"/></g>", icon:'<g transform="translate(4 4)" fill="none" fill-rule="evenodd"><path d="M39 15h.96l4.038 3-.02-3H45a2 2 0 002-2V3a2 2 0 00-2-2H31a2 2 0 00-2 2v4.035" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M36 5.014l-3 3 3 3M40 5.014l3 3-3 3"/><path d="M6 37a1 1 0 110 2 1 1 0 010-2m7 0a1 1 0 110 2 1 1 0 010-2m-2.448 1a1 1 0 11-2 0 1 1 0 012 0z" fill="#primary"/><path d="M1.724 15.05A23.934 23.934 0 000 24c0 .686.029 1.366.085 2.037m19.92 21.632c1.3.218 2.634.331 3.995.331a23.92 23.92 0 009.036-1.76m13.207-13.21A23.932 23.932 0 0048 24c0-1.363-.114-2.7-.332-4M25.064.022a23.932 23.932 0 00-10.073 1.725" stroke="#secondary" stroke-width="2" stroke-linecap="round"/><path d="M19 42.062V43a2 2 0 01-2 2H9.04l-4.038 3 .02-3H3a2 2 0 01-2-2V33a2 2 0 012-2h4.045" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6 0a6 6 0 110 12A6 6 0 016 0z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" stroke-width="2" stroke-linecap="round" d="M6 3v6M3 6h6"/><path d="M42 36a6 6 0 110 12 6 6 0 010-12z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M44.338 40.663l-3.336 3.331-1.692-1.686M31 31c-.716-2.865-3.578-5-7-5-3.423 0-6.287 2.14-7 5"/><path d="M24 16a5 5 0 110 10 5 5 0 010-10z" stroke="#primary" stroke-width="2" stroke-linecap="round"/><circle stroke="#primary" stroke-width="2" cx="24" cy="24" r="14"/></g>',
...rank(value, [1, 5000, 10000, 30000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 5000, 10000, 30000]),
value,
unlock:new Date(unlock?.createdAt),
leaderboard:leaderboard({user:ranks.repo_rank.repositoryCount, requirement:scores.stars >= requirements.stars, type:"repositories"}), leaderboard:leaderboard({user:ranks.repo_rank.repositoryCount, requirement:scores.stars >= requirements.stars, type:"repositories"}),
}) })
} }
@@ -79,8 +88,10 @@
list.push({ list.push({
title:"Inspirationers", title:"Inspirationers",
text:`Maintaining a repository which has been forked ${value} time${imports.s(value)}`, text:`Maintaining a repository which has been forked ${value} time${imports.s(value)}`,
icon:"<g transform=\"translate(4 4)\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M20.065 47.122c.44-.525.58-1.448.58-1.889 0-2.204-1.483-3.967-3.633-4.187.447-1.537.58-2.64.397-3.31-.25-.92-.745-1.646-1.409-2.235m-5.97-7.157c.371-.254.911-.748 1.62-1.48a8.662 8.662 0 001.432-2.366M47 22h-7c-1.538 0-2.749-.357-4-1h-5c-1.789.001-3-1.3-3-2.955 0-1.656 1.211-3.04 3-3.045h2c.027-1.129.513-2.17 1-3m3.082 32.004C34.545 43.028 34.02 40.569 34 39v-1h-1c-2.603-.318-5-2.913-5-5.997S30.397 26 33 26h9c2.384 0 4.326 1.024 5.27 3\" stroke=\"#secondary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"/><g transform=\"translate(36)\" stroke=\"#primary\" stroke-width=\"2\"><path fill=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.395 5.352L6.009 4l.598 1.348L8 5.408l-1.067 1.12.425 1.47-1.356-.908-1.35.91.404-1.469L4 5.41z\"/><circle cx=\"6\" cy=\"6\" r=\"6\"/></g><g transform=\"translate(0 31)\" stroke=\"#primary\" stroke-width=\"2\"><circle cx=\"6\" cy=\"6\" r=\"6\"/><g stroke-linecap=\"round\"><path d=\"M6 4v4M4 6h4\"/></g></g><circle stroke=\"#primary\" stroke-width=\"2\" cx=\"10.5\" cy=\"10.5\" r=\"10.5\"/><g stroke-linecap=\"round\"><path d=\"M32.01 1.37A23.96 23.96 0 0024 0c-.999 0-1.983.061-2.95.18M.32 20.072a24.21 24.21 0 00.015 7.948M12.42 45.025A23.892 23.892 0 0024 48c13.255 0 24-10.745 24-24 0-2.811-.483-5.51-1.371-8.016\" stroke=\"#secondary\" stroke-width=\"2\"/><path stroke=\"#primary\" stroke-width=\"2\" d=\"M8.999 7.151v5.865\"/><path d=\"M9 3a2 2 0 110 4 2 2 0 010-4zm0 10.8a2 2 0 11-.001 4 2 2 0 01.001-4z\" stroke=\"#primary\" stroke-width=\"1.8\"/><path d=\"M9.622 11.838c.138-.007.989.119 1.595-.05.607-.169 1.584-.539 1.829-1.337\" stroke=\"#primary\" stroke-width=\"2\"/><path d=\"M14.8 7.202a2 2 0 110 4 2 2 0 010-4z\" stroke=\"#primary\" stroke-width=\"1.8\"/></g></g>", icon:'<g transform="translate(4 4)" fill="none" fill-rule="evenodd"><path d="M20.065 47.122c.44-.525.58-1.448.58-1.889 0-2.204-1.483-3.967-3.633-4.187.447-1.537.58-2.64.397-3.31-.25-.92-.745-1.646-1.409-2.235m-5.97-7.157c.371-.254.911-.748 1.62-1.48a8.662 8.662 0 001.432-2.366M47 22h-7c-1.538 0-2.749-.357-4-1h-5c-1.789.001-3-1.3-3-2.955 0-1.656 1.211-3.04 3-3.045h2c.027-1.129.513-2.17 1-3m3.082 32.004C34.545 43.028 34.02 40.569 34 39v-1h-1c-2.603-.318-5-2.913-5-5.997S30.397 26 33 26h9c2.384 0 4.326 1.024 5.27 3" stroke="#secondary" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><g transform="translate(36)" stroke="#primary" stroke-width="2"><path fill="#primary" stroke-linecap="round" stroke-linejoin="round" d="M5.395 5.352L6.009 4l.598 1.348L8 5.408l-1.067 1.12.425 1.47-1.356-.908-1.35.91.404-1.469L4 5.41z"/><circle cx="6" cy="6" r="6"/></g><g transform="translate(0 31)" stroke="#primary" stroke-width="2"><circle cx="6" cy="6" r="6"/><g stroke-linecap="round"><path d="M6 4v4M4 6h4"/></g></g><circle stroke="#primary" stroke-width="2" cx="10.5" cy="10.5" r="10.5"/><g stroke-linecap="round"><path d="M32.01 1.37A23.96 23.96 0 0024 0c-.999 0-1.983.061-2.95.18M.32 20.072a24.21 24.21 0 00.015 7.948M12.42 45.025A23.892 23.892 0 0024 48c13.255 0 24-10.745 24-24 0-2.811-.483-5.51-1.371-8.016" stroke="#secondary" stroke-width="2"/><path stroke="#primary" stroke-width="2" d="M8.999 7.151v5.865"/><path d="M9 3a2 2 0 110 4 2 2 0 010-4zm0 10.8a2 2 0 11-.001 4 2 2 0 01.001-4z" stroke="#primary" stroke-width="1.8"/><path d="M9.622 11.838c.138-.007.989.119 1.595-.05.607-.169 1.584-.539 1.829-1.337" stroke="#primary" stroke-width="2"/><path d="M14.8 7.202a2 2 0 110 4 2 2 0 010-4z" stroke="#primary" stroke-width="1.8"/></g></g>',
...rank(value, [1, 500, 1000, 3000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 500, 1000, 3000]),
value,
unlock:new Date(unlock?.createdAt),
leaderboard:leaderboard({user:ranks.forks_rank.repositoryCount, requirement:scores.forks >= requirements.forks, type:"repositories"}), leaderboard:leaderboard({user:ranks.forks_rank.repositoryCount, requirement:scores.forks >= requirements.forks, type:"repositories"}),
}) })
} }
@@ -93,8 +104,10 @@
list.push({ list.push({
title:"Polyglots", title:"Polyglots",
text:`Using ${value} different programming language${imports.s(value)}`, text:`Using ${value} different programming language${imports.s(value)}`,
icon:"<g stroke-linecap=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M17.135 7.988l-3.303.669a2 2 0 00-1.586 2.223l4.708 35.392a1.498 1.498 0 01-1.162 1.66 1.523 1.523 0 01-1.775-1.01L4.951 19.497a2 2 0 011.215-2.507l2.946-1.072\" stroke=\"#secondary\" stroke-linejoin=\"round\"/><path d=\"M36.8 48H23a2 2 0 01-2-2V7a2 2 0 012-2h26a2 2 0 012 2v32.766\" stroke=\"#primary\"/><path d=\"M29 20.955l-3.399 3.399a.85.85 0 000 1.202l3.399 3.4M43.014 20.955l3.399 3.399a.85.85 0 010 1.202l-3.4 3.4\" stroke=\"#primary\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" d=\"M38.526 18l-5.053 14.016\"/><path d=\"M44 36a8 8 0 110 16 8 8 0 010-16z\" stroke=\"#primary\" stroke-linejoin=\"round\"/><path d=\"M43.068 40.749l3.846 2.396a1 1 0 01-.006 1.7l-3.846 2.36a1 1 0 01-1.523-.853v-4.755a1 1 0 011.529-.848z\" stroke=\"#primary\" stroke-linejoin=\"round\"/></g>", icon:'<g stroke-linecap="round" stroke-width="2" fill="none" fill-rule="evenodd"><path d="M17.135 7.988l-3.303.669a2 2 0 00-1.586 2.223l4.708 35.392a1.498 1.498 0 01-1.162 1.66 1.523 1.523 0 01-1.775-1.01L4.951 19.497a2 2 0 011.215-2.507l2.946-1.072" stroke="#secondary" stroke-linejoin="round"/><path d="M36.8 48H23a2 2 0 01-2-2V7a2 2 0 012-2h26a2 2 0 012 2v32.766" stroke="#primary"/><path d="M29 20.955l-3.399 3.399a.85.85 0 000 1.202l3.399 3.4M43.014 20.955l3.399 3.399a.85.85 0 010 1.202l-3.4 3.4" stroke="#primary" stroke-linejoin="round"/><path stroke="#primary" d="M38.526 18l-5.053 14.016"/><path d="M44 36a8 8 0 110 16 8 8 0 010-16z" stroke="#primary" stroke-linejoin="round"/><path d="M43.068 40.749l3.846 2.396a1 1 0 01-.006 1.7l-3.846 2.36a1 1 0 01-1.523-.853v-4.755a1 1 0 011.529-.848z" stroke="#primary" stroke-linejoin="round"/></g>',
...rank(value, [1, 8, 16, 32]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 8, 16, 32]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -106,8 +119,10 @@
list.push({ list.push({
title:"Sponsors", title:"Sponsors",
text:`Sponsoring ${value} user${imports.s(value)} or organization${imports.s(value)}`, text:`Sponsoring ${value} user${imports.s(value)} or organization${imports.s(value)}`,
icon:"<g xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M24 32c.267-1.727 1.973-3 4-3 2.08 0 3.787 1.318 4 3m-4-9a3 3 0 110 6 3 3 0 010-6z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M28 18c5.523 0 10 4.477 10 10s-4.477 10-10 10-10-4.477-10-10 4.477-10 10-10z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M46.138 15c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C41.347 15 41 16.117 41 17.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005zm-31-5c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C10.347 10 10 11.117 10 12.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005zm6 32c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C16.347 42 16 43.117 16 44.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005z\" fill=\"#secondary\"/><path d=\"M8.003 29a3 3 0 110 6 3 3 0 010-6zM32.018 5.005a3 3 0 110 6 3 3 0 010-6z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\"/><path stroke=\"#secondary\" stroke-width=\"2\" d=\"M29.972 18.026L31.361 11M18.063 29.987l-7.004 1.401\"/><path d=\"M22.604 11.886l.746 2.164m-9.313 9.296l-2.156-.712\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M21.304 9a1 1 0 100-2 1 1 0 000 2zM8.076 22.346a1 1 0 100-2 1 1 0 000 2z\" fill=\"#primary\"/><path d=\"M33.267 44.17l-.722-2.146m9.38-9.206l2.147.743\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M34.544 49.031a1 1 0 100-2 1 1 0 000 2zm13.314-13.032a1 1 0 100-2 1 1 0 000 2z\" fill=\"#primary\"/><path d=\"M48.019 51.004a3 3 0 100-6 3 3 0 000 6zM35.194 35.33l10.812 11.019\" stroke=\"#secondary\" stroke-width=\"2\"/></g>", icon:'<g xmlns="http://www.w3.org/2000/svg" fill="none" fill-rule="evenodd"><path d="M24 32c.267-1.727 1.973-3 4-3 2.08 0 3.787 1.318 4 3m-4-9a3 3 0 110 6 3 3 0 010-6z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M28 18c5.523 0 10 4.477 10 10s-4.477 10-10 10-10-4.477-10-10 4.477-10 10-10z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M46.138 15c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C41.347 15 41 16.117 41 17.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005zm-31-5c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C10.347 10 10 11.117 10 12.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005zm6 32c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C16.347 42 16 43.117 16 44.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005z" fill="#secondary"/><path d="M8.003 29a3 3 0 110 6 3 3 0 010-6zM32.018 5.005a3 3 0 110 6 3 3 0 010-6z" stroke="#secondary" stroke-width="2" stroke-linecap="round"/><path stroke="#secondary" stroke-width="2" d="M29.972 18.026L31.361 11M18.063 29.987l-7.004 1.401"/><path d="M22.604 11.886l.746 2.164m-9.313 9.296l-2.156-.712" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M21.304 9a1 1 0 100-2 1 1 0 000 2zM8.076 22.346a1 1 0 100-2 1 1 0 000 2z" fill="#primary"/><path d="M33.267 44.17l-.722-2.146m9.38-9.206l2.147.743" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M34.544 49.031a1 1 0 100-2 1 1 0 000 2zm13.314-13.032a1 1 0 100-2 1 1 0 000 2z" fill="#primary"/><path d="M48.019 51.004a3 3 0 100-6 3 3 0 000 6zM35.194 35.33l10.812 11.019" stroke="#secondary" stroke-width="2"/></g>',
...rank(value, [1, 5, 10, 20]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 5, 10, 20]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -119,8 +134,10 @@
list.push({ list.push({
title:"Organization", title:"Organization",
text:`Has ${value} member${imports.s(value)}`, text:`Has ${value} member${imports.s(value)}`,
icon:"<g xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M6 42c.45-3.415 3.34-6 7-6 1.874 0 3.752.956 5 3m-6-13a5 5 0 110 10 5 5 0 010-10zm38 16c-.452-3.415-3.34-6-7-6-1.874 0-3.752.956-5 3m6-13a5 5 0 100 10 5 5 0 000-10z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\"/><path d=\"M37 51c-.92-4.01-4.6-7-9-7-4.401 0-8.083 2.995-9 7\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M28.01 31.004a6.5 6.5 0 110 13 6.5 6.5 0 010-13z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\"/><path d=\"M28 14.011a5 5 0 11-5 4.998 5 5 0 015-4.998z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\"/><path d=\"M22 26c1.558-1.25 3.665-2 6-2 2.319 0 4.439.761 6 2\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M51 9V8c0-1.3-1.574-3-3-3h-8c-1.426 0-3 1.7-3 3v13l4-4h6c2.805-.031 4-1.826 4-4V9zM5 9V8c0-1.3 1.574-3 3-3h8c1.426 0 3 1.7 3 3v13l-4-4H9c-2.805-.031-4-1.826-4-4V9z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M43 11a1 1 0 11-2 0 1 1 0 012 0zm4 0a1 1 0 11-2 0 1 1 0 012 0zm-36 0a1 1 0 11-2 0 1 1 0 012 0zm4 0a1 1 0 11-2 0 1 1 0 012 0z\" fill=\"#secondary\"/></g>", icon:'<g xmlns="http://www.w3.org/2000/svg" fill="none" fill-rule="evenodd"><path d="M6 42c.45-3.415 3.34-6 7-6 1.874 0 3.752.956 5 3m-6-13a5 5 0 110 10 5 5 0 010-10zm38 16c-.452-3.415-3.34-6-7-6-1.874 0-3.752.956-5 3m6-13a5 5 0 100 10 5 5 0 000-10z" stroke="#primary" stroke-width="2" stroke-linecap="round"/><path d="M37 51c-.92-4.01-4.6-7-9-7-4.401 0-8.083 2.995-9 7" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M28.01 31.004a6.5 6.5 0 110 13 6.5 6.5 0 010-13z" stroke="#secondary" stroke-width="2" stroke-linecap="round"/><path d="M28 14.011a5 5 0 11-5 4.998 5 5 0 015-4.998z" stroke="#primary" stroke-width="2" stroke-linecap="round"/><path d="M22 26c1.558-1.25 3.665-2 6-2 2.319 0 4.439.761 6 2" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M51 9V8c0-1.3-1.574-3-3-3h-8c-1.426 0-3 1.7-3 3v13l4-4h6c2.805-.031 4-1.826 4-4V9zM5 9V8c0-1.3 1.574-3 3-3h8c1.426 0 3 1.7 3 3v13l-4-4H9c-2.805-.031-4-1.826-4-4V9z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M43 11a1 1 0 11-2 0 1 1 0 012 0zm4 0a1 1 0 11-2 0 1 1 0 012 0zm-36 0a1 1 0 11-2 0 1 1 0 012 0zm4 0a1 1 0 11-2 0 1 1 0 012 0z" fill="#secondary"/></g>',
...rank(value, [1, 100, 500, 1000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 100, 500, 1000]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -132,9 +149,10 @@
list.push({ list.push({
title:"Member", title:"Member",
text:`Registered ${Math.floor(value)} year${imports.s(Math.floor(value))} ago`, text:`Registered ${Math.floor(value)} year${imports.s(Math.floor(value))} ago`,
icon:"<g xmlns=\"http://www.w3.org/2000/svg\" transform=\"translate(5 4)\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M46 44.557v1a2 2 0 01-2 2H2a2 2 0 01-2-2v-1\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M.75 40.993l.701.561a2.323 2.323 0 002.903 0l1.675-1.34a3 3 0 013.748 0l1.282 1.026a3 3 0 003.71.03l1.4-1.085a3 3 0 013.75.061l1.103.913a3 3 0 003.787.031l1.22-.976a3 3 0 013.748 0l1.282 1.026a3 3 0 003.71.03l1.4-1.085a3 3 0 013.75.061l1.429 1.182a2.427 2.427 0 003.103-.008l.832-.695A2 2 0 0046 39.191v-1.634a2 2 0 00-2-2H2a2 2 0 00-2 2v1.875a2 2 0 00.75 1.561z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M42 31.609v.948m-38 0v-.992m25.04-15.008H35a2 2 0 012 2v1m-28 0v-1a2 2 0 012-2h6.007\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M22 8.557h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6a1 1 0 011-1z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linejoin=\"round\"/><path d=\"M4.7 10.557c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zm35-8c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M23 5.557a2 2 0 002-2C25 2.452 24.433 0 22.273 0c-.463 0 .21 1.424-.502 1.979A2 2 0 0023 5.557z\" stroke=\"#primary\" stroke-width=\"2\"/><path d=\"M4.78 27.982l1.346 1.076a3 3 0 003.748 0l1.252-1.002a3 3 0 013.748 0l1.282 1.026a3 3 0 003.711.03l1.4-1.085a3 3 0 013.75.061l1.102.913a3 3 0 003.787.031l1.22-.976a3 3 0 013.748 0l1.281 1.025a3 3 0 003.712.029l1.358-1.053a2 2 0 00.775-1.58v-.97a1.95 1.95 0 00-1.95-1.95H5.942a1.912 1.912 0 00-1.912 1.912v.951a2 2 0 00.75 1.562z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle stroke=\"#secondary\" cx=\"16.5\" cy=\"2.057\" r=\"1\"/><circle stroke=\"#secondary\" cx=\"14.5\" cy=\"12.057\" r=\"1\"/><circle stroke=\"#secondary\" cx=\"31.5\" cy=\"9.057\" r=\"1\"/></g>", icon:'<g xmlns="http://www.w3.org/2000/svg" transform="translate(5 4)" fill="none" fill-rule="evenodd"><path d="M46 44.557v1a2 2 0 01-2 2H2a2 2 0 01-2-2v-1" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M.75 40.993l.701.561a2.323 2.323 0 002.903 0l1.675-1.34a3 3 0 013.748 0l1.282 1.026a3 3 0 003.71.03l1.4-1.085a3 3 0 013.75.061l1.103.913a3 3 0 003.787.031l1.22-.976a3 3 0 013.748 0l1.282 1.026a3 3 0 003.71.03l1.4-1.085a3 3 0 013.75.061l1.429 1.182a2.427 2.427 0 003.103-.008l.832-.695A2 2 0 0046 39.191v-1.634a2 2 0 00-2-2H2a2 2 0 00-2 2v1.875a2 2 0 00.75 1.561z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M42 31.609v.948m-38 0v-.992m25.04-15.008H35a2 2 0 012 2v1m-28 0v-1a2 2 0 012-2h6.007" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M22 8.557h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6a1 1 0 011-1z" stroke="#primary" stroke-width="2" stroke-linejoin="round"/><path d="M4.7 10.557c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zm35-8c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M23 5.557a2 2 0 002-2C25 2.452 24.433 0 22.273 0c-.463 0 .21 1.424-.502 1.979A2 2 0 0023 5.557z" stroke="#primary" stroke-width="2"/><path d="M4.78 27.982l1.346 1.076a3 3 0 003.748 0l1.252-1.002a3 3 0 013.748 0l1.282 1.026a3 3 0 003.711.03l1.4-1.085a3 3 0 013.75.061l1.102.913a3 3 0 003.787.031l1.22-.976a3 3 0 013.748 0l1.281 1.025a3 3 0 003.712.029l1.358-1.053a2 2 0 00.775-1.58v-.97a1.95 1.95 0 00-1.95-1.95H5.942a1.912 1.912 0 00-1.912 1.912v.951a2 2 0 00.75 1.562z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle stroke="#secondary" cx="16.5" cy="2.057" r="1"/><circle stroke="#secondary" cx="14.5" cy="12.057" r="1"/><circle stroke="#secondary" cx="31.5" cy="9.057" r="1"/></g>',
...rank(value, [1, 3, 5, 10]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 3, 5, 10]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
} }

View File

@@ -1,6 +1,5 @@
/**Achievements list for users accounts */ /**Achievements list for users accounts */
export default async function({list, login, data, computed, imports, graphql, queries, rank, leaderboard}) { export default async function({list, login, data, computed, imports, graphql, queries, rank, leaderboard}) {
//Initialization //Initialization
const {user} = await graphql(queries.achievements({login})) const {user} = await graphql(queries.achievements({login}))
const scores = {followers:user.followers.totalCount, created:user.repositories.totalCount, stars:user.popular.nodes?.[0]?.stargazers?.totalCount ?? 0, forks:Math.max(0, ...data.user.repositories.nodes.map(({forkCount}) => forkCount))} const scores = {followers:user.followers.totalCount, created:user.repositories.totalCount, stars:user.popular.nodes?.[0]?.stargazers?.totalCount ?? 0, forks:Math.max(0, ...data.user.repositories.nodes.map(({forkCount}) => forkCount))}
@@ -14,8 +13,10 @@
list.push({ list.push({
title:"Developer", title:"Developer",
text:`Published ${value} public repositor${imports.s(value, "y")}`, text:`Published ${value} public repositor${imports.s(value, "y")}`,
icon:"<g stroke-linecap=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><g stroke=\"#primary\"><path d=\"M20 24l-3.397 3.398a.85.85 0 000 1.203L20.002 32M37.015 24l3.399 3.398a.85.85 0 010 1.203L37.014 32\" stroke-linejoin=\"round\"/><path d=\"M31.029 21.044L25.976 35.06\"/></g><path stroke=\"#secondary\" stroke-linejoin=\"round\" d=\"M23.018 10h8.984M26 47h5M8 16h16m9 0h15.725M8 41h13\"/><path d=\"M5.027 34.998c.673 2.157 1.726 4.396 2.81 6.02m43.38-19.095C50.7 19.921 49.866 17.796 48.79 16\" stroke=\"#secondary\"/><path stroke=\"#primary\" stroke-linejoin=\"round\" d=\"M26 41h17\"/><path d=\"M7.183 16C5.186 19.582 4 23.619 4 28M42.608 47.02c2.647-1.87 5.642-5.448 7.295-9.18C51.52 34.191 52.071 30.323 52 28\" stroke=\"#primary\"/><path stroke=\"#primary\" stroke-linejoin=\"round\" d=\"M7.226 16H28M13.343 47H21\"/><path d=\"M13.337 47.01a24.364 24.364 0 006.19 3.45 24.527 24.527 0 007.217 1.505c2.145.108 4.672-.05 7.295-.738\" stroke=\"#primary\"/><path stroke=\"#primary\" stroke-linejoin=\"round\" d=\"M36 47h6.647M12 10h6M37 10h6.858\"/><path d=\"M43.852 10c-4.003-3.667-9.984-6.054-16.047-6-2.367.021-4.658.347-6.81 1.045\" stroke=\"#primary\"/><path stroke=\"#secondary\" stroke-linejoin=\"round\" d=\"M5.041 35h4.962M47 22h4.191\"/></g>", icon:'<g stroke-linecap="round" stroke-width="2" fill="none" fill-rule="evenodd"><g stroke="#primary"><path d="M20 24l-3.397 3.398a.85.85 0 000 1.203L20.002 32M37.015 24l3.399 3.398a.85.85 0 010 1.203L37.014 32" stroke-linejoin="round"/><path d="M31.029 21.044L25.976 35.06"/></g><path stroke="#secondary" stroke-linejoin="round" d="M23.018 10h8.984M26 47h5M8 16h16m9 0h15.725M8 41h13"/><path d="M5.027 34.998c.673 2.157 1.726 4.396 2.81 6.02m43.38-19.095C50.7 19.921 49.866 17.796 48.79 16" stroke="#secondary"/><path stroke="#primary" stroke-linejoin="round" d="M26 41h17"/><path d="M7.183 16C5.186 19.582 4 23.619 4 28M42.608 47.02c2.647-1.87 5.642-5.448 7.295-9.18C51.52 34.191 52.071 30.323 52 28" stroke="#primary"/><path stroke="#primary" stroke-linejoin="round" d="M7.226 16H28M13.343 47H21"/><path d="M13.337 47.01a24.364 24.364 0 006.19 3.45 24.527 24.527 0 007.217 1.505c2.145.108 4.672-.05 7.295-.738" stroke="#primary"/><path stroke="#primary" stroke-linejoin="round" d="M36 47h6.647M12 10h6M37 10h6.858"/><path d="M43.852 10c-4.003-3.667-9.984-6.054-16.047-6-2.367.021-4.658.347-6.81 1.045" stroke="#primary"/><path stroke="#secondary" stroke-linejoin="round" d="M5.041 35h4.962M47 22h4.191"/></g>',
...rank(value, [1, 20, 50, 100]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 20, 50, 100]),
value,
unlock:new Date(unlock?.createdAt),
leaderboard:leaderboard({user:ranks.created_rank.userCount, requirement:scores.created >= requirements.created, type:"users"}), leaderboard:leaderboard({user:ranks.created_rank.userCount, requirement:scores.created >= requirements.created, type:"users"}),
}) })
} }
@@ -27,8 +28,10 @@
list.push({ list.push({
title:"Forker", title:"Forker",
text:`Forked ${value} public repositor${imports.s(value, "y")}`, text:`Forked ${value} public repositor${imports.s(value, "y")}`,
icon:"<g stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M37.303 21.591a5.84 5.84 0 00-1.877-1.177 6.138 6.138 0 00-4.432 0 5.822 5.822 0 00-1.879 1.177L28 22.638l-1.115-1.047c-1.086-1.018-2.559-1.59-4.094-1.59-1.536 0-3.008.572-4.094 1.59-1.086 1.02-1.696 2.4-1.696 3.84 0 1.441.61 2.823 1.696 3.841l1.115 1.046L28 38l8.189-7.682 1.115-1.046a5.422 5.422 0 001.256-1.761 5.126 5.126 0 000-4.157 5.426 5.426 0 00-1.256-1.763z\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M15.967 42.705A18.922 18.922 0 0028 47a18.92 18.92 0 0011.076-3.56m-.032-30.902A18.914 18.914 0 0028 9c-4.09 0-7.876 1.292-10.976 3.49\" stroke=\"#secondary\" stroke-linecap=\"round\"/><g transform=\"translate(7 10)\" stroke=\"#primary\"><path d=\"M6 0v7c0 2.21-1.343 3-3 3s-3-.79-3-3V0\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke-linecap=\"round\" d=\"M3 0v19.675\"/><rect stroke-linejoin=\"round\" x=\"1\" y=\"20\" width=\"4\" height=\"16\" rx=\"2\"/></g><g transform=\"translate(43 10)\" stroke=\"#primary\"><path stroke-linecap=\"round\" d=\"M2 15.968v3.674\"/><path d=\"M4 15.642H0L.014 4.045A4.05 4.05 0 014.028 0L4 15.642z\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><rect stroke-linejoin=\"round\" y=\"19.968\" width=\"4\" height=\"16\" rx=\"2\"/></g><path d=\"M41.364 8.062A23.888 23.888 0 0028 4a23.89 23.89 0 00-11.95 3.182M4.75 22.021A24.045 24.045 0 004 28c0 1.723.182 3.404.527 5.024m10.195 14.971A23.888 23.888 0 0028 52c4.893 0 9.444-1.464 13.239-3.979m9-10.98A23.932 23.932 0 0052 28c0-2.792-.477-5.472-1.353-7.964\" stroke=\"#secondary\" stroke-linecap=\"round\"/></g>", icon:'<g stroke-width="2" fill="none" fill-rule="evenodd"><path d="M37.303 21.591a5.84 5.84 0 00-1.877-1.177 6.138 6.138 0 00-4.432 0 5.822 5.822 0 00-1.879 1.177L28 22.638l-1.115-1.047c-1.086-1.018-2.559-1.59-4.094-1.59-1.536 0-3.008.572-4.094 1.59-1.086 1.02-1.696 2.4-1.696 3.84 0 1.441.61 2.823 1.696 3.841l1.115 1.046L28 38l8.189-7.682 1.115-1.046a5.422 5.422 0 001.256-1.761 5.126 5.126 0 000-4.157 5.426 5.426 0 00-1.256-1.763z" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><path d="M15.967 42.705A18.922 18.922 0 0028 47a18.92 18.92 0 0011.076-3.56m-.032-30.902A18.914 18.914 0 0028 9c-4.09 0-7.876 1.292-10.976 3.49" stroke="#secondary" stroke-linecap="round"/><g transform="translate(7 10)" stroke="#primary"><path d="M6 0v7c0 2.21-1.343 3-3 3s-3-.79-3-3V0" stroke-linecap="round" stroke-linejoin="round"/><path stroke-linecap="round" d="M3 0v19.675"/><rect stroke-linejoin="round" x="1" y="20" width="4" height="16" rx="2"/></g><g transform="translate(43 10)" stroke="#primary"><path stroke-linecap="round" d="M2 15.968v3.674"/><path d="M4 15.642H0L.014 4.045A4.05 4.05 0 014.028 0L4 15.642z" stroke-linecap="round" stroke-linejoin="round"/><rect stroke-linejoin="round" y="19.968" width="4" height="16" rx="2"/></g><path d="M41.364 8.062A23.888 23.888 0 0028 4a23.89 23.89 0 00-11.95 3.182M4.75 22.021A24.045 24.045 0 004 28c0 1.723.182 3.404.527 5.024m10.195 14.971A23.888 23.888 0 0028 52c4.893 0 9.444-1.464 13.239-3.979m9-10.98A23.932 23.932 0 0052 28c0-2.792-.477-5.472-1.353-7.964" stroke="#secondary" stroke-linecap="round"/></g>',
...rank(value, [1, 5, 10, 20]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 5, 10, 20]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -40,8 +43,10 @@
list.push({ list.push({
title:"Contributor", title:"Contributor",
text:`Opened ${value} pull request${imports.s(value)}`, text:`Opened ${value} pull request${imports.s(value)}`,
icon:"<g stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path stroke=\"#secondary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M26.022 5.014h6M26.012 53.005h6M27.003 47.003h12M44.01 20.005h5M19.01 11.003h12\"/><path stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M38.005 11.008h6M41 14.013v-6M14.007 47.003h6M17.002 50.004v-6\"/><path d=\"M29.015 5.01l-5.003 5.992 5.003-5.992zM33.015 47.01l-5.003 5.992 5.003-5.992z\" stroke=\"#secondary\"/><path stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M8.01 19.002h6\"/><path stroke=\"#secondary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M47.011 29h6\"/><path stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M44.012 39.003h6\"/><g stroke=\"#secondary\"><path d=\"M5.36 29c4.353 0 6.4 4.472 6.4 8\"/><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M13.99 37.995h-5M10.989 29h-6\"/></g><path d=\"M24.503 22c1.109 0 2.007.895 2.007 2 0 1.104-.898 2-2.007 2a2.004 2.004 0 01-2.008-2c0-1.105.9-2 2.008-2zM24.5 32a2 2 0 110 4 2 2 0 010-4zm9.5 0a2 2 0 110 4 2 2 0 010-4z\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" d=\"M24.5 26.004v6.001\"/><path d=\"M31.076 23.988l1.027-.023a1.998 1.998 0 011.932 2.01L34 31\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M31.588 26.222l-2.194-2.046 2.046-2.194\"/><path d=\"M29.023 43c7.732 0 14-6.268 14-14s-6.268-14-14-14-14 6.268-14 14 6.268 14 14 14z\" stroke=\"#primary\"/></g>", icon:'<g stroke-width="2" fill="none" fill-rule="evenodd"><path stroke="#secondary" stroke-linecap="round" stroke-linejoin="round" d="M26.022 5.014h6M26.012 53.005h6M27.003 47.003h12M44.01 20.005h5M19.01 11.003h12"/><path stroke="#primary" stroke-linecap="round" stroke-linejoin="round" d="M38.005 11.008h6M41 14.013v-6M14.007 47.003h6M17.002 50.004v-6"/><path d="M29.015 5.01l-5.003 5.992 5.003-5.992zM33.015 47.01l-5.003 5.992 5.003-5.992z" stroke="#secondary"/><path stroke="#primary" stroke-linecap="round" stroke-linejoin="round" d="M8.01 19.002h6"/><path stroke="#secondary" stroke-linecap="round" stroke-linejoin="round" d="M47.011 29h6"/><path stroke="#primary" stroke-linecap="round" stroke-linejoin="round" d="M44.012 39.003h6"/><g stroke="#secondary"><path d="M5.36 29c4.353 0 6.4 4.472 6.4 8"/><path stroke-linecap="round" stroke-linejoin="round" d="M13.99 37.995h-5M10.989 29h-6"/></g><path d="M24.503 22c1.109 0 2.007.895 2.007 2 0 1.104-.898 2-2.007 2a2.004 2.004 0 01-2.008-2c0-1.105.9-2 2.008-2zM24.5 32a2 2 0 110 4 2 2 0 010-4zm9.5 0a2 2 0 110 4 2 2 0 010-4z" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" d="M24.5 26.004v6.001"/><path d="M31.076 23.988l1.027-.023a1.998 1.998 0 011.932 2.01L34 31" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" stroke-linecap="round" stroke-linejoin="round" d="M31.588 26.222l-2.194-2.046 2.046-2.194"/><path d="M29.023 43c7.732 0 14-6.268 14-14s-6.268-14-14-14-14 6.268-14 14 6.268 14 14 14z" stroke="#primary"/></g>',
...rank(value, [1, 200, 500, 1000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 200, 500, 1000]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -53,8 +58,10 @@
list.push({ list.push({
title:"Manager", title:"Manager",
text:`Created ${value} user project${imports.s(value)}`, text:`Created ${value} user project${imports.s(value)}`,
icon:"<g stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M29 16V8.867C29 7.705 29.627 7 30.692 7h18.616C50.373 7 51 7.705 51 8.867v38.266C51 48.295 50.373 49 49.308 49H30.692C29.627 49 29 48.295 29 47.133V39m-4-23V9c0-1.253-.737-2-2-2H7c-1.263 0-2 .747-2 2v34c0 1.253.737 2 2 2h16c1.263 0 2-.747 2-2v-4\" stroke=\"#secondary\" stroke-linecap=\"round\"/><path stroke=\"#secondary\" d=\"M51.557 12.005h-22M5 12.005h21\"/><path d=\"M14 33V22c0-1.246.649-2 1.73-2h28.54c1.081 0 1.73.754 1.73 2v11c0 1.246-.649 2-1.73 2H15.73c-1.081 0-1.73-.754-1.73-2z\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M19 29v-3c0-.508.492-1 1-1h3c.508 0 1 .492 1 1v3c0 .508-.492 1-1 1h-3c-.508-.082-1-.492-1-1z\" stroke=\"#primary\"/><path stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M28.996 27.998h12M9.065 20.04a7.062 7.062 0 00-.023 1.728m.775 2.517c.264.495.584.954.954 1.369\"/></g>", icon:'<g stroke-width="2" fill="none" fill-rule="evenodd"><path d="M29 16V8.867C29 7.705 29.627 7 30.692 7h18.616C50.373 7 51 7.705 51 8.867v38.266C51 48.295 50.373 49 49.308 49H30.692C29.627 49 29 48.295 29 47.133V39m-4-23V9c0-1.253-.737-2-2-2H7c-1.263 0-2 .747-2 2v34c0 1.253.737 2 2 2h16c1.263 0 2-.747 2-2v-4" stroke="#secondary" stroke-linecap="round"/><path stroke="#secondary" d="M51.557 12.005h-22M5 12.005h21"/><path d="M14 33V22c0-1.246.649-2 1.73-2h28.54c1.081 0 1.73.754 1.73 2v11c0 1.246-.649 2-1.73 2H15.73c-1.081 0-1.73-.754-1.73-2z" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><path d="M19 29v-3c0-.508.492-1 1-1h3c.508 0 1 .492 1 1v3c0 .508-.492 1-1 1h-3c-.508-.082-1-.492-1-1z" stroke="#primary"/><path stroke="#primary" stroke-linecap="round" stroke-linejoin="round" d="M28.996 27.998h12M9.065 20.04a7.062 7.062 0 00-.023 1.728m.775 2.517c.264.495.584.954.954 1.369"/></g>',
...rank(value, [1, 2, 3, 4]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 2, 3, 4]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -66,8 +73,10 @@
list.push({ list.push({
title:"Reviewer", title:"Reviewer",
text:`Reviewed ${value} pull request${imports.s(value)}`, text:`Reviewed ${value} pull request${imports.s(value)}`,
icon:"<g stroke-linecap=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><g stroke=\"#secondary\"><path d=\"M26.009 34.01c.444-.004.9.141 1.228.414.473.394.766.959.76 1.54-.01.735-.333 1.413-.97 2.037.66.718.985 1.4.976 2.048-.012.828-.574 1.58-1.687 2.258.624.788.822 1.549.596 2.28-.225.733-.789 1.219-1.69 1.459.703.833.976 1.585.82 2.256-.178.763-.313 1.716-2.492 1.711\" stroke-linejoin=\"round\"/><g stroke-linejoin=\"round\"><path d=\"M18.548 28.422c1.184-4.303-2.132-5.292-2.132-5.292-.873 2.296-1.438 3.825-4.231 8.108-1.285 1.97-1.926 3.957-1.877 5.796M18.391 34.011L24.993 34c2.412-.009.211-.005-6.602.012zM5.004 37.017l5.234-.014-5.234.014z\"/></g><g stroke-linejoin=\"round\"><path d=\"M18.548 28.422c1.184-4.303-2.132-5.292-2.132-5.292-.873 2.296-1.438 3.825-4.231 8.108-1.285 1.97-1.926 3.957-1.877 5.796M5.004 37.017l5.234-.014-5.234.014zM7 48.012h4.01c1.352 1.333 2.672 2 3.961 2.001 0 0 .485-.005 5.46-.005h3.536\"/></g><path d=\"M18.793 27.022c-.062.933-.373 2.082-.933 3.446-.561 1.364-.433 2.547.383 3.547\"/></g><path d=\"M45 16.156V23a2 2 0 01-2 2H31l-6 4v-4h-1.934M12 23V8a2 2 0 012-2h29a2 2 0 012 2v10\" stroke=\"#primary\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-linejoin=\"round\" d=\"M23 12.014l-3 3 3 3M34 12.014l3 3-3 3\"/><path stroke=\"#primary\" d=\"M30.029 10l-3.015 10.027\"/><path d=\"M32 39h3l6 4v-4h8a2 2 0 002-2V22a2 2 0 00-2-2h.138\" stroke=\"#secondary\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-linejoin=\"round\" d=\"M33 29h12M33 34h6M43 34h2\"/></g>", icon:'<g stroke-linecap="round" stroke-width="2" fill="none" fill-rule="evenodd"><g stroke="#secondary"><path d="M26.009 34.01c.444-.004.9.141 1.228.414.473.394.766.959.76 1.54-.01.735-.333 1.413-.97 2.037.66.718.985 1.4.976 2.048-.012.828-.574 1.58-1.687 2.258.624.788.822 1.549.596 2.28-.225.733-.789 1.219-1.69 1.459.703.833.976 1.585.82 2.256-.178.763-.313 1.716-2.492 1.711" stroke-linejoin="round"/><g stroke-linejoin="round"><path d="M18.548 28.422c1.184-4.303-2.132-5.292-2.132-5.292-.873 2.296-1.438 3.825-4.231 8.108-1.285 1.97-1.926 3.957-1.877 5.796M18.391 34.011L24.993 34c2.412-.009.211-.005-6.602.012zM5.004 37.017l5.234-.014-5.234.014z"/></g><g stroke-linejoin="round"><path d="M18.548 28.422c1.184-4.303-2.132-5.292-2.132-5.292-.873 2.296-1.438 3.825-4.231 8.108-1.285 1.97-1.926 3.957-1.877 5.796M5.004 37.017l5.234-.014-5.234.014zM7 48.012h4.01c1.352 1.333 2.672 2 3.961 2.001 0 0 .485-.005 5.46-.005h3.536"/></g><path d="M18.793 27.022c-.062.933-.373 2.082-.933 3.446-.561 1.364-.433 2.547.383 3.547"/></g><path d="M45 16.156V23a2 2 0 01-2 2H31l-6 4v-4h-1.934M12 23V8a2 2 0 012-2h29a2 2 0 012 2v10" stroke="#primary" stroke-linejoin="round"/><path stroke="#primary" stroke-linejoin="round" d="M23 12.014l-3 3 3 3M34 12.014l3 3-3 3"/><path stroke="#primary" d="M30.029 10l-3.015 10.027"/><path d="M32 39h3l6 4v-4h8a2 2 0 002-2V22a2 2 0 00-2-2h.138" stroke="#secondary" stroke-linejoin="round"/><path stroke="#primary" stroke-linejoin="round" d="M33 29h12M33 34h6M43 34h2"/></g>',
...rank(value, [1, 200, 500, 1000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 200, 500, 1000]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -79,8 +88,10 @@
list.push({ list.push({
title:"Packager", title:"Packager",
text:`Created ${value} package${imports.s(value)}`, text:`Created ${value} package${imports.s(value)}`,
icon:"<g fill=\"none\"><path fill=\"#secondary\" d=\"M28.53 27.64l-11.2 6.49V21.15l11.23-6.48z\"/><path d=\"M40.4 34.84c-.17 0-.34-.04-.5-.13l-11.24-6.44a.99.99 0 01-.37-1.36.99.99 0 011.36-.37l11.24 6.44c.48.27.65.89.37 1.36-.17.32-.51.5-.86.5z\" fill=\"#primary\"/><path d=\"M29.16 28.4c-.56 0-1-.45-1-1.01l.08-12.47c0-.55.49-1 1.01-.99.55 0 1 .45.99 1.01l-.08 12.47c0 .55-.45.99-1 .99z\" fill=\"#primary\"/><path d=\"M18.25 34.65a.996.996 0 01-.5-1.86l10.91-6.25a.997.997 0 11.99 1.73l-10.91 6.25c-.15.09-.32.13-.49.13z\" fill=\"#primary\"/><path d=\"M29.19 41.37c-.17 0-.35-.04-.5-.13l-11.23-6.49c-.31-.18-.5-.51-.5-.87V20.91c0-.36.19-.69.5-.87l11.23-6.49c.31-.18.69-.18 1 0l11.23 6.49c.31.18.5.51.5.87v12.97c0 .36-.19.69-.5.87l-11.23 6.49c-.15.08-.32.13-.5.13zm-10.23-8.06l10.23 5.91 10.23-5.91V21.49l-10.23-5.91-10.23 5.91v11.82zM40.5 11.02c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm-23.19 4.36c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.42 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm23.37 43.8c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.42 3.18-3.18 3.18zm0-4.35c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm-23.06 4.11c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zM6.18 30.72C4.43 30.72 3 29.29 3 27.54c0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm45.64 4.36c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18z\" fill=\"#primary\"/><path d=\"M29.1 10.21c-.55 0-1-.45-1-1V3.52c0-.55.45-1 1-1s1 .45 1 1v5.69c0 .56-.45 1-1 1zM7.44 20.95c-.73 0-1.32-.59-1.32-1.32v-5.38l4.66-2.69c.63-.37 1.44-.15 1.8.48.36.63.15 1.44-.48 1.8l-3.34 1.93v3.86c0 .73-.59 1.32-1.32 1.32zm4 22.68c-.22 0-.45-.06-.66-.18l-4.66-2.69v-5.38c0-.73.59-1.32 1.32-1.32.73 0 1.32.59 1.32 1.32v3.86l3.34 1.93c.63.36.85 1.17.48 1.8-.24.42-.68.66-1.14.66zm17.64 10.39l-4.66-2.69c-.63-.36-.85-1.17-.48-1.8.36-.63 1.17-.85 1.8-.48l3.34 1.93 3.34-1.93a1.32 1.32 0 011.8.48c.36.63.15 1.44-.48 1.8l-4.66 2.69zm17.64-10.39a1.32 1.32 0 01-.66-2.46l3.34-1.93v-3.86c0-.73.59-1.32 1.32-1.32.73 0 1.32.59 1.32 1.32v5.38l-4.66 2.69c-.21.12-.44.18-.66.18zm4-22.68c-.73 0-1.32-.59-1.32-1.32v-3.86l-3.34-1.93c-.63-.36-.85-1.17-.48-1.8.36-.63 1.17-.85 1.8-.48l4.66 2.69v5.38c0 .73-.59 1.32-1.32 1.32z\" fill=\"#secondary\"/><path d=\"M33.08 6.15c-.22 0-.45-.06-.66-.18l-3.34-1.93-3.34 1.93c-.63.36-1.44.15-1.8-.48a1.32 1.32 0 01.48-1.8L29.08 1l4.66 2.69c.63.36.85 1.17.48 1.8a1.3 1.3 0 01-1.14.66zm-3.99 47.3c-.55 0-1-.45-1-1v-7.13c0-.55.45-1 1-1s1 .45 1 1v7.13c0 .55-.44 1-1 1zM13.86 19.71c-.17 0-.34-.04-.5-.13L7.2 16a1 1 0 011-1.73l6.17 3.58c.48.28.64.89.36 1.37-.19.31-.52.49-.87.49zm36.63 21.23c-.17 0-.34-.04-.5-.13l-6.17-3.57a.998.998 0 01-.36-1.37c.28-.48.89-.64 1.37-.36L51 39.08c.48.28.64.89.36 1.37-.19.31-.52.49-.87.49zM44.06 19.8c-.35 0-.68-.18-.87-.5-.28-.48-.11-1.09.36-1.37l6.17-3.57c.48-.28 1.09-.11 1.37.36.28.48.11 1.09-.36 1.37l-6.17 3.57c-.16.1-.33.14-.5.14zM7.43 41.03c-.35 0-.68-.18-.87-.5-.28-.48-.11-1.09.36-1.37l6.17-3.57c.48-.28 1.09-.11 1.37.36.28.48.11 1.09-.36 1.37l-6.17 3.57c-.15.09-.33.14-.5.14z\" fill=\"#secondary\"/></g>", icon:'<g fill="none"><path fill="#secondary" d="M28.53 27.64l-11.2 6.49V21.15l11.23-6.48z"/><path d="M40.4 34.84c-.17 0-.34-.04-.5-.13l-11.24-6.44a.99.99 0 01-.37-1.36.99.99 0 011.36-.37l11.24 6.44c.48.27.65.89.37 1.36-.17.32-.51.5-.86.5z" fill="#primary"/><path d="M29.16 28.4c-.56 0-1-.45-1-1.01l.08-12.47c0-.55.49-1 1.01-.99.55 0 1 .45.99 1.01l-.08 12.47c0 .55-.45.99-1 .99z" fill="#primary"/><path d="M18.25 34.65a.996.996 0 01-.5-1.86l10.91-6.25a.997.997 0 11.99 1.73l-10.91 6.25c-.15.09-.32.13-.49.13z" fill="#primary"/><path d="M29.19 41.37c-.17 0-.35-.04-.5-.13l-11.23-6.49c-.31-.18-.5-.51-.5-.87V20.91c0-.36.19-.69.5-.87l11.23-6.49c.31-.18.69-.18 1 0l11.23 6.49c.31.18.5.51.5.87v12.97c0 .36-.19.69-.5.87l-11.23 6.49c-.15.08-.32.13-.5.13zm-10.23-8.06l10.23 5.91 10.23-5.91V21.49l-10.23-5.91-10.23 5.91v11.82zM40.5 11.02c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm-23.19 4.36c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.42 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm23.37 43.8c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.42 3.18-3.18 3.18zm0-4.35c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm-23.06 4.11c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zM6.18 30.72C4.43 30.72 3 29.29 3 27.54c0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18zm45.64 4.36c-1.75 0-3.18-1.43-3.18-3.18 0-1.75 1.43-3.18 3.18-3.18 1.75 0 3.18 1.43 3.18 3.18 0 1.75-1.43 3.18-3.18 3.18zm0-4.36c-.65 0-1.18.53-1.18 1.18 0 .65.53 1.18 1.18 1.18.65 0 1.18-.53 1.18-1.18 0-.65-.53-1.18-1.18-1.18z" fill="#primary"/><path d="M29.1 10.21c-.55 0-1-.45-1-1V3.52c0-.55.45-1 1-1s1 .45 1 1v5.69c0 .56-.45 1-1 1zM7.44 20.95c-.73 0-1.32-.59-1.32-1.32v-5.38l4.66-2.69c.63-.37 1.44-.15 1.8.48.36.63.15 1.44-.48 1.8l-3.34 1.93v3.86c0 .73-.59 1.32-1.32 1.32zm4 22.68c-.22 0-.45-.06-.66-.18l-4.66-2.69v-5.38c0-.73.59-1.32 1.32-1.32.73 0 1.32.59 1.32 1.32v3.86l3.34 1.93c.63.36.85 1.17.48 1.8-.24.42-.68.66-1.14.66zm17.64 10.39l-4.66-2.69c-.63-.36-.85-1.17-.48-1.8.36-.63 1.17-.85 1.8-.48l3.34 1.93 3.34-1.93a1.32 1.32 0 011.8.48c.36.63.15 1.44-.48 1.8l-4.66 2.69zm17.64-10.39a1.32 1.32 0 01-.66-2.46l3.34-1.93v-3.86c0-.73.59-1.32 1.32-1.32.73 0 1.32.59 1.32 1.32v5.38l-4.66 2.69c-.21.12-.44.18-.66.18zm4-22.68c-.73 0-1.32-.59-1.32-1.32v-3.86l-3.34-1.93c-.63-.36-.85-1.17-.48-1.8.36-.63 1.17-.85 1.8-.48l4.66 2.69v5.38c0 .73-.59 1.32-1.32 1.32z" fill="#secondary"/><path d="M33.08 6.15c-.22 0-.45-.06-.66-.18l-3.34-1.93-3.34 1.93c-.63.36-1.44.15-1.8-.48a1.32 1.32 0 01.48-1.8L29.08 1l4.66 2.69c.63.36.85 1.17.48 1.8a1.3 1.3 0 01-1.14.66zm-3.99 47.3c-.55 0-1-.45-1-1v-7.13c0-.55.45-1 1-1s1 .45 1 1v7.13c0 .55-.44 1-1 1zM13.86 19.71c-.17 0-.34-.04-.5-.13L7.2 16a1 1 0 011-1.73l6.17 3.58c.48.28.64.89.36 1.37-.19.31-.52.49-.87.49zm36.63 21.23c-.17 0-.34-.04-.5-.13l-6.17-3.57a.998.998 0 01-.36-1.37c.28-.48.89-.64 1.37-.36L51 39.08c.48.28.64.89.36 1.37-.19.31-.52.49-.87.49zM44.06 19.8c-.35 0-.68-.18-.87-.5-.28-.48-.11-1.09.36-1.37l6.17-3.57c.48-.28 1.09-.11 1.37.36.28.48.11 1.09-.36 1.37l-6.17 3.57c-.16.1-.33.14-.5.14zM7.43 41.03c-.35 0-.68-.18-.87-.5-.28-.48-.11-1.09.36-1.37l6.17-3.57c.48-.28 1.09-.11 1.37.36.28.48.11 1.09-.36 1.37l-6.17 3.57c-.15.09-.33.14-.5.14z" fill="#secondary"/></g>',
...rank(value, [1, 5, 10, 20]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 5, 10, 20]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -92,8 +103,10 @@
list.push({ list.push({
title:"Scripter", title:"Scripter",
text:`Published ${value} gist${imports.s(value)}`, text:`Published ${value} gist${imports.s(value)}`,
icon:"<g stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M20 48.875v-12.75c0-1.33.773-2.131 2.385-2.125h26.23c1.612-.006 2.385.795 2.385 2.125v12.75C51 50.198 50.227 51 48.615 51h-26.23C20.773 51 20 50.198 20 48.875zM37 40.505h9M37 44.492h6\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#secondary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M14 30h-4M16 35h-3M47 10H5M42 15H24M19 15h-9M16 25h-3M42 20h-2M42 20h-2M42 25h-2M16 20h-3\"/><path stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M31.974 25H24\"/><path d=\"M22 20h12a2 2 0 012 2v6a2 2 0 01-2 2H22a2 2 0 01-2-2v-6a2 2 0 012-2z\" stroke=\"#primary\"/><path d=\"M5 33V7a2 2 0 012-2h38a2 2 0 012 2v23\" stroke=\"#secondary\" stroke-linecap=\"round\"/><path d=\"M5 30v8c0 1.105.892 2 1.993 2H16\" stroke=\"#secondary\" stroke-linecap=\"round\"/><g stroke=\"#primary\" stroke-linecap=\"round\"><path d=\"M26.432 37.933v7.07M26.432 37.933v9.07M24.432 40.433h7.07M24.432 40.433h8.07M24.432 44.433h7.07M24.432 44.433h8.07M30.432 37.933v9.07\"/></g></g>", icon:'<g stroke-width="2" fill="none" fill-rule="evenodd"><path d="M20 48.875v-12.75c0-1.33.773-2.131 2.385-2.125h26.23c1.612-.006 2.385.795 2.385 2.125v12.75C51 50.198 50.227 51 48.615 51h-26.23C20.773 51 20 50.198 20 48.875zM37 40.505h9M37 44.492h6" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#secondary" stroke-linecap="round" stroke-linejoin="round" d="M14 30h-4M16 35h-3M47 10H5M42 15H24M19 15h-9M16 25h-3M42 20h-2M42 20h-2M42 25h-2M16 20h-3"/><path stroke="#primary" stroke-linecap="round" stroke-linejoin="round" d="M31.974 25H24"/><path d="M22 20h12a2 2 0 012 2v6a2 2 0 01-2 2H22a2 2 0 01-2-2v-6a2 2 0 012-2z" stroke="#primary"/><path d="M5 33V7a2 2 0 012-2h38a2 2 0 012 2v23" stroke="#secondary" stroke-linecap="round"/><path d="M5 30v8c0 1.105.892 2 1.993 2H16" stroke="#secondary" stroke-linecap="round"/><g stroke="#primary" stroke-linecap="round"><path d="M26.432 37.933v7.07M26.432 37.933v9.07M24.432 40.433h7.07M24.432 40.433h8.07M24.432 44.433h7.07M24.432 44.433h8.07M30.432 37.933v9.07"/></g></g>',
...rank(value, [1, 20, 50, 100]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 20, 50, 100]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -105,8 +118,10 @@
list.push({ list.push({
title:"Worker", title:"Worker",
text:`Joined ${value} organization${imports.s(value)}`, text:`Joined ${value} organization${imports.s(value)}`,
icon:"<g stroke-linecap=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><g stroke=\"#secondary\" stroke-linejoin=\"round\"><path d=\"M30 51H16.543v-2.998h-4v2.976l-5.537.016a2 2 0 01-2.006-2v-8.032a2 2 0 01.75-1.562l9.261-7.406 5.984 5.143m29.992 3.864v10h-6v-3h-5v3h-6m-.987-33c.133-1.116.793-2.106 1.978-2.968.44-.32 5.776-3.664 16.01-10.032v36\"/><path d=\"M19 34.994v-8.982m16 0V49a2 2 0 01-2 2h-8.987l.011-6.957\"/></g><path stroke=\"#secondary\" d=\"M40 38h5M40 34h5\"/><path stroke=\"#primary\" d=\"M25 30h5M25 34h5M25 26h5\"/><path d=\"M35.012 22.003H9.855a4.843 4.843 0 010-9.686h1.479c1.473-4.268 4.277-6.674 8.41-7.219 6.493-.856 9.767 4.27 10.396 5.9.734-.83 2.137-2.208 4.194-1.964a4.394 4.394 0 011.685.533\" stroke=\"#primary\" stroke-linejoin=\"round\"/></g>", icon:'<g stroke-linecap="round" stroke-width="2" fill="none" fill-rule="evenodd"><g stroke="#secondary" stroke-linejoin="round"><path d="M30 51H16.543v-2.998h-4v2.976l-5.537.016a2 2 0 01-2.006-2v-8.032a2 2 0 01.75-1.562l9.261-7.406 5.984 5.143m29.992 3.864v10h-6v-3h-5v3h-6m-.987-33c.133-1.116.793-2.106 1.978-2.968.44-.32 5.776-3.664 16.01-10.032v36"/><path d="M19 34.994v-8.982m16 0V49a2 2 0 01-2 2h-8.987l.011-6.957"/></g><path stroke="#secondary" d="M40 38h5M40 34h5"/><path stroke="#primary" d="M25 30h5M25 34h5M25 26h5"/><path d="M35.012 22.003H9.855a4.843 4.843 0 010-9.686h1.479c1.473-4.268 4.277-6.674 8.41-7.219 6.493-.856 9.767 4.27 10.396 5.9.734-.83 2.137-2.208 4.194-1.964a4.394 4.394 0 011.685.533" stroke="#primary" stroke-linejoin="round"/></g>',
...rank(value, [1, 2, 4, 8]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 2, 4, 8]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -118,8 +133,10 @@
list.push({ list.push({
title:"Stargazer", title:"Stargazer",
text:`Starred ${value} repositor${imports.s(value, "y")}`, text:`Starred ${value} repositor${imports.s(value, "y")}`,
icon:"<g stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path stroke=\"#primary\" d=\"M28.017 5v3M36.006 7.013l-1.987 2.024M20.021 7.011l1.988 2.011M28.806 30.23c-2.206-3.88-5.25-2.234-5.25-2.234 1.007 2.24 1.688 3.72 2.742 8.724.957 4.551 3.785 7.409 7.687 7.293l5.028 6.003M29.03 34.057L29 20.007m4.012 9.004V17.005m4.006 11.99l-.003-9.353\"/><path d=\"M18.993 50.038l4.045-5.993s1.03-.262 1.954-.984m-6.983.96c-4.474-.016-6.986-5.558-6.986-9.979 0-1.764-.439-4.997-1.997-8.004 0 0 3.268-1.24 5.747 3.6.904 1.768.458 5.267.642 5.388.185.121 1.336.554 2.637 2.01m4.955-18.92a976.92 976.92 0 010 5.91m-7.995-4.986l-.003 10.97M10.031 48.021l2.369-3.003\" stroke=\"#secondary\"/><path d=\"M45.996 47.026l-1.99-2.497-1.993-2.5s2.995-1.485 2.995-6.46V24.033\" stroke=\"#primary\"/><path d=\"M41 29v-6a2 2 0 114 0v2m-8-4v-4a2 2 0 114 0v7m-8-7v-2a2 2 0 114 0v2m-8 4v-2a2 2 0 114 0v2\" stroke=\"#primary\"/><path d=\"M23 20v-2a2 2 0 013.043-1.707M19 19v-4a2 2 0 114 0v3m-8 3v-2a2 2 0 114 0v10\" stroke=\"#secondary\"/><path d=\"M6.7 12c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.316-1.121-.572-1.372-1.71-1.678 1.135-.314 1.389-.567 1.7-1.69zm42 0c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zM28.021 47.627c.317 1.122.573 1.372 1.71 1.678-1.135.314-1.389.566-1.699 1.69-.318-1.121-.573-1.372-1.71-1.679 1.134-.313 1.389-.566 1.699-1.689z\" stroke=\"#primary\"/></g>", icon:'<g stroke-linecap="round" stroke-linejoin="round" stroke-width="2" fill="none" fill-rule="evenodd"><path stroke="#primary" d="M28.017 5v3M36.006 7.013l-1.987 2.024M20.021 7.011l1.988 2.011M28.806 30.23c-2.206-3.88-5.25-2.234-5.25-2.234 1.007 2.24 1.688 3.72 2.742 8.724.957 4.551 3.785 7.409 7.687 7.293l5.028 6.003M29.03 34.057L29 20.007m4.012 9.004V17.005m4.006 11.99l-.003-9.353"/><path d="M18.993 50.038l4.045-5.993s1.03-.262 1.954-.984m-6.983.96c-4.474-.016-6.986-5.558-6.986-9.979 0-1.764-.439-4.997-1.997-8.004 0 0 3.268-1.24 5.747 3.6.904 1.768.458 5.267.642 5.388.185.121 1.336.554 2.637 2.01m4.955-18.92a976.92 976.92 0 010 5.91m-7.995-4.986l-.003 10.97M10.031 48.021l2.369-3.003" stroke="#secondary"/><path d="M45.996 47.026l-1.99-2.497-1.993-2.5s2.995-1.485 2.995-6.46V24.033" stroke="#primary"/><path d="M41 29v-6a2 2 0 114 0v2m-8-4v-4a2 2 0 114 0v7m-8-7v-2a2 2 0 114 0v2m-8 4v-2a2 2 0 114 0v2" stroke="#primary"/><path d="M23 20v-2a2 2 0 013.043-1.707M19 19v-4a2 2 0 114 0v3m-8 3v-2a2 2 0 114 0v10" stroke="#secondary"/><path d="M6.7 12c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.316-1.121-.572-1.372-1.71-1.678 1.135-.314 1.389-.567 1.7-1.69zm42 0c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zM28.021 47.627c.317 1.122.573 1.372 1.71 1.678-1.135.314-1.389.566-1.699 1.69-.318-1.121-.573-1.372-1.71-1.679 1.134-.313 1.389-.566 1.699-1.689z" stroke="#primary"/></g>',
...rank(value, [1, 200, 500, 1000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 200, 500, 1000]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -131,8 +148,10 @@
list.push({ list.push({
title:"Follower", title:"Follower",
text:`Following ${value} user${imports.s(value)}`, text:`Following ${value} user${imports.s(value)}`,
icon:"<g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M35 31a7 7 0 1114 0 7 7 0 01-14 0zm12-13a3 3 0 116 0 3 3 0 01-6 0zM33 49a3 3 0 116 0 3 3 0 01-6 0zM4 15a3 3 0 116 0 3 3 0 01-6 0zm37-8.5a2.5 2.5 0 115 0 2.5 2.5 0 01-5 0zM10 14l4.029-.576M19.008 26.016L21 19M29.019 34.001l5.967-1.948M36.997 46.003l2.977-8.02M46.05 24.031L48 21M28.787 18.012l7.248 8.009\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M43.62 29.004c-1.157 0-1.437.676-1.62 1.173-.19-.498-.494-1.167-1.629-1.167-.909 0-1.355.777-1.371 1.632-.022 1.145 1.309 2.365 3 3.358 1.669-.983 3-2.23 3-3.358 0-.89-.54-1.638-1.38-1.638z\" fill=\"#primary\"/><path stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M48.043 15.003L45 9\"/><path d=\"M21 12a3 3 0 116 0 3 3 0 01-6 0zM27 12h3M18 12h3M21 43c-.267-1.727-1.973-3-4-3-2.08 0-3.787 1.318-4 3m4-9a3 3 0 100 6 3 3 0 000-6z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M17 30a9 9 0 110 18 9 9 0 110-18z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></g>", icon:'<g fill="none" fill-rule="evenodd"><path d="M35 31a7 7 0 1114 0 7 7 0 01-14 0zm12-13a3 3 0 116 0 3 3 0 01-6 0zM33 49a3 3 0 116 0 3 3 0 01-6 0zM4 15a3 3 0 116 0 3 3 0 01-6 0zm37-8.5a2.5 2.5 0 115 0 2.5 2.5 0 01-5 0zM10 14l4.029-.576M19.008 26.016L21 19M29.019 34.001l5.967-1.948M36.997 46.003l2.977-8.02M46.05 24.031L48 21M28.787 18.012l7.248 8.009" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M43.62 29.004c-1.157 0-1.437.676-1.62 1.173-.19-.498-.494-1.167-1.629-1.167-.909 0-1.355.777-1.371 1.632-.022 1.145 1.309 2.365 3 3.358 1.669-.983 3-2.23 3-3.358 0-.89-.54-1.638-1.38-1.638z" fill="#primary"/><path stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M48.043 15.003L45 9"/><path d="M21 12a3 3 0 116 0 3 3 0 01-6 0zM27 12h3M18 12h3M21 43c-.267-1.727-1.973-3-4-3-2.08 0-3.787 1.318-4 3m4-9a3 3 0 100 6 3 3 0 000-6z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M17 30a9 9 0 110 18 9 9 0 110-18z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></g>',
...rank(value, [1, 200, 500, 1000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 200, 500, 1000]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -144,8 +163,10 @@
list.push({ list.push({
title:"Influencer", title:"Influencer",
text:`Followed by ${value} user${imports.s(value)}`, text:`Followed by ${value} user${imports.s(value)}`,
icon:"<g transform=\"translate(4 4)\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M33.432 1.924A23.922 23.922 0 0024 0c-3.945 0-7.668.952-10.95 2.638m-9.86 9.398A23.89 23.89 0 000 24a23.9 23.9 0 002.274 10.21m3.45 5.347a23.992 23.992 0 0012.929 7.845m13.048-.664c4.43-1.5 8.28-4.258 11.123-7.848m3.16-5.245A23.918 23.918 0 0048 24c0-1.87-.214-3.691-.619-5.439M40.416 6.493a24.139 24.139 0 00-1.574-1.355\" stroke=\"#secondary\" stroke-linecap=\"round\"/><path stroke=\"#secondary\" d=\"M4.582 33.859l1.613-7.946\"/><circle stroke=\"#secondary\" cx=\"6.832\" cy=\"23\" r=\"3\"/><path stroke=\"#primary\" d=\"M17.444 39.854l4.75 3.275\"/><path stroke=\"#secondary\" stroke-linecap=\"round\" d=\"M7.647 14.952l-.433 4.527\"/><circle stroke=\"#primary\" cx=\"15\" cy=\"38\" r=\"3\"/><path stroke=\"#primary\" d=\"M22.216 9.516l.455 4.342\"/><path stroke=\"#secondary\" stroke-linecap=\"round\" d=\"M34.272 6.952l-2.828 5.25\"/><path stroke=\"#primary\" stroke-linecap=\"square\" d=\"M11.873 7.235l6.424-.736\"/><path stroke=\"#secondary\" stroke-linecap=\"round\" d=\"M28.811 5.445l3.718-.671\"/><path stroke=\"#primary\" d=\"M42.392 22.006l.456-5.763M34.349 24.426l4.374.447\"/><path d=\"M20 28c.267-1.727 1.973-3 4-3 2.08 0 3.787 1.318 4 3m-4-9a3 3 0 110 6 3 3 0 010-6z\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M24 14c5.523 0 10 4.477 10 10s-4.477 10-10 10-10-4.477-10-10 4.477-10 10-10z\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle stroke=\"#secondary\" cx=\"35.832\" cy=\"4\" r=\"3\"/><circle stroke=\"#secondary\" cx=\"44\" cy=\"36\" r=\"3\"/><circle stroke=\"#secondary\" cx=\"34.832\" cy=\"37\" r=\"3\"/><circle stroke=\"#primary\" cx=\"21.654\" cy=\"6.437\" r=\"3\"/><path d=\"M25.083 48.102a3 3 0 100-6 3 3 0 000 6z\" stroke=\"#primary\"/><path d=\"M8.832 5a3 3 0 110 6 3 3 0 010-6z\" stroke=\"#primary\" stroke-linecap=\"round\"/><circle stroke=\"#secondary\" cx=\"4\" cy=\"37\" r=\"3\"/><path d=\"M42.832 10a3 3 0 110 6 3 3 0 010-6z\" stroke=\"#primary\" stroke-linecap=\"round\"/><path stroke=\"#secondary\" stroke-linecap=\"round\" d=\"M32.313 38.851l-1.786 1.661\"/><circle stroke=\"#primary\" cx=\"42\" cy=\"25\" r=\"3\"/><path stroke=\"#primary\" stroke-linecap=\"square\" d=\"M18.228 32.388l-1.562 2.66\"/><path stroke=\"#secondary\" d=\"M37.831 36.739l2.951-.112\"/></g>", icon:'<g transform="translate(4 4)" stroke-width="2" fill="none" fill-rule="evenodd"><path d="M33.432 1.924A23.922 23.922 0 0024 0c-3.945 0-7.668.952-10.95 2.638m-9.86 9.398A23.89 23.89 0 000 24a23.9 23.9 0 002.274 10.21m3.45 5.347a23.992 23.992 0 0012.929 7.845m13.048-.664c4.43-1.5 8.28-4.258 11.123-7.848m3.16-5.245A23.918 23.918 0 0048 24c0-1.87-.214-3.691-.619-5.439M40.416 6.493a24.139 24.139 0 00-1.574-1.355" stroke="#secondary" stroke-linecap="round"/><path stroke="#secondary" d="M4.582 33.859l1.613-7.946"/><circle stroke="#secondary" cx="6.832" cy="23" r="3"/><path stroke="#primary" d="M17.444 39.854l4.75 3.275"/><path stroke="#secondary" stroke-linecap="round" d="M7.647 14.952l-.433 4.527"/><circle stroke="#primary" cx="15" cy="38" r="3"/><path stroke="#primary" d="M22.216 9.516l.455 4.342"/><path stroke="#secondary" stroke-linecap="round" d="M34.272 6.952l-2.828 5.25"/><path stroke="#primary" stroke-linecap="square" d="M11.873 7.235l6.424-.736"/><path stroke="#secondary" stroke-linecap="round" d="M28.811 5.445l3.718-.671"/><path stroke="#primary" d="M42.392 22.006l.456-5.763M34.349 24.426l4.374.447"/><path d="M20 28c.267-1.727 1.973-3 4-3 2.08 0 3.787 1.318 4 3m-4-9a3 3 0 110 6 3 3 0 010-6z" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><path d="M24 14c5.523 0 10 4.477 10 10s-4.477 10-10 10-10-4.477-10-10 4.477-10 10-10z" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/><circle stroke="#secondary" cx="35.832" cy="4" r="3"/><circle stroke="#secondary" cx="44" cy="36" r="3"/><circle stroke="#secondary" cx="34.832" cy="37" r="3"/><circle stroke="#primary" cx="21.654" cy="6.437" r="3"/><path d="M25.083 48.102a3 3 0 100-6 3 3 0 000 6z" stroke="#primary"/><path d="M8.832 5a3 3 0 110 6 3 3 0 010-6z" stroke="#primary" stroke-linecap="round"/><circle stroke="#secondary" cx="4" cy="37" r="3"/><path d="M42.832 10a3 3 0 110 6 3 3 0 010-6z" stroke="#primary" stroke-linecap="round"/><path stroke="#secondary" stroke-linecap="round" d="M32.313 38.851l-1.786 1.661"/><circle stroke="#primary" cx="42" cy="25" r="3"/><path stroke="#primary" stroke-linecap="square" d="M18.228 32.388l-1.562 2.66"/><path stroke="#secondary" d="M37.831 36.739l2.951-.112"/></g>',
...rank(value, [1, 200, 500, 1000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 200, 500, 1000]),
value,
unlock:new Date(unlock?.createdAt),
leaderboard:leaderboard({user:ranks.user_rank.userCount, requirement:scores.followers >= requirements.followers, type:"users"}), leaderboard:leaderboard({user:ranks.user_rank.userCount, requirement:scores.followers >= requirements.followers, type:"users"}),
}) })
} }
@@ -158,8 +179,10 @@
list.push({ list.push({
title:"Maintainer", title:"Maintainer",
text:`Maintaining a repository with ${value} star${imports.s(value)}`, text:`Maintaining a repository with ${value} star${imports.s(value)}`,
icon:"<g transform=\"translate(4 4)\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M39 15h.96l4.038 3-.02-3H45a2 2 0 002-2V3a2 2 0 00-2-2H31a2 2 0 00-2 2v4.035\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M36 5.014l-3 3 3 3M40 5.014l3 3-3 3\"/><path d=\"M6 37a1 1 0 110 2 1 1 0 010-2m7 0a1 1 0 110 2 1 1 0 010-2m-2.448 1a1 1 0 11-2 0 1 1 0 012 0z\" fill=\"#primary\"/><path d=\"M1.724 15.05A23.934 23.934 0 000 24c0 .686.029 1.366.085 2.037m19.92 21.632c1.3.218 2.634.331 3.995.331a23.92 23.92 0 009.036-1.76m13.207-13.21A23.932 23.932 0 0048 24c0-1.363-.114-2.7-.332-4M25.064.022a23.932 23.932 0 00-10.073 1.725\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\"/><path d=\"M19 42.062V43a2 2 0 01-2 2H9.04l-4.038 3 .02-3H3a2 2 0 01-2-2V33a2 2 0 012-2h4.045\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M6 0a6 6 0 110 12A6 6 0 016 0z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" d=\"M6 3v6M3 6h6\"/><path d=\"M42 36a6 6 0 110 12 6 6 0 010-12z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M44.338 40.663l-3.336 3.331-1.692-1.686M31 31c-.716-2.865-3.578-5-7-5-3.423 0-6.287 2.14-7 5\"/><path d=\"M24 16a5 5 0 110 10 5 5 0 010-10z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\"/><circle stroke=\"#primary\" stroke-width=\"2\" cx=\"24\" cy=\"24\" r=\"14\"/></g>", icon:'<g transform="translate(4 4)" fill="none" fill-rule="evenodd"><path d="M39 15h.96l4.038 3-.02-3H45a2 2 0 002-2V3a2 2 0 00-2-2H31a2 2 0 00-2 2v4.035" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M36 5.014l-3 3 3 3M40 5.014l3 3-3 3"/><path d="M6 37a1 1 0 110 2 1 1 0 010-2m7 0a1 1 0 110 2 1 1 0 010-2m-2.448 1a1 1 0 11-2 0 1 1 0 012 0z" fill="#primary"/><path d="M1.724 15.05A23.934 23.934 0 000 24c0 .686.029 1.366.085 2.037m19.92 21.632c1.3.218 2.634.331 3.995.331a23.92 23.92 0 009.036-1.76m13.207-13.21A23.932 23.932 0 0048 24c0-1.363-.114-2.7-.332-4M25.064.022a23.932 23.932 0 00-10.073 1.725" stroke="#secondary" stroke-width="2" stroke-linecap="round"/><path d="M19 42.062V43a2 2 0 01-2 2H9.04l-4.038 3 .02-3H3a2 2 0 01-2-2V33a2 2 0 012-2h4.045" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6 0a6 6 0 110 12A6 6 0 016 0z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" stroke-width="2" stroke-linecap="round" d="M6 3v6M3 6h6"/><path d="M42 36a6 6 0 110 12 6 6 0 010-12z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M44.338 40.663l-3.336 3.331-1.692-1.686M31 31c-.716-2.865-3.578-5-7-5-3.423 0-6.287 2.14-7 5"/><path d="M24 16a5 5 0 110 10 5 5 0 010-10z" stroke="#primary" stroke-width="2" stroke-linecap="round"/><circle stroke="#primary" stroke-width="2" cx="24" cy="24" r="14"/></g>',
...rank(value, [1, 1000, 5000, 10000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 1000, 5000, 10000]),
value,
unlock:new Date(unlock?.createdAt),
leaderboard:leaderboard({user:ranks.repo_rank.repositoryCount, requirement:scores.stars >= requirements.stars, type:"repositories"}), leaderboard:leaderboard({user:ranks.repo_rank.repositoryCount, requirement:scores.stars >= requirements.stars, type:"repositories"}),
}) })
} }
@@ -171,8 +194,10 @@
list.push({ list.push({
title:"Inspirationer", title:"Inspirationer",
text:`Maintaining a repository which has been forked ${value} time${imports.s(value)}`, text:`Maintaining a repository which has been forked ${value} time${imports.s(value)}`,
icon:"<g transform=\"translate(4 4)\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M20.065 47.122c.44-.525.58-1.448.58-1.889 0-2.204-1.483-3.967-3.633-4.187.447-1.537.58-2.64.397-3.31-.25-.92-.745-1.646-1.409-2.235m-5.97-7.157c.371-.254.911-.748 1.62-1.48a8.662 8.662 0 001.432-2.366M47 22h-7c-1.538 0-2.749-.357-4-1h-5c-1.789.001-3-1.3-3-2.955 0-1.656 1.211-3.04 3-3.045h2c.027-1.129.513-2.17 1-3m3.082 32.004C34.545 43.028 34.02 40.569 34 39v-1h-1c-2.603-.318-5-2.913-5-5.997S30.397 26 33 26h9c2.384 0 4.326 1.024 5.27 3\" stroke=\"#secondary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"/><g transform=\"translate(36)\" stroke=\"#primary\" stroke-width=\"2\"><path fill=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.395 5.352L6.009 4l.598 1.348L8 5.408l-1.067 1.12.425 1.47-1.356-.908-1.35.91.404-1.469L4 5.41z\"/><circle cx=\"6\" cy=\"6\" r=\"6\"/></g><g transform=\"translate(0 31)\" stroke=\"#primary\" stroke-width=\"2\"><circle cx=\"6\" cy=\"6\" r=\"6\"/><g stroke-linecap=\"round\"><path d=\"M6 4v4M4 6h4\"/></g></g><circle stroke=\"#primary\" stroke-width=\"2\" cx=\"10.5\" cy=\"10.5\" r=\"10.5\"/><g stroke-linecap=\"round\"><path d=\"M32.01 1.37A23.96 23.96 0 0024 0c-.999 0-1.983.061-2.95.18M.32 20.072a24.21 24.21 0 00.015 7.948M12.42 45.025A23.892 23.892 0 0024 48c13.255 0 24-10.745 24-24 0-2.811-.483-5.51-1.371-8.016\" stroke=\"#secondary\" stroke-width=\"2\"/><path stroke=\"#primary\" stroke-width=\"2\" d=\"M8.999 7.151v5.865\"/><path d=\"M9 3a2 2 0 110 4 2 2 0 010-4zm0 10.8a2 2 0 11-.001 4 2 2 0 01.001-4z\" stroke=\"#primary\" stroke-width=\"1.8\"/><path d=\"M9.622 11.838c.138-.007.989.119 1.595-.05.607-.169 1.584-.539 1.829-1.337\" stroke=\"#primary\" stroke-width=\"2\"/><path d=\"M14.8 7.202a2 2 0 110 4 2 2 0 010-4z\" stroke=\"#primary\" stroke-width=\"1.8\"/></g></g>", icon:'<g transform="translate(4 4)" fill="none" fill-rule="evenodd"><path d="M20.065 47.122c.44-.525.58-1.448.58-1.889 0-2.204-1.483-3.967-3.633-4.187.447-1.537.58-2.64.397-3.31-.25-.92-.745-1.646-1.409-2.235m-5.97-7.157c.371-.254.911-.748 1.62-1.48a8.662 8.662 0 001.432-2.366M47 22h-7c-1.538 0-2.749-.357-4-1h-5c-1.789.001-3-1.3-3-2.955 0-1.656 1.211-3.04 3-3.045h2c.027-1.129.513-2.17 1-3m3.082 32.004C34.545 43.028 34.02 40.569 34 39v-1h-1c-2.603-.318-5-2.913-5-5.997S30.397 26 33 26h9c2.384 0 4.326 1.024 5.27 3" stroke="#secondary" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/><g transform="translate(36)" stroke="#primary" stroke-width="2"><path fill="#primary" stroke-linecap="round" stroke-linejoin="round" d="M5.395 5.352L6.009 4l.598 1.348L8 5.408l-1.067 1.12.425 1.47-1.356-.908-1.35.91.404-1.469L4 5.41z"/><circle cx="6" cy="6" r="6"/></g><g transform="translate(0 31)" stroke="#primary" stroke-width="2"><circle cx="6" cy="6" r="6"/><g stroke-linecap="round"><path d="M6 4v4M4 6h4"/></g></g><circle stroke="#primary" stroke-width="2" cx="10.5" cy="10.5" r="10.5"/><g stroke-linecap="round"><path d="M32.01 1.37A23.96 23.96 0 0024 0c-.999 0-1.983.061-2.95.18M.32 20.072a24.21 24.21 0 00.015 7.948M12.42 45.025A23.892 23.892 0 0024 48c13.255 0 24-10.745 24-24 0-2.811-.483-5.51-1.371-8.016" stroke="#secondary" stroke-width="2"/><path stroke="#primary" stroke-width="2" d="M8.999 7.151v5.865"/><path d="M9 3a2 2 0 110 4 2 2 0 010-4zm0 10.8a2 2 0 11-.001 4 2 2 0 01.001-4z" stroke="#primary" stroke-width="1.8"/><path d="M9.622 11.838c.138-.007.989.119 1.595-.05.607-.169 1.584-.539 1.829-1.337" stroke="#primary" stroke-width="2"/><path d="M14.8 7.202a2 2 0 110 4 2 2 0 010-4z" stroke="#primary" stroke-width="1.8"/></g></g>',
...rank(value, [1, 100, 500, 1000]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 100, 500, 1000]),
value,
unlock:new Date(unlock?.createdAt),
leaderboard:leaderboard({user:ranks.forks_rank.repositoryCount, requirement:scores.forks >= requirements.forks, type:"repositories"}), leaderboard:leaderboard({user:ranks.forks_rank.repositoryCount, requirement:scores.forks >= requirements.forks, type:"repositories"}),
}) })
} }
@@ -185,8 +210,10 @@
list.push({ list.push({
title:"Polyglot", title:"Polyglot",
text:`Using ${value} different programming language${imports.s(value)}`, text:`Using ${value} different programming language${imports.s(value)}`,
icon:"<g stroke-linecap=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M17.135 7.988l-3.303.669a2 2 0 00-1.586 2.223l4.708 35.392a1.498 1.498 0 01-1.162 1.66 1.523 1.523 0 01-1.775-1.01L4.951 19.497a2 2 0 011.215-2.507l2.946-1.072\" stroke=\"#secondary\" stroke-linejoin=\"round\"/><path d=\"M36.8 48H23a2 2 0 01-2-2V7a2 2 0 012-2h26a2 2 0 012 2v32.766\" stroke=\"#primary\"/><path d=\"M29 20.955l-3.399 3.399a.85.85 0 000 1.202l3.399 3.4M43.014 20.955l3.399 3.399a.85.85 0 010 1.202l-3.4 3.4\" stroke=\"#primary\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" d=\"M38.526 18l-5.053 14.016\"/><path d=\"M44 36a8 8 0 110 16 8 8 0 010-16z\" stroke=\"#primary\" stroke-linejoin=\"round\"/><path d=\"M43.068 40.749l3.846 2.396a1 1 0 01-.006 1.7l-3.846 2.36a1 1 0 01-1.523-.853v-4.755a1 1 0 011.529-.848z\" stroke=\"#primary\" stroke-linejoin=\"round\"/></g>", icon:'<g stroke-linecap="round" stroke-width="2" fill="none" fill-rule="evenodd"><path d="M17.135 7.988l-3.303.669a2 2 0 00-1.586 2.223l4.708 35.392a1.498 1.498 0 01-1.162 1.66 1.523 1.523 0 01-1.775-1.01L4.951 19.497a2 2 0 011.215-2.507l2.946-1.072" stroke="#secondary" stroke-linejoin="round"/><path d="M36.8 48H23a2 2 0 01-2-2V7a2 2 0 012-2h26a2 2 0 012 2v32.766" stroke="#primary"/><path d="M29 20.955l-3.399 3.399a.85.85 0 000 1.202l3.399 3.4M43.014 20.955l3.399 3.399a.85.85 0 010 1.202l-3.4 3.4" stroke="#primary" stroke-linejoin="round"/><path stroke="#primary" d="M38.526 18l-5.053 14.016"/><path d="M44 36a8 8 0 110 16 8 8 0 010-16z" stroke="#primary" stroke-linejoin="round"/><path d="M43.068 40.749l3.846 2.396a1 1 0 01-.006 1.7l-3.846 2.36a1 1 0 01-1.523-.853v-4.755a1 1 0 011.529-.848z" stroke="#primary" stroke-linejoin="round"/></g>',
...rank(value, [1, 4, 8, 16]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 4, 8, 16]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -198,8 +225,10 @@
list.push({ list.push({
title:"Member", title:"Member",
text:`Registered ${Math.floor(value)} year${imports.s(Math.floor(value))} ago`, text:`Registered ${Math.floor(value)} year${imports.s(Math.floor(value))} ago`,
icon:"<g xmlns=\"http://www.w3.org/2000/svg\" transform=\"translate(5 4)\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M46 44.557v1a2 2 0 01-2 2H2a2 2 0 01-2-2v-1\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M.75 40.993l.701.561a2.323 2.323 0 002.903 0l1.675-1.34a3 3 0 013.748 0l1.282 1.026a3 3 0 003.71.03l1.4-1.085a3 3 0 013.75.061l1.103.913a3 3 0 003.787.031l1.22-.976a3 3 0 013.748 0l1.282 1.026a3 3 0 003.71.03l1.4-1.085a3 3 0 013.75.061l1.429 1.182a2.427 2.427 0 003.103-.008l.832-.695A2 2 0 0046 39.191v-1.634a2 2 0 00-2-2H2a2 2 0 00-2 2v1.875a2 2 0 00.75 1.561z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M42 31.609v.948m-38 0v-.992m25.04-15.008H35a2 2 0 012 2v1m-28 0v-1a2 2 0 012-2h6.007\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M22 8.557h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6a1 1 0 011-1z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linejoin=\"round\"/><path d=\"M4.7 10.557c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zm35-8c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M23 5.557a2 2 0 002-2C25 2.452 24.433 0 22.273 0c-.463 0 .21 1.424-.502 1.979A2 2 0 0023 5.557z\" stroke=\"#primary\" stroke-width=\"2\"/><path d=\"M4.78 27.982l1.346 1.076a3 3 0 003.748 0l1.252-1.002a3 3 0 013.748 0l1.282 1.026a3 3 0 003.711.03l1.4-1.085a3 3 0 013.75.061l1.102.913a3 3 0 003.787.031l1.22-.976a3 3 0 013.748 0l1.281 1.025a3 3 0 003.712.029l1.358-1.053a2 2 0 00.775-1.58v-.97a1.95 1.95 0 00-1.95-1.95H5.942a1.912 1.912 0 00-1.912 1.912v.951a2 2 0 00.75 1.562z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle stroke=\"#secondary\" cx=\"16.5\" cy=\"2.057\" r=\"1\"/><circle stroke=\"#secondary\" cx=\"14.5\" cy=\"12.057\" r=\"1\"/><circle stroke=\"#secondary\" cx=\"31.5\" cy=\"9.057\" r=\"1\"/></g>", icon:'<g xmlns="http://www.w3.org/2000/svg" transform="translate(5 4)" fill="none" fill-rule="evenodd"><path d="M46 44.557v1a2 2 0 01-2 2H2a2 2 0 01-2-2v-1" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M.75 40.993l.701.561a2.323 2.323 0 002.903 0l1.675-1.34a3 3 0 013.748 0l1.282 1.026a3 3 0 003.71.03l1.4-1.085a3 3 0 013.75.061l1.103.913a3 3 0 003.787.031l1.22-.976a3 3 0 013.748 0l1.282 1.026a3 3 0 003.71.03l1.4-1.085a3 3 0 013.75.061l1.429 1.182a2.427 2.427 0 003.103-.008l.832-.695A2 2 0 0046 39.191v-1.634a2 2 0 00-2-2H2a2 2 0 00-2 2v1.875a2 2 0 00.75 1.561z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M42 31.609v.948m-38 0v-.992m25.04-15.008H35a2 2 0 012 2v1m-28 0v-1a2 2 0 012-2h6.007" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M22 8.557h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6a1 1 0 011-1z" stroke="#primary" stroke-width="2" stroke-linejoin="round"/><path d="M4.7 10.557c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zm35-8c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M23 5.557a2 2 0 002-2C25 2.452 24.433 0 22.273 0c-.463 0 .21 1.424-.502 1.979A2 2 0 0023 5.557z" stroke="#primary" stroke-width="2"/><path d="M4.78 27.982l1.346 1.076a3 3 0 003.748 0l1.252-1.002a3 3 0 013.748 0l1.282 1.026a3 3 0 003.711.03l1.4-1.085a3 3 0 013.75.061l1.102.913a3 3 0 003.787.031l1.22-.976a3 3 0 013.748 0l1.281 1.025a3 3 0 003.712.029l1.358-1.053a2 2 0 00.775-1.58v-.97a1.95 1.95 0 00-1.95-1.95H5.942a1.912 1.912 0 00-1.912 1.912v.951a2 2 0 00.75 1.562z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle stroke="#secondary" cx="16.5" cy="2.057" r="1"/><circle stroke="#secondary" cx="14.5" cy="12.057" r="1"/><circle stroke="#secondary" cx="31.5" cy="9.057" r="1"/></g>',
...rank(value, [1, 3, 5, 10]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 3, 5, 10]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -211,8 +240,10 @@
list.push({ list.push({
title:"Sponsor", title:"Sponsor",
text:`Sponsoring ${value} user${imports.s(value)} or organization${imports.s(value)}`, text:`Sponsoring ${value} user${imports.s(value)} or organization${imports.s(value)}`,
icon:"<g xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M24 32c.267-1.727 1.973-3 4-3 2.08 0 3.787 1.318 4 3m-4-9a3 3 0 110 6 3 3 0 010-6z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M28 18c5.523 0 10 4.477 10 10s-4.477 10-10 10-10-4.477-10-10 4.477-10 10-10z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M46.138 15c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C41.347 15 41 16.117 41 17.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005zm-31-5c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C10.347 10 10 11.117 10 12.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005zm6 32c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C16.347 42 16 43.117 16 44.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005z\" fill=\"#secondary\"/><path d=\"M8.003 29a3 3 0 110 6 3 3 0 010-6zM32.018 5.005a3 3 0 110 6 3 3 0 010-6z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\"/><path stroke=\"#secondary\" stroke-width=\"2\" d=\"M29.972 18.026L31.361 11M18.063 29.987l-7.004 1.401\"/><path d=\"M22.604 11.886l.746 2.164m-9.313 9.296l-2.156-.712\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M21.304 9a1 1 0 100-2 1 1 0 000 2zM8.076 22.346a1 1 0 100-2 1 1 0 000 2z\" fill=\"#primary\"/><path d=\"M33.267 44.17l-.722-2.146m9.38-9.206l2.147.743\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M34.544 49.031a1 1 0 100-2 1 1 0 000 2zm13.314-13.032a1 1 0 100-2 1 1 0 000 2z\" fill=\"#primary\"/><path d=\"M48.019 51.004a3 3 0 100-6 3 3 0 000 6zM35.194 35.33l10.812 11.019\" stroke=\"#secondary\" stroke-width=\"2\"/></g>", icon:'<g xmlns="http://www.w3.org/2000/svg" fill="none" fill-rule="evenodd"><path d="M24 32c.267-1.727 1.973-3 4-3 2.08 0 3.787 1.318 4 3m-4-9a3 3 0 110 6 3 3 0 010-6z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M28 18c5.523 0 10 4.477 10 10s-4.477 10-10 10-10-4.477-10-10 4.477-10 10-10z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M46.138 15c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C41.347 15 41 16.117 41 17.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005zm-31-5c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C10.347 10 10 11.117 10 12.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005zm6 32c-1.033 0-1.454.822-1.634 1.413-.019.06-.024.06-.042 0-.182-.591-.707-1.413-1.655-1.413C16.347 42 16 43.117 16 44.005c0 1.676 2.223 3.228 3.091 3.845.272.197.556.194.817 0 .798-.593 3.092-2.17 3.092-3.845 0-.888-.261-2.005-1.862-2.005z" fill="#secondary"/><path d="M8.003 29a3 3 0 110 6 3 3 0 010-6zM32.018 5.005a3 3 0 110 6 3 3 0 010-6z" stroke="#secondary" stroke-width="2" stroke-linecap="round"/><path stroke="#secondary" stroke-width="2" d="M29.972 18.026L31.361 11M18.063 29.987l-7.004 1.401"/><path d="M22.604 11.886l.746 2.164m-9.313 9.296l-2.156-.712" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M21.304 9a1 1 0 100-2 1 1 0 000 2zM8.076 22.346a1 1 0 100-2 1 1 0 000 2z" fill="#primary"/><path d="M33.267 44.17l-.722-2.146m9.38-9.206l2.147.743" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M34.544 49.031a1 1 0 100-2 1 1 0 000 2zm13.314-13.032a1 1 0 100-2 1 1 0 000 2z" fill="#primary"/><path d="M48.019 51.004a3 3 0 100-6 3 3 0 000 6zM35.194 35.33l10.812 11.019" stroke="#secondary" stroke-width="2"/></g>',
...rank(value, [1, 3, 5, 10]), value, unlock:new Date(unlock?.createdAt), ...rank(value, [1, 3, 5, 10]),
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -224,8 +255,11 @@
list.push({ list.push({
title:"Verified", title:"Verified",
text:"Registered a GPG key to sign commits", text:"Registered a GPG key to sign commits",
icon:"<g stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M46 17.036v13.016c0 4.014-.587 8.94-4.751 13.67-5.787 5.911-12.816 8.279-13.243 8.283-.426.003-7.91-2.639-13.222-8.283C10.718 39.4 10 34.056 10 30.052V17.036a2 2 0 012-2h32a2 2 0 012 2zM16 15c0-6.616 5.384-12 12-12s12 5.384 12 12\" stroke=\"#secondary\"/><path d=\"M21 15c0-3.744 3.141-7 7-7 3.86 0 7 3.256 7 7m4.703 29.63l-3.672-3.647m-17.99-17.869l-7.127-7.081\" stroke=\"#secondary\"/><path d=\"M28 23a8 8 0 110 16 8 8 0 010-16z\" stroke=\"#primary\"/><path stroke=\"#primary\" d=\"M30.966 29.005l-4 3.994-2.002-1.995\"/></g>", icon:'<g stroke-linecap="round" stroke-linejoin="round" stroke-width="2" fill="none" fill-rule="evenodd"><path d="M46 17.036v13.016c0 4.014-.587 8.94-4.751 13.67-5.787 5.911-12.816 8.279-13.243 8.283-.426.003-7.91-2.639-13.222-8.283C10.718 39.4 10 34.056 10 30.052V17.036a2 2 0 012-2h32a2 2 0 012 2zM16 15c0-6.616 5.384-12 12-12s12 5.384 12 12" stroke="#secondary"/><path d="M21 15c0-3.744 3.141-7 7-7 3.86 0 7 3.256 7 7m4.703 29.63l-3.672-3.647m-17.99-17.869l-7.127-7.081" stroke="#secondary"/><path d="M28 23a8 8 0 110 16 8 8 0 010-16z" stroke="#primary"/><path stroke="#primary" d="M30.966 29.005l-4 3.994-2.002-1.995"/></g>',
rank:value ? "$" : "X", progress:value ? 1 : 0, value, unlock:new Date(unlock?.createdAt), rank:value ? "$" : "X",
progress:value ? 1 : 0,
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -237,8 +271,11 @@
list.push({ list.push({
title:"Explorer", title:"Explorer",
text:"Starred a topic on GitHub Explore", text:"Starred a topic on GitHub Explore",
icon:"<g transform=\"translate(3 4)\" fill=\"none\" fill-rule=\"evenodd\"><path d=\"M10 37.5l.049.073a2 2 0 002.506.705l24.391-11.324a2 2 0 00.854-2.874l-2.668-4.27a2 2 0 00-2.865-.562L10.463 34.947A1.869 1.869 0 0010 37.5zM33.028 28.592l-4.033-6.58\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path stroke=\"#primary\" stroke-width=\"2\" stroke-linejoin=\"round\" d=\"M15.52 37.004l-2.499-3.979\"/><path stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M25.008 48.011l.013-15.002M17.984 47.038l6.996-14.035M32.005 47.029l-6.987-14.016\"/><path d=\"M2.032 17.015A23.999 23.999 0 001 24c0 9.3 5.29 17.365 13.025 21.35m22-.027C43.734 41.33 49 33.28 49 24a24 24 0 00-1.025-6.96M34.022 1.754A23.932 23.932 0 0025 0c-2.429 0-4.774.36-6.983 1.032\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M40.64 8.472c-1.102-2.224-.935-4.764 1.382-6.465-.922-.087-2.209.326-3.004.784a6.024 6.024 0 00-2.674 7.229c.94 2.618 3.982 4.864 7.66 3.64 1.292-.429 2.615-1.508 2.996-2.665-1.8.625-5.258-.3-6.36-2.523zM21.013 6.015c-.22-.802-3.018-1.295-4.998-.919M4.998 8.006C2.25 9.22.808 11.146 1.011 12.009\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle stroke=\"#secondary\" stroke-width=\"2\" cx=\"11\" cy=\"9\" r=\"6\"/><path d=\"M.994 12.022c.351 1.38 5.069 1.25 10.713-.355 5.644-1.603 9.654-4.273 9.303-5.653\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M26.978 10.105c.318 1.123.573 1.373 1.71 1.679-1.135.314-1.388.566-1.698 1.69-.318-1.122-.573-1.373-1.711-1.679 1.135-.314 1.39-.566 1.7-1.69\" fill=\"#secondary\"/><path d=\"M26.978 10.105c.318 1.123.573 1.373 1.71 1.679-1.135.314-1.388.566-1.698 1.69-.318-1.122-.573-1.373-1.711-1.679 1.135-.314 1.39-.566 1.7-1.69z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M9.929 22.737c.317 1.121.573 1.372 1.71 1.678-1.135.314-1.389.566-1.699 1.69-.318-1.121-.573-1.372-1.71-1.679 1.134-.313 1.389-.566 1.699-1.69\" fill=\"#secondary\"/><path d=\"M9.929 22.737c.317 1.121.573 1.372 1.71 1.678-1.135.314-1.389.566-1.699 1.69-.318-1.121-.573-1.372-1.71-1.679 1.134-.313 1.389-.566 1.699-1.69z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M38.912 33.684c.318 1.122.573 1.373 1.711 1.679-1.136.313-1.39.565-1.7 1.69-.317-1.123-.573-1.372-1.71-1.68 1.136-.313 1.389-.565 1.7-1.689\" fill=\"#secondary\"/><path d=\"M38.912 33.684c.318 1.122.573 1.373 1.711 1.679-1.136.313-1.39.565-1.7 1.69-.317-1.123-.573-1.372-1.71-1.68 1.136-.313 1.389-.565 1.7-1.689z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></g>", icon:'<g transform="translate(3 4)" fill="none" fill-rule="evenodd"><path d="M10 37.5l.049.073a2 2 0 002.506.705l24.391-11.324a2 2 0 00.854-2.874l-2.668-4.27a2 2 0 00-2.865-.562L10.463 34.947A1.869 1.869 0 0010 37.5zM33.028 28.592l-4.033-6.58" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path stroke="#primary" stroke-width="2" stroke-linejoin="round" d="M15.52 37.004l-2.499-3.979"/><path stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="M25.008 48.011l.013-15.002M17.984 47.038l6.996-14.035M32.005 47.029l-6.987-14.016"/><path d="M2.032 17.015A23.999 23.999 0 001 24c0 9.3 5.29 17.365 13.025 21.35m22-.027C43.734 41.33 49 33.28 49 24a24 24 0 00-1.025-6.96M34.022 1.754A23.932 23.932 0 0025 0c-2.429 0-4.774.36-6.983 1.032" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M40.64 8.472c-1.102-2.224-.935-4.764 1.382-6.465-.922-.087-2.209.326-3.004.784a6.024 6.024 0 00-2.674 7.229c.94 2.618 3.982 4.864 7.66 3.64 1.292-.429 2.615-1.508 2.996-2.665-1.8.625-5.258-.3-6.36-2.523zM21.013 6.015c-.22-.802-3.018-1.295-4.998-.919M4.998 8.006C2.25 9.22.808 11.146 1.011 12.009" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle stroke="#secondary" stroke-width="2" cx="11" cy="9" r="6"/><path d="M.994 12.022c.351 1.38 5.069 1.25 10.713-.355 5.644-1.603 9.654-4.273 9.303-5.653" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M26.978 10.105c.318 1.123.573 1.373 1.71 1.679-1.135.314-1.388.566-1.698 1.69-.318-1.122-.573-1.373-1.711-1.679 1.135-.314 1.39-.566 1.7-1.69" fill="#secondary"/><path d="M26.978 10.105c.318 1.123.573 1.373 1.71 1.679-1.135.314-1.388.566-1.698 1.69-.318-1.122-.573-1.373-1.711-1.679 1.135-.314 1.39-.566 1.7-1.69z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.929 22.737c.317 1.121.573 1.372 1.71 1.678-1.135.314-1.389.566-1.699 1.69-.318-1.121-.573-1.372-1.71-1.679 1.134-.313 1.389-.566 1.699-1.69" fill="#secondary"/><path d="M9.929 22.737c.317 1.121.573 1.372 1.71 1.678-1.135.314-1.389.566-1.699 1.69-.318-1.121-.573-1.372-1.71-1.679 1.134-.313 1.389-.566 1.699-1.69z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M38.912 33.684c.318 1.122.573 1.373 1.711 1.679-1.136.313-1.39.565-1.7 1.69-.317-1.123-.573-1.372-1.71-1.68 1.136-.313 1.389-.565 1.7-1.689" fill="#secondary"/><path d="M38.912 33.684c.318 1.122.573 1.373 1.711 1.679-1.136.313-1.39.565-1.7 1.69-.317-1.123-.573-1.372-1.71-1.68 1.136-.313 1.389-.565 1.7-1.689z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></g>',
rank:value ? "$" : "X", progress:value ? 1 : 0, value, unlock:new Date(unlock?.createdAt), rank:value ? "$" : "X",
progress:value ? 1 : 0,
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -250,8 +287,11 @@
list.push({ list.push({
title:"Automater", title:"Automater",
text:"Use GitHub Actions to automate profile updates", text:"Use GitHub Actions to automate profile updates",
icon:"<g transform=\"translate(4 5)\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><g stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"#primary\" d=\"M26.478 22l.696 2.087 3.478.696v2.782l-3.478 1.392-.696 1.39 1.392 3.48-1.392 1.39L23 33.827l-1.391.695L20.217 38h-2.782l-1.392-3.478-1.39-.696-3.48 1.391-1.39-1.39 1.39-3.48-.695-1.39L7 27.565v-2.782l3.478-1.392.696-1.391-1.391-3.478 1.39-1.392 3.48 1.392 1.39-.696 1.392-3.478h2.782l1.392 3.478 1.391.696 3.478-1.392 1.392 1.392z\"/><path stroke=\"#secondary\" d=\"M24.779 12.899l-1.475-2.212 1.475-1.475 2.95 1.475 1.474-.738.737-2.934h2.212l.737 2.934 1.475.738 2.95-1.475 1.474 1.475-1.475 2.949.738 1.475 2.949.737v2.212l-2.95.737-.737 1.475 1.475 2.949-1.475 1.475-2.949-1.475\"/></g><path stroke=\"#primary\" stroke-linecap=\"round\" d=\"M5.932 5.546l7.082 6.931\"/><path stroke=\"#secondary\" stroke-linecap=\"round\" d=\"M32.959 31.99l8.728 8.532\"/><circle stroke=\"#secondary\" cx=\"44\" cy=\"43\" r=\"3\"/><circle stroke=\"#primary\" cx=\"13\" cy=\"2\" r=\"2\"/><circle stroke=\"#secondary\" cx=\"35\" cy=\"44\" r=\"2\"/><circle stroke=\"#secondary\" cx=\"3\" cy=\"12\" r=\"2\"/><circle stroke=\"#primary\" cx=\"45\" cy=\"34\" r=\"2\"/><path d=\"M3.832 0a3 3 0 110 6 3 3 0 010-6zM8.04 10.613l2.1-.613M10.334 9.758l1.914-5.669\" stroke=\"#primary\" stroke-linecap=\"round\"/><path stroke=\"#secondary\" stroke-linecap=\"round\" d=\"M40.026 35.91l-2.025.591M35.695 41.965l1.843-5.326\"/><path d=\"M16 2h23.038a6 6 0 016 6v24.033\" stroke=\"#primary\" stroke-linecap=\"round\"/><path d=\"M32.038 44.033H9a6 6 0 01-6-6V14\" stroke=\"#secondary\" stroke-linecap=\"round\"/><path d=\"M17.533 22.154l5.113 3.22a1 1 0 01-.006 1.697l-5.113 3.17a1 1 0 01-1.527-.85V23a1 1 0 011.533-.846zm11.58-7.134v-.504a1 1 0 011.53-.85l3.845 2.397a1 1 0 01-.006 1.701l-3.846 2.358\" stroke=\"#primary\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></g>", icon:'<g transform="translate(4 5)" stroke-width="2" fill="none" fill-rule="evenodd"><g stroke-linecap="round" stroke-linejoin="round"><path stroke="#primary" d="M26.478 22l.696 2.087 3.478.696v2.782l-3.478 1.392-.696 1.39 1.392 3.48-1.392 1.39L23 33.827l-1.391.695L20.217 38h-2.782l-1.392-3.478-1.39-.696-3.48 1.391-1.39-1.39 1.39-3.48-.695-1.39L7 27.565v-2.782l3.478-1.392.696-1.391-1.391-3.478 1.39-1.392 3.48 1.392 1.39-.696 1.392-3.478h2.782l1.392 3.478 1.391.696 3.478-1.392 1.392 1.392z"/><path stroke="#secondary" d="M24.779 12.899l-1.475-2.212 1.475-1.475 2.95 1.475 1.474-.738.737-2.934h2.212l.737 2.934 1.475.738 2.95-1.475 1.474 1.475-1.475 2.949.738 1.475 2.949.737v2.212l-2.95.737-.737 1.475 1.475 2.949-1.475 1.475-2.949-1.475"/></g><path stroke="#primary" stroke-linecap="round" d="M5.932 5.546l7.082 6.931"/><path stroke="#secondary" stroke-linecap="round" d="M32.959 31.99l8.728 8.532"/><circle stroke="#secondary" cx="44" cy="43" r="3"/><circle stroke="#primary" cx="13" cy="2" r="2"/><circle stroke="#secondary" cx="35" cy="44" r="2"/><circle stroke="#secondary" cx="3" cy="12" r="2"/><circle stroke="#primary" cx="45" cy="34" r="2"/><path d="M3.832 0a3 3 0 110 6 3 3 0 010-6zM8.04 10.613l2.1-.613M10.334 9.758l1.914-5.669" stroke="#primary" stroke-linecap="round"/><path stroke="#secondary" stroke-linecap="round" d="M40.026 35.91l-2.025.591M35.695 41.965l1.843-5.326"/><path d="M16 2h23.038a6 6 0 016 6v24.033" stroke="#primary" stroke-linecap="round"/><path d="M32.038 44.033H9a6 6 0 01-6-6V14" stroke="#secondary" stroke-linecap="round"/><path d="M17.533 22.154l5.113 3.22a1 1 0 01-.006 1.697l-5.113 3.17a1 1 0 01-1.527-.85V23a1 1 0 011.533-.846zm11.58-7.134v-.504a1 1 0 011.53-.85l3.845 2.397a1 1 0 01-.006 1.701l-3.846 2.358" stroke="#primary" stroke-linecap="round" stroke-linejoin="round"/></g>',
rank:value ? "$" : "X", progress:value ? 1 : 0, value, unlock:new Date(unlock?.createdAt), rank:value ? "$" : "X",
progress:value ? 1 : 0,
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -263,8 +303,11 @@
list.push({ list.push({
title:"Infographile", title:"Infographile",
text:"Fervent supporter of metrics", text:"Fervent supporter of metrics",
icon:"<g stroke-linejoin=\"round\" stroke-width=\"2\" fill=\"none\" fill-rule=\"evenodd\"><g stroke=\"#secondary\" stroke-linecap=\"round\"><path d=\"M22 31h20M22 36h10\"/></g><path d=\"M44.05 36.013a8 8 0 110 16 8 8 0 010-16z\" stroke=\"#primary\" stroke-linecap=\"round\"/><path d=\"M32 43H7c-1.228 0-2-.84-2-2V7c0-1.16.772-2 2-2h7.075M47 24.04V32\" stroke=\"#secondary\" stroke-linecap=\"round\"/><path stroke=\"#primary\" stroke-linecap=\"round\" d=\"M47.015 42.017l-4 3.994-2.001-1.995\"/><path stroke=\"#secondary\" d=\"M11 31h5v5h-5z\"/><path d=\"M11 14a2 2 0 012-2m28 12a2 2 0 01-2 2h-1m-5 0h-4m-6 0h-4m-5 0h-1a2 2 0 01-2-2m0-4v-2\" stroke=\"#secondary\" stroke-linecap=\"round\"/><path d=\"M18 18V7c0-1.246.649-2 1.73-2h28.54C49.351 5 50 5.754 50 7v11c0 1.246-.649 2-1.73 2H19.73c-1.081 0-1.73-.754-1.73-2z\" stroke=\"#primary\" stroke-linecap=\"round\"/><path stroke=\"#primary\" stroke-linecap=\"round\" d=\"M22 13h4l2-3 3 5 2-2h3.052l2.982-4 3.002 4H46\"/></g>", icon:'<g stroke-linejoin="round" stroke-width="2" fill="none" fill-rule="evenodd"><g stroke="#secondary" stroke-linecap="round"><path d="M22 31h20M22 36h10"/></g><path d="M44.05 36.013a8 8 0 110 16 8 8 0 010-16z" stroke="#primary" stroke-linecap="round"/><path d="M32 43H7c-1.228 0-2-.84-2-2V7c0-1.16.772-2 2-2h7.075M47 24.04V32" stroke="#secondary" stroke-linecap="round"/><path stroke="#primary" stroke-linecap="round" d="M47.015 42.017l-4 3.994-2.001-1.995"/><path stroke="#secondary" d="M11 31h5v5h-5z"/><path d="M11 14a2 2 0 012-2m28 12a2 2 0 01-2 2h-1m-5 0h-4m-6 0h-4m-5 0h-1a2 2 0 01-2-2m0-4v-2" stroke="#secondary" stroke-linecap="round"/><path d="M18 18V7c0-1.246.649-2 1.73-2h28.54C49.351 5 50 5.754 50 7v11c0 1.246-.649 2-1.73 2H19.73c-1.081 0-1.73-.754-1.73-2z" stroke="#primary" stroke-linecap="round"/><path stroke="#primary" stroke-linecap="round" d="M22 13h4l2-3 3 5 2-2h3.052l2.982-4 3.002 4H46"/></g>',
rank:(value)&&(login === _login) ? "$" : "X", progress:(value)&&(login === _login) ? 1 : 0, value, unlock:new Date(unlock?.createdAt), rank:(value) && (login === _login) ? "$" : "X",
progress:(value) && (login === _login) ? 1 : 0,
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
@@ -276,9 +319,11 @@
list.push({ list.push({
title:"Octonaut", title:"Octonaut",
text:"Following octocat", text:"Following octocat",
icon:"<g fill=\"none\" fill-rule=\"evenodd\"><path d=\"M14.7 8c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zm26 0c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zM28.021 5c.318 1.122.574 1.372 1.711 1.678-1.136.314-1.389.566-1.7 1.69-.317-1.121-.572-1.372-1.71-1.679 1.135-.313 1.39-.566 1.7-1.689z\" stroke=\"#primary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><g transform=\"translate(4 9)\" fill-rule=\"nonzero\"><path d=\"M14.05 9.195C10.327 7.065 7.46 6 5.453 6 4.92 6 4 6.164 3.5 6.653s-.572.741-.711 1.14c-.734 2.1-1.562 6.317.078 9.286-8.767 25.38 15.513 24.92 21.207 24.92 5.695 0 29.746.456 21.037-24.908 1.112-2.2 1.404-5.119.121-9.284-.863-2.802-4.646-2.341-11.35 1.384a27.38 27.38 0 00-9.802-1.81c-3.358 0-6.701.605-10.03 1.814z\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><path d=\"M10.323 40.074c-2.442-1.02-2.93-3.308-2.93-4.834 0-1.527.488-2.45.976-3.92.489-1.47.391-2.281-.976-5.711-1.368-3.43.976-7.535 4.884-7.535 3.908 0 7.088 3.005 11.723 2.956m0 0c4.635.05 7.815-2.956 11.723-2.956 3.908 0 6.252 4.105 4.884 7.535-1.367 3.43-1.465 4.241-.976 5.71.488 1.47.976 2.394.976 3.92 0 1.527-.488 3.816-2.93 4.835\" stroke=\"#secondary\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle fill=\"#primary\" cx=\"12\" cy=\"30\" r=\"1\"/><circle fill=\"#primary\" cx=\"13\" cy=\"28\" r=\"1\"/><circle fill=\"#primary\" cx=\"15\" cy=\"28\" r=\"1\"/><circle fill=\"#primary\" cx=\"23\" cy=\"35\" r=\"1\"/><circle fill=\"#primary\" cx=\"25\" cy=\"35\" r=\"1\"/><circle fill=\"#primary\" cx=\"17\" cy=\"28\" r=\"1\"/><circle fill=\"#primary\" cx=\"31\" cy=\"28\" r=\"1\"/><circle fill=\"#primary\" cx=\"33\" cy=\"28\" r=\"1\"/><circle fill=\"#primary\" cx=\"35\" cy=\"28\" r=\"1\"/><circle fill=\"#primary\" cx=\"12\" cy=\"32\" r=\"1\"/><circle fill=\"#primary\" cx=\"19\" cy=\"30\" r=\"1\"/><circle fill=\"#primary\" cx=\"19\" cy=\"32\" r=\"1\"/><circle fill=\"#primary\" cx=\"29\" cy=\"30\" r=\"1\"/><circle fill=\"#primary\" cx=\"29\" cy=\"32\" r=\"1\"/><circle fill=\"#primary\" cx=\"36\" cy=\"30\" r=\"1\"/><circle fill=\"#primary\" cx=\"36\" cy=\"32\" r=\"1\"/></g></g>", icon:'<g fill="none" fill-rule="evenodd"><path d="M14.7 8c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zm26 0c.316 1.122.572 1.372 1.71 1.678-1.136.314-1.39.566-1.7 1.69-.317-1.121-.573-1.372-1.71-1.679 1.135-.313 1.389-.566 1.7-1.689zM28.021 5c.318 1.122.574 1.372 1.711 1.678-1.136.314-1.389.566-1.7 1.69-.317-1.121-.572-1.372-1.71-1.679 1.135-.313 1.39-.566 1.7-1.689z" stroke="#primary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><g transform="translate(4 9)" fill-rule="nonzero"><path d="M14.05 9.195C10.327 7.065 7.46 6 5.453 6 4.92 6 4 6.164 3.5 6.653s-.572.741-.711 1.14c-.734 2.1-1.562 6.317.078 9.286-8.767 25.38 15.513 24.92 21.207 24.92 5.695 0 29.746.456 21.037-24.908 1.112-2.2 1.404-5.119.121-9.284-.863-2.802-4.646-2.341-11.35 1.384a27.38 27.38 0 00-9.802-1.81c-3.358 0-6.701.605-10.03 1.814z" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10.323 40.074c-2.442-1.02-2.93-3.308-2.93-4.834 0-1.527.488-2.45.976-3.92.489-1.47.391-2.281-.976-5.711-1.368-3.43.976-7.535 4.884-7.535 3.908 0 7.088 3.005 11.723 2.956m0 0c4.635.05 7.815-2.956 11.723-2.956 3.908 0 6.252 4.105 4.884 7.535-1.367 3.43-1.465 4.241-.976 5.71.488 1.47.976 2.394.976 3.92 0 1.527-.488 3.816-2.93 4.835" stroke="#secondary" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><circle fill="#primary" cx="12" cy="30" r="1"/><circle fill="#primary" cx="13" cy="28" r="1"/><circle fill="#primary" cx="15" cy="28" r="1"/><circle fill="#primary" cx="23" cy="35" r="1"/><circle fill="#primary" cx="25" cy="35" r="1"/><circle fill="#primary" cx="17" cy="28" r="1"/><circle fill="#primary" cx="31" cy="28" r="1"/><circle fill="#primary" cx="33" cy="28" r="1"/><circle fill="#primary" cx="35" cy="28" r="1"/><circle fill="#primary" cx="12" cy="32" r="1"/><circle fill="#primary" cx="19" cy="30" r="1"/><circle fill="#primary" cx="19" cy="32" r="1"/><circle fill="#primary" cx="29" cy="30" r="1"/><circle fill="#primary" cx="29" cy="32" r="1"/><circle fill="#primary" cx="36" cy="30" r="1"/><circle fill="#primary" cx="36" cy="32" r="1"/></g></g>',
rank:(value)&&(login === _login) ? "$" : "X", progress:(value)&&(login === _login) ? 1 : 0, value, unlock:new Date(unlock?.createdAt), rank:(value) && (login === _login) ? "$" : "X",
progress:(value) && (login === _login) ? 1 : 0,
value,
unlock:new Date(unlock?.createdAt),
}) })
} }
} }

View File

@@ -27,7 +27,8 @@
console.debug(`metrics/compute/${login}/plugins > activity > ${events.length} events loaded`) console.debug(`metrics/compute/${login}/plugins > activity > ${events.length} events loaded`)
//Extract activity events //Extract activity events
const activity = (await Promise.all(events const activity = (await Promise.all(
events
.filter(({actor}) => account === "organization" ? true : actor.login === login) .filter(({actor}) => account === "organization" ? true : actor.login === login)
.filter(({created_at}) => Number.isFinite(days) ? new Date(created_at) > new Date(Date.now() - days * 24 * 60 * 60 * 1000) : true) .filter(({created_at}) => Number.isFinite(days) ? new Date(created_at) > new Date(Date.now() - days * 24 * 60 * 60 * 1000) : true)
.filter(event => visibility === "public" ? event.public : true) .filter(event => visibility === "public" ? event.public : true)
@@ -133,7 +134,8 @@
return null return null
} }
} }
}))) }),
))
.filter(event => event) .filter(event => event)
.filter(event => filter.includes("all") || filter.includes(event.type)) .filter(event => filter.includes("all") || filter.includes(event.type))
.slice(0, limit) .slice(0, limit)

View File

@@ -138,7 +138,11 @@
const {progress, score:userScore, media:{title, description, status, startDate:{year:release}, genres, averageScore, episodes, chapters, type, coverImage:{medium:artwork}}} = media const {progress, score:userScore, media:{title, description, status, startDate:{year:release}, genres, averageScore, episodes, chapters, type, coverImage:{medium:artwork}}} = media
return { return {
name:title.romaji, name:title.romaji,
type, status, release, genres, progress, type,
status,
release,
genres,
progress,
description:description.replace(/<br\s*\\?>/g, " "), description:description.replace(/<br\s*\\?>/g, " "),
scores:{user:userScore, community:averageScore}, scores:{user:userScore, community:averageScore},
released:type === "ANIME" ? episodes : chapters, released:type === "ANIME" ? episodes : chapters,

View File

@@ -37,9 +37,13 @@
//Retrieve edited files and filter edited lines (those starting with +/-) from patches //Retrieve edited files and filter edited lines (those starting with +/-) from patches
console.debug(`metrics/compute/${login}/plugins > habits > loading patches`) console.debug(`metrics/compute/${login}/plugins > habits > loading patches`)
const patches = [...await Promise.allSettled(commits const patches = [
...await Promise.allSettled(
commits
.flatMap(({payload}) => payload.commits).map(commit => commit.url) .flatMap(({payload}) => payload.commits).map(commit => commit.url)
.map(async commit => (await rest.request(commit)).data.files))] .map(async commit => (await rest.request(commit)).data.files),
),
]
.filter(({status}) => status === "fulfilled") .filter(({status}) => status === "fulfilled")
.map(({value}) => value) .map(({value}) => value)
.flatMap(files => files.map(file => ({name:imports.paths.basename(file.filename), patch:file.patch ?? ""}))) .flatMap(files => files.map(file => ({name:imports.paths.basename(file.filename), patch:file.patch ?? ""})))
@@ -108,6 +112,7 @@
} }
else else
console.debug(`metrics/compute/${login}/plugins > habits > linguist not available`) console.debug(`metrics/compute/${login}/plugins > habits > linguist not available`)
} }
//Results //Results

View File

@@ -56,13 +56,16 @@
let i = 0, j = 0 let i = 0, j = 0
let svg = ` let svg = `
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" style="margin-top: -52px;" viewBox="0,0 480,${duration === "full-year" ? 270 : 170}"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" style="margin-top: -52px;" viewBox="0,0 480,${duration === "full-year" ? 270 : 170}">
${[1, 2].map(k => ` ${
[1, 2].map(k => `
<filter id="brightness${k}"> <filter id="brightness${k}">
<feComponentTransfer> <feComponentTransfer>
${[..."RGB"].map(channel => `<feFunc${channel} type="linear" slope="${1 - k * 0.4}" />`).join("")} ${[..."RGB"].map(channel => `<feFunc${channel} type="linear" slope="${1 - k * 0.4}" />`).join("")}
</feComponentTransfer> </feComponentTransfer>
</filter>`) </filter>`
.join("")} )
.join("")
}
<g transform="scale(4) translate(12, 0)">` <g transform="scale(4) translate(12, 0)">`
//Iterate through weeks //Iterate through weeks
for (const week of calendar.weeks) { for (const week of calendar.weeks) {

View File

@@ -43,12 +43,17 @@
//Create configuration file if needed //Create configuration file if needed
if (!(await imports.fs.stat(imports.paths.join(path, ".licensed.yml")).then(() => 1).catch(() => 0))) { if (!(await imports.fs.stat(imports.paths.join(path, ".licensed.yml")).then(() => 1).catch(() => 0))) {
console.debug(`metrics/compute/${login}/plugins > licenses > building .licensed.yml configuration file`) console.debug(`metrics/compute/${login}/plugins > licenses > building .licensed.yml configuration file`)
await imports.fs.writeFile(imports.paths.join(path, ".licensed.yml"), [ await imports.fs.writeFile(
imports.paths.join(path, ".licensed.yml"),
[
"cache_path: .licensed", "cache_path: .licensed",
].join("\n")) ].join("\n"),
)
} }
else else
console.debug(`metrics/compute/${login}/plugins > licenses > a .licensed.yml configuration file already exists`) console.debug(`metrics/compute/${login}/plugins > licenses > a .licensed.yml configuration file already exists`)
//Spawn licensed process //Spawn licensed process
console.debug(`metrics/compute/${login}/plugins > licenses > running licensed`) console.debug(`metrics/compute/${login}/plugins > licenses > running licensed`)
JSON.parse(await imports.run("licensed list --format=json --licenses", {cwd:path})).apps JSON.parse(await imports.run("licensed list --format=json --licenses", {cwd:path})).apps
@@ -57,7 +62,9 @@
result.dependencies.push(dependency) result.dependencies.push(dependency)
result.known += (license in licenses) result.known += (license in licenses)
result.unknown += !(license in licenses) result.unknown += !(license in licenses)
}))) })
)
)
//Cleaning //Cleaning
console.debug(`metrics/compute/${login}/plugins > licensed > cleaning temp dir ${path}`) console.debug(`metrics/compute/${login}/plugins > licensed > cleaning temp dir ${path}`)
await imports.fs.rmdir(path, {recursive:true}) await imports.fs.rmdir(path, {recursive:true})
@@ -65,6 +72,7 @@
else else
console.debug(`metrics/compute/${login}/plugins > licenses > licensed not available`) console.debug(`metrics/compute/${login}/plugins > licenses > licensed not available`)
//List licenses properties //List licenses properties
console.debug(`metrics/compute/${login}/plugins > licenses > compute licenses properties`) console.debug(`metrics/compute/${login}/plugins > licenses > compute licenses properties`)
const base = {permissions:new Set(), limitations:new Set(), conditions:new Set()} const base = {permissions:new Set(), limitations:new Set(), conditions:new Set()}
@@ -89,7 +97,10 @@
console.debug(`metrics/compute/${login}/plugins > licenses > computing ratio`) console.debug(`metrics/compute/${login}/plugins > licenses > computing ratio`)
const total = Object.values(used).reduce((a, b) => a + b, 0) const total = Object.values(used).reduce((a, b) => a + b, 0)
//Format used licenses and compute positions //Format used licenses and compute positions
const list = Object.entries(used).map(([key, count]) => ({name:licenses[key]?.spdxId ?? `${key.charAt(0).toLocaleUpperCase()}${key.substring(1)}`, key, count, value:count/total, x:0, color:licenses[key]?.color ?? "#6e7681", order:licenses[key]?.order ?? -1})).sort((a, b) => a.order === b.order ? b.count - a.count : b.order - a.order) const list = Object.entries(used).map(([key, count]) => ({name:licenses[key]?.spdxId ?? `${key.charAt(0).toLocaleUpperCase()}${key.substring(1)}`, key, count, value:count / total, x:0, color:licenses[key]?.color ?? "#6e7681", order:licenses[key]?.order ?? -1})).sort((
a,
b,
) => a.order === b.order ? b.count - a.count : b.order - a.order)
for (let i = 0; i < list.length; i++) for (let i = 0; i < list.length; i++)
list[i].x = (list[i - 1]?.x ?? 0) + (list[i - 1]?.value ?? 0) list[i].x = (list[i - 1]?.x ?? 0) + (list[i - 1]?.value ?? 0)
//Save ratios //Save ratios

View File

@@ -44,4 +44,3 @@
throw {error:{message:"An error occured", instance:error}} throw {error:{message:"An error occured", instance:error}}
} }
} }

View File

@@ -86,23 +86,29 @@
case "apple": { case "apple": {
//Parse tracklist //Parse tracklist
await frame.waitForSelector(".tracklist.playlist") await frame.waitForSelector(".tracklist.playlist")
tracks = [...await frame.evaluate(() => [...document.querySelectorAll(".tracklist li")].map(li => ({ tracks = [
...await frame.evaluate(() => [...document.querySelectorAll(".tracklist li")].map(li => ({
name:li.querySelector(".tracklist__track__name").innerText, name:li.querySelector(".tracklist__track__name").innerText,
artist:li.querySelector(".tracklist__track__sub").innerText, artist:li.querySelector(".tracklist__track__sub").innerText,
artwork:li.querySelector(".tracklist__track__artwork img").src, artwork:li.querySelector(".tracklist__track__artwork img").src,
})))] }))
),
]
break break
} }
//Spotify //Spotify
case "spotify": { case "spotify": {
//Parse tracklist //Parse tracklist
await frame.waitForSelector("table") await frame.waitForSelector("table")
tracks = [...await frame.evaluate(() => [...document.querySelectorAll("table tr")].map(tr => ({ tracks = [
...await frame.evaluate(() => [...document.querySelectorAll("table tr")].map(tr => ({
name:tr.querySelector("td:nth-child(2) div div:nth-child(1)").innerText, name:tr.querySelector("td:nth-child(2) div div:nth-child(1)").innerText,
artist:tr.querySelector("td:nth-child(2) div div:nth-child(2)").innerText, artist:tr.querySelector("td:nth-child(2) div div:nth-child(2)").innerText,
//Spotify doesn't provide artworks so we fallback on playlist artwork instead //Spotify doesn't provide artworks so we fallback on playlist artwork instead
artwork:window.getComputedStyle(document.querySelector("button[title=Play]").parentNode, null).backgroundImage.match(/^url\("(?<url>https:...+)"\)$/)?.groups?.url ?? null, artwork:window.getComputedStyle(document.querySelector("button[title=Play]").parentNode, null).backgroundImage.match(/^url\("(?<url>https:...+)"\)$/)?.groups?.url ?? null,
})))] }))
),
]
break break
} }
//Unsupported //Unsupported
@@ -136,9 +142,11 @@
try { try {
//Request access token //Request access token
console.debug(`metrics/compute/${login}/plugins > music > requesting access token with spotify refresh token`) console.debug(`metrics/compute/${login}/plugins > music > requesting access token with spotify refresh token`)
const {data:{access_token:access}} = await imports.axios.post("https://accounts.spotify.com/api/token", `${new imports.url.URLSearchParams({grant_type:"refresh_token", refresh_token, client_id, client_secret})}`, {headers:{ const {data:{access_token:access}} = await imports.axios.post("https://accounts.spotify.com/api/token", `${new imports.url.URLSearchParams({grant_type:"refresh_token", refresh_token, client_id, client_secret})}`, {
headers:{
"Content-Type":"application/x-www-form-urlencoded", "Content-Type":"application/x-www-form-urlencoded",
}}) },
})
console.debug(`metrics/compute/${login}/plugins > music > got access token`) console.debug(`metrics/compute/${login}/plugins > music > got access token`)
//Retrieve tracks //Retrieve tracks
console.debug(`metrics/compute/${login}/plugins > music > querying spotify api`) console.debug(`metrics/compute/${login}/plugins > music > querying spotify api`)
@@ -146,11 +154,13 @@
for (let hours = .5; hours <= 24; hours++) { for (let hours = .5; hours <= 24; hours++) {
//Load track half-hour by half-hour //Load track half-hour by half-hour
const timestamp = Date.now() - hours * 60 * 60 * 1000 const timestamp = Date.now() - hours * 60 * 60 * 1000
const loaded = (await imports.axios.get(`https://api.spotify.com/v1/me/player/recently-played?after=${timestamp}`, {headers:{ const loaded = (await imports.axios.get(`https://api.spotify.com/v1/me/player/recently-played?after=${timestamp}`, {
headers:{
"Content-Type":"application/json", "Content-Type":"application/json",
Accept:"application/json", Accept:"application/json",
Authorization:`Bearer ${access}`, Authorization:`Bearer ${access}`,
}})).data.items.map(({track, played_at}) => ({ },
})).data.items.map(({track, played_at}) => ({
name:track.name, name:track.name,
artist:track.artists[0].name, artist:track.artists[0].name,
artwork:track.album.images[0].url, artwork:track.album.images[0].url,
@@ -184,10 +194,12 @@
//API call and parse tracklist //API call and parse tracklist
try { try {
console.debug(`metrics/compute/${login}/plugins > music > querying lastfm api`) console.debug(`metrics/compute/${login}/plugins > music > querying lastfm api`)
tracks = (await imports.axios.get(`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${user}&api_key=${token}&limit=${limit}&format=json`, {headers:{ tracks = (await imports.axios.get(`https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&user=${user}&api_key=${token}&limit=${limit}&format=json`, {
headers:{
"User-Agent":"lowlighter/metrics", "User-Agent":"lowlighter/metrics",
Accept:"application/json", Accept:"application/json",
}})).data.recenttracks.track.map(track => ({ },
})).data.recenttracks.track.map(track => ({
name:track.name, name:track.name,
artist:track.artist["#text"], artist:track.artist["#text"],
artwork:track.image.reverse()[0]["#text"], artwork:track.image.reverse()[0]["#text"],

View File

@@ -9,11 +9,16 @@
//Load inputs //Load inputs
let {url, datapoints, lowalert, highalert, urgentlowalert, urgenthighalert} = imports.metadata.plugins.nightscout.inputs({data, account, q}) let {url, datapoints, lowalert, highalert, urgentlowalert, urgenthighalert} = imports.metadata.plugins.nightscout.inputs({data, account, q})
if (!url || url === "https://example.herokuapp.com") throw {error:{message:"Nightscout site URL isn't set!"}} if (!url || url === "https://example.herokuapp.com")
if (url.substring(url.length - 1) !== "/") url += "/" throw {error:{message:"Nightscout site URL isn't set!"}}
if (url.substring(0, 7) === "http://") url = `https://${url.substring(7)}` if (url.substring(url.length - 1) !== "/")
if (url.substring(0, 8) !== "https://") url = `https://${url}` url += "/"
if (datapoints <= 0) datapoints = 1 if (url.substring(0, 7) === "http://")
url = `https://${url.substring(7)}`
if (url.substring(0, 8) !== "https://")
url = `https://${url}`
if (datapoints <= 0)
datapoints = 1
//Get nightscout data from axios //Get nightscout data from axios
const resp = await imports.axios.get(`${url}api/v1/entries.json?count=${datapoints}`) const resp = await imports.axios.get(`${url}api/v1/entries.json?count=${datapoints}`)
for (let i = 0; i < resp.data.length; i++) { for (let i = 0; i < resp.data.length; i++) {

View File

@@ -53,9 +53,11 @@
do { do {
console.debug(`metrics/compute/${login}/plugins > people > retrieving ${type} after ${cursor}`) console.debug(`metrics/compute/${login}/plugins > people > retrieving ${type} after ${cursor}`)
const {[type]:{edges}} = ( const {[type]:{edges}} = (
type in context.sponsorships ? (await graphql(queries.people.sponsors({login:context.owner ?? login, type, size, after:cursor ? `after: "${cursor}"` : "", target:context.sponsorships[type], account})))[account] : type in context.sponsorships
context.mode === "repository" ? (await graphql(queries.people.repository({login:context.owner, repository:context.repo, type, size, after:cursor ? `after: "${cursor}"` : "", account})))[account].repository : ? (await graphql(queries.people.sponsors({login:context.owner ?? login, type, size, after:cursor ? `after: "${cursor}"` : "", target:context.sponsorships[type], account})))[account]
(await graphql(queries.people({login, type, size, after:cursor ? `after: "${cursor}"` : "", account})))[account] : context.mode === "repository"
? (await graphql(queries.people.repository({login:context.owner, repository:context.repo, type, size, after:cursor ? `after: "${cursor}"` : "", account})))[account].repository
: (await graphql(queries.people({login, type, size, after:cursor ? `after: "${cursor}"` : "", account})))[account]
) )
cursor = edges?.[edges?.length - 1]?.cursor cursor = edges?.[edges?.length - 1]?.cursor
result[type].push(...edges.map(({node}) => node[context.sponsorships[type]] ?? node)) result[type].push(...edges.map(({node}) => node[context.sponsorships[type]] ?? node))

View File

@@ -23,7 +23,9 @@
} }
//Hashnode //Hashnode
case "hashnode": { case "hashnode": {
posts = (await imports.axios.post("https://api.hashnode.com", {query:queries.posts.hashnode({user})}, {headers:{"Content-type":"application/json"}})).data.data.user.publication.posts.map(({title, brief:description, dateAdded:date, coverImage:image, slug}) => ({title, description, date, image, link:`https://hashnode.com/post/${slug}`})) posts = (await imports.axios.post("https://api.hashnode.com", {query:queries.posts.hashnode({user})}, {headers:{"Content-type":"application/json"}})).data.data.user.publication.posts.map((
{title, brief:description, dateAdded:date, coverImage:image, slug},
) => ({title, description, date, image, link:`https://hashnode.com/post/${slug}`}))
link = `https://hashnode.com/@${user}` link = `https://hashnode.com/@${user}`
break break
} }

View File

@@ -1,4 +1,3 @@
//Setup //Setup
export default async function({login, q, imports, data, account}, {enabled = false} = {}) { export default async function({login, q, imports, data, account}, {enabled = false} = {}) {
//Plugin execution //Plugin execution

View File

@@ -45,5 +45,3 @@
throw {error:{message:"An error occured", instance:error}} throw {error:{message:"An error occured", instance:error}}
} }
} }

View File

@@ -80,7 +80,19 @@
}, },
/**Format answers */ /**Format answers */
async answer({body_markdown:body, score, up_vote_count:upvotes, down_vote_count:downvotes, is_accepted:accepted, comment_count:comments = 0, creation_date, owner:{display_name:author}, link, answer_id:id, question_id}, {imports, data, codelines}) { async answer({body_markdown:body, score, up_vote_count:upvotes, down_vote_count:downvotes, is_accepted:accepted, comment_count:comments = 0, creation_date, owner:{display_name:author}, link, answer_id:id, question_id}, {imports, data, codelines}) {
const formatted = {type:"answer", body:await imports.markdown(format.code(imports.htmlunescape(body)), {codelines}), score, upvotes, downvotes, accepted, comments, author, created:imports.date(creation_date*1000, {dateStyle:"short", timeZone:data.config.timezone?.name}), link, id, question_id, const formatted = {
type:"answer",
body:await imports.markdown(format.code(imports.htmlunescape(body)), {codelines}),
score,
upvotes,
downvotes,
accepted,
comments,
author,
created:imports.date(creation_date * 1000, {dateStyle:"short", timeZone:data.config.timezone?.name}),
link,
id,
question_id,
get question() { get question() {
return format.cached.get(`q${this.question_id}`) ?? null return format.cached.get(`q${this.question_id}`) ?? null
}, },
@@ -89,8 +101,45 @@
return formatted return formatted
}, },
/**Format questions */ /**Format questions */
async question({title, body_markdown:body, score, up_vote_count:upvotes, down_vote_count:downvotes, favorite_count:favorites, tags, is_answered:answered, answer_count:answers, comment_count:comments, view_count:views, creation_date, owner:{display_name:author}, link, question_id:id, accepted_answer_id = null}, {imports, data, codelines}) { async question(
const formatted = {type:"question", title:await imports.markdown(title), body:await imports.markdown(format.code(imports.htmlunescape(body)), {codelines}), score, upvotes, downvotes, favorites, tags, answered, answers, comments, views, author, created:imports.date(creation_date*1000, {dateStyle:"short", timeZone:data.config.timezone?.name}), link, id, accepted_answer_id, {
title,
body_markdown:body,
score,
up_vote_count:upvotes,
down_vote_count:downvotes,
favorite_count:favorites,
tags,
is_answered:answered,
answer_count:answers,
comment_count:comments,
view_count:views,
creation_date,
owner:{display_name:author},
link,
question_id:id,
accepted_answer_id = null,
},
{imports, data, codelines},
) {
const formatted = {
type:"question",
title:await imports.markdown(title),
body:await imports.markdown(format.code(imports.htmlunescape(body)), {codelines}),
score,
upvotes,
downvotes,
favorites,
tags,
answered,
answers,
comments,
views,
author,
created:imports.date(creation_date * 1000, {dateStyle:"short", timeZone:data.config.timezone?.name}),
link,
id,
accepted_answer_id,
get answer() { get answer() {
return format.cached.get(`a${this.accepted_answer_id}`) ?? null return format.cached.get(`a${this.accepted_answer_id}`) ?? null
}, },

View File

@@ -33,10 +33,14 @@
await page.goto(`https://github.community/u/${login}/summary`) await page.goto(`https://github.community/u/${login}/summary`)
const frame = page.mainFrame() const frame = page.mainFrame()
await frame.waitForSelector(".stats-section") await frame.waitForSelector(".stats-section")
Object.assign(result.stats, Object.fromEntries((await frame.evaluate(() => [...document.querySelectorAll(".stats-section li")].map(el => [ Object.assign(
result.stats,
Object.fromEntries(
(await frame.evaluate(() => [...document.querySelectorAll(".stats-section li")].map(el => [
el.querySelector(".label").innerText.trim().toLocaleLowerCase(), el.querySelector(".label").innerText.trim().toLocaleLowerCase(),
el.querySelector(".value").innerText.trim().toLocaleLowerCase(), el.querySelector(".value").innerText.trim().toLocaleLowerCase(),
]))).map(([key, value]) => { ])
)).map(([key, value]) => {
switch (true) { switch (true) {
case /solutions?/.test(key): case /solutions?/.test(key):
return ["solutions", Number(value)] return ["solutions", Number(value)]
@@ -49,7 +53,9 @@
default: default:
return null return null
} }
}).filter(kv => kv))) }).filter(kv => kv),
),
)
} }
//Badges //Badges

View File

@@ -30,7 +30,8 @@
name:li.querySelector(".f3").innerText, name:li.querySelector(".f3").innerText,
description:li.querySelector(".f5").innerText, description:li.querySelector(".f5").innerText,
icon:li.querySelector("img")?.src ?? null, icon:li.querySelector("img")?.src ?? null,
}))) }))
)
console.debug(`metrics/compute/${login}/plugins > topics > extracted ${starred.length} starred topics`) console.debug(`metrics/compute/${login}/plugins > topics > extracted ${starred.length} starred topics`)
//Check if next page exists //Check if next page exists
if (!starred.length) { if (!starred.length) {

View File

@@ -21,7 +21,10 @@
//Load tweets //Load tweets
console.debug(`metrics/compute/${login}/plugins > tweets > querying api`) console.debug(`metrics/compute/${login}/plugins > tweets > querying api`)
const {data:{data:tweets = [], includes:{media = []} = {}}} = await imports.axios.get(`https://api.twitter.com/2/tweets/search/recent?query=from:${username}&tweet.fields=created_at,entities&media.fields=preview_image_url,url,type&expansions=entities.mentions.username,attachments.media_keys`, {headers:{Authorization:`Bearer ${token}`}}) const {data:{data:tweets = [], includes:{media = []} = {}}} = await imports.axios.get(
`https://api.twitter.com/2/tweets/search/recent?query=from:${username}&tweet.fields=created_at,entities&media.fields=preview_image_url,url,type&expansions=entities.mentions.username,attachments.media_keys`,
{headers:{Authorization:`Bearer ${token}`}},
)
const medias = new Map(media.map(({media_key, type, url, preview_image_url}) => [media_key, (type === "photo") || (type === "animated_gif") ? url : type === "video" ? preview_image_url : null])) const medias = new Map(media.map(({media_key, type, url, preview_image_url}) => [media_key, (type === "photo") || (type === "animated_gif") ? url : type === "video" ? preview_image_url : null]))
//Limit tweets //Limit tweets
@@ -57,10 +60,13 @@
} }
else else
tweet.text = `${tweet.text}\n${linked}` tweet.text = `${tweet.text}\n${linked}`
} }
} }
else else
tweet.attachments = null tweet.attachments = null
//Format text //Format text
console.debug(`metrics/compute/${login}/plugins > tweets > formatting tweet ${tweet.id}`) console.debug(`metrics/compute/${login}/plugins > tweets > formatting tweet ${tweet.id}`)
tweet.createdAt = `${imports.date(tweet.created_at, {timeStyle:"short", timeZone:data.config.timezone?.name})} on ${imports.date(tweet.created_at, {dateStyle:"short", timeZone:data.config.timezone?.name})}` tweet.createdAt = `${imports.date(tweet.created_at, {timeStyle:"short", timeZone:data.config.timezone?.name})} on ${imports.date(tweet.created_at, {dateStyle:"short", timeZone:data.config.timezone?.name})}`
@@ -70,11 +76,16 @@
//Mentions //Mentions
.replace(new RegExp(`@(${tweet.mentions.join("|")})`, "gi"), '<span class="mention">@$1</span>') .replace(new RegExp(`@(${tweet.mentions.join("|")})`, "gi"), '<span class="mention">@$1</span>')
//Hashtags (this regex comes from the twitter source code) //Hashtags (this regex comes from the twitter source code)
.replace(/(?<!&)[#|]([a-z0-9_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0100-\u024f\u0253-\u0254\u0256-\u0257\u0300-\u036f\u1e00-\u1eff\u0400-\u04ff\u0500-\u0527\u2de0-\u2dff\ua640-\ua69f\u0591-\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05d0-\u05ea\u05f0-\u05f4\ufb12-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4f\u0610-\u061a\u0620-\u065f\u066e-\u06d3\u06d5-\u06dc\u06de-\u06e8\u06ea-\u06ef\u06fa-\u06fc\u0750-\u077f\u08a2-\u08ac\u08e4-\u08fe\ufb50-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\u200c-\u200c\u0e01-\u0e3a\u0e40-\u0e4e\u1100-\u11ff\u3130-\u3185\ua960-\ua97f\uac00-\ud7af\ud7b0-\ud7ff\uffa1-\uffdc\u30a1-\u30fa\u30fc-\u30fe\uff66-\uff9f\uff10-\uff19\uff21-\uff3a\uff41-\uff5a\u3041-\u3096\u3099-\u309e\u3400-\u4dbf\u4e00-\u9fff\u20000-\u2a6df\u2a700-\u2b73f\u2b740-\u2b81f\u2f800-\u2fa1f]*[a-z_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0100-\u024f\u0253-\u0254\u0256-\u0257\u0300-\u036f\u1e00-\u1eff\u0400-\u04ff\u0500-\u0527\u2de0-\u2dff\ua640-\ua69f\u0591-\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05d0-\u05ea\u05f0-\u05f4\ufb12-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4f\u0610-\u061a\u0620-\u065f\u066e-\u06d3\u06d5-\u06dc\u06de-\u06e8\u06ea-\u06ef\u06fa-\u06fc\u0750-\u077f\u08a2-\u08ac\u08e4-\u08fe\ufb50-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\u200c-\u200c\u0e01-\u0e3a\u0e40-\u0e4e\u1100-\u11ff\u3130-\u3185\ua960-\ua97f\uac00-\ud7af\ud7b0-\ud7ff\uffa1-\uffdc\u30a1-\u30fa\u30fc-\u30fe\uff66-\uff9f\uff10-\uff19\uff21-\uff3a\uff41-\uff5a\u3041-\u3096\u3099-\u309e\u3400-\u4dbf\u4e00-\u9fff\u20000-\u2a6df\u2a700-\u2b73f\u2b740-\u2b81f\u2f800-\u2fa1f][a-z0-9_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0100-\u024f\u0253-\u0254\u0256-\u0257\u0300-\u036f\u1e00-\u1eff\u0400-\u04ff\u0500-\u0527\u2de0-\u2dff\ua640-\ua69f\u0591-\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05d0-\u05ea\u05f0-\u05f4\ufb12-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4f\u0610-\u061a\u0620-\u065f\u066e-\u06d3\u06d5-\u06dc\u06de-\u06e8\u06ea-\u06ef\u06fa-\u06fc\u0750-\u077f\u08a2-\u08ac\u08e4-\u08fe\ufb50-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\u200c-\u200c\u0e01-\u0e3a\u0e40-\u0e4e\u1100-\u11ff\u3130-\u3185\ua960-\ua97f\uac00-\ud7af\ud7b0-\ud7ff\uffa1-\uffdc\u30a1-\u30fa\u30fc-\u30fe\uff66-\uff9f\uff10-\uff19\uff21-\uff3a\uff41-\uff5a\u3041-\u3096\u3099-\u309e\u3400-\u4dbf\u4e00-\u9fff\u20000-\u2a6df\u2a700-\u2b73f\u2b740-\u2b81f\u2f800-\u2fa1f]*)/gi, ' <span class="hashtag">#$1</span> ') .replace(
/(?<!&)[#|]([a-z0-9_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0100-\u024f\u0253-\u0254\u0256-\u0257\u0300-\u036f\u1e00-\u1eff\u0400-\u04ff\u0500-\u0527\u2de0-\u2dff\ua640-\ua69f\u0591-\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05d0-\u05ea\u05f0-\u05f4\ufb12-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4f\u0610-\u061a\u0620-\u065f\u066e-\u06d3\u06d5-\u06dc\u06de-\u06e8\u06ea-\u06ef\u06fa-\u06fc\u0750-\u077f\u08a2-\u08ac\u08e4-\u08fe\ufb50-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\u200c-\u200c\u0e01-\u0e3a\u0e40-\u0e4e\u1100-\u11ff\u3130-\u3185\ua960-\ua97f\uac00-\ud7af\ud7b0-\ud7ff\uffa1-\uffdc\u30a1-\u30fa\u30fc-\u30fe\uff66-\uff9f\uff10-\uff19\uff21-\uff3a\uff41-\uff5a\u3041-\u3096\u3099-\u309e\u3400-\u4dbf\u4e00-\u9fff\u20000-\u2a6df\u2a700-\u2b73f\u2b740-\u2b81f\u2f800-\u2fa1f]*[a-z_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0100-\u024f\u0253-\u0254\u0256-\u0257\u0300-\u036f\u1e00-\u1eff\u0400-\u04ff\u0500-\u0527\u2de0-\u2dff\ua640-\ua69f\u0591-\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05d0-\u05ea\u05f0-\u05f4\ufb12-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4f\u0610-\u061a\u0620-\u065f\u066e-\u06d3\u06d5-\u06dc\u06de-\u06e8\u06ea-\u06ef\u06fa-\u06fc\u0750-\u077f\u08a2-\u08ac\u08e4-\u08fe\ufb50-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\u200c-\u200c\u0e01-\u0e3a\u0e40-\u0e4e\u1100-\u11ff\u3130-\u3185\ua960-\ua97f\uac00-\ud7af\ud7b0-\ud7ff\uffa1-\uffdc\u30a1-\u30fa\u30fc-\u30fe\uff66-\uff9f\uff10-\uff19\uff21-\uff3a\uff41-\uff5a\u3041-\u3096\u3099-\u309e\u3400-\u4dbf\u4e00-\u9fff\u20000-\u2a6df\u2a700-\u2b73f\u2b740-\u2b81f\u2f800-\u2fa1f][a-z0-9_\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u00ff\u0100-\u024f\u0253-\u0254\u0256-\u0257\u0300-\u036f\u1e00-\u1eff\u0400-\u04ff\u0500-\u0527\u2de0-\u2dff\ua640-\ua69f\u0591-\u05bf\u05c1-\u05c2\u05c4-\u05c5\u05d0-\u05ea\u05f0-\u05f4\ufb12-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4f\u0610-\u061a\u0620-\u065f\u066e-\u06d3\u06d5-\u06dc\u06de-\u06e8\u06ea-\u06ef\u06fa-\u06fc\u0750-\u077f\u08a2-\u08ac\u08e4-\u08fe\ufb50-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\u200c-\u200c\u0e01-\u0e3a\u0e40-\u0e4e\u1100-\u11ff\u3130-\u3185\ua960-\ua97f\uac00-\ud7af\ud7b0-\ud7ff\uffa1-\uffdc\u30a1-\u30fa\u30fc-\u30fe\uff66-\uff9f\uff10-\uff19\uff21-\uff3a\uff41-\uff5a\u3041-\u3096\u3099-\u309e\u3400-\u4dbf\u4e00-\u9fff\u20000-\u2a6df\u2a700-\u2b73f\u2b740-\u2b81f\u2f800-\u2fa1f]*)/gi,
' <span class="hashtag">#$1</span> ',
)
//Line breaks //Line breaks
.replace(/\n/g, "<br/>") .replace(/\n/g, "<br/>")
//Links //Links
.replace(new RegExp(`${tweet.urls.size ? "" : "noop^"}(${[...tweet.urls.keys()].map(url => `(?:${url})`).join("|")})`, "gi"), (_, url) => `<a href="${url}" class="link">${tweet.urls.get(url)}</a>`), {"&":true}) .replace(new RegExp(`${tweet.urls.size ? "" : "noop^"}(${[...tweet.urls.keys()].map(url => `(?:${url})`).join("|")})`, "gi"), (_, url) => `<a href="${url}" class="link">${tweet.urls.get(url)}</a>`),
{"&":true},
)
})) }))
//Result //Result

View File

@@ -8,9 +8,9 @@ export default async function ({ login, q, imports, data, account }, { enabled =
//Load inputs //Load inputs
let {sections, days, limit, url, user} = imports.metadata.plugins.wakatime.inputs({data, account, q}) let {sections, days, limit, url, user} = imports.metadata.plugins.wakatime.inputs({data, account, q})
if (!limit) limit = void limit if (!limit)
const range = limit = void limit
{ const range = {
"7":"last_7_days", "7":"last_7_days",
"30":"last_30_days", "30":"last_30_days",
"180":"last_6_months", "180":"last_6_months",

View File

@@ -4,7 +4,7 @@
const {repo} = q const {repo} = q
if (!repo) { if (!repo) {
console.debug(`metrics/compute/${login}/${repo} > error, repo was undefined`) console.debug(`metrics/compute/${login}/${repo} > error, repo was undefined`)
data.errors.push({error:{message:"You must pass a \"repo\" argument to use this template"}}) data.errors.push({error:{message:'You must pass a "repo" argument to use this template'}})
return imports.plugins.core(...arguments) return imports.plugins.core(...arguments)
} }
console.debug(`metrics/compute/${login}/${repo} > switching to mode ${account}`) console.debug(`metrics/compute/${login}/${repo} > switching to mode ${account}`)