feat(core): add insights output (#575)
This commit is contained in:
@@ -174,34 +174,7 @@ export default async function({mock, nosettings} = {}) {
|
||||
}
|
||||
//Compute metrics
|
||||
console.debug(`metrics/app/${login}/insights > compute insights`)
|
||||
const json = await metrics(
|
||||
{
|
||||
login,
|
||||
q:{
|
||||
template:"classic",
|
||||
achievements:true,
|
||||
"achievements.threshold":"X",
|
||||
isocalendar:true,
|
||||
"isocalendar.duration":"full-year",
|
||||
languages:true,
|
||||
"languages.limit":0,
|
||||
activity:true,
|
||||
"activity.limit":100,
|
||||
"activity.days":0,
|
||||
notable:true,
|
||||
followup:true,
|
||||
"followup.sections":"repositories, user",
|
||||
habits:true,
|
||||
"habits.from":100,
|
||||
"habits.days":7,
|
||||
"habits.facts":false,
|
||||
"habits.charts":true,
|
||||
introduction:true
|
||||
},
|
||||
},
|
||||
{graphql, rest, plugins:{achievements:{enabled:true}, isocalendar:{enabled:true}, languages:{enabled:true}, activity:{enabled:true, markdown:"extended"}, notable:{enabled:true}, followup:{enabled:true}, habits:{enabled:true}, introduction:{enabled:true}}, conf, convert:"json"},
|
||||
{Plugins, Templates},
|
||||
)
|
||||
const json = await metrics.insights({login}, {graphql, rest, conf}, {Plugins, Templates})
|
||||
//Cache
|
||||
if ((!debug) && (cached)) {
|
||||
const maxage = Math.round(Number(req.query.cache))
|
||||
@@ -286,7 +259,7 @@ export default async function({mock, nosettings} = {}) {
|
||||
conf,
|
||||
die:q["plugins.errors.fatal"] ?? 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", "insights"].includes(q["config.output"]) ? q["config.output"] : null,
|
||||
}, {Plugins, Templates})
|
||||
//Cache
|
||||
if ((!debug) && (cached)) {
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
this.palette = (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light")
|
||||
}
|
||||
catch (error) {}
|
||||
//Embed
|
||||
this.embed = !!(new URLSearchParams(location.search).get("embed"))
|
||||
//From local storage
|
||||
this.localstorage = !!(new URLSearchParams(location.search).get("localstorage"))
|
||||
//User
|
||||
const user = location.pathname.split("/").pop()
|
||||
if ((user) && (user !== "about")) {
|
||||
@@ -18,8 +22,6 @@
|
||||
else {
|
||||
this.searchable = true
|
||||
}
|
||||
//Embed
|
||||
this.embed = !!(new URLSearchParams(location.search).get("embed"))
|
||||
//Init
|
||||
await Promise.all([
|
||||
//GitHub limit tracker
|
||||
@@ -80,6 +82,10 @@
|
||||
this.error = null
|
||||
this.metrics = null
|
||||
this.pending = true
|
||||
if (this.localstorage) {
|
||||
this.metrics = JSON.parse(localStorage.getItem("local.metrics") ?? "null")
|
||||
return
|
||||
}
|
||||
this.metrics = (await axios.get(`/about/query/${this.user}`)).data
|
||||
}
|
||||
catch (error) {
|
||||
@@ -143,6 +149,7 @@
|
||||
hosted: null,
|
||||
user: "",
|
||||
embed: false,
|
||||
localstorage: false,
|
||||
searchable: false,
|
||||
requests: { limit: 0, used: 0, remaining: 0, reset: 0 },
|
||||
palette: "light",
|
||||
|
||||
Reference in New Issue
Block a user