chore: code formatting
This commit is contained in:
@@ -18,7 +18,7 @@ export default async function({sandbox = false} = {}) {
|
|||||||
//Sandbox mode
|
//Sandbox mode
|
||||||
if (sandbox) {
|
if (sandbox) {
|
||||||
console.debug("metrics/app > sandbox mode is specified, enabling advanced features")
|
console.debug("metrics/app > sandbox mode is specified, enabling advanced features")
|
||||||
Object.assign(conf.settings, {sandbox:true, optimize: true, cached:0, "plugins.default":true, extras:{default:true}})
|
Object.assign(conf.settings, {sandbox:true, optimize:true, cached:0, "plugins.default":true, extras:{default:true}})
|
||||||
}
|
}
|
||||||
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
|
||||||
const mock = sandbox || conf.settings.mocked
|
const mock = sandbox || conf.settings.mocked
|
||||||
@@ -101,7 +101,7 @@ export default async function({sandbox = false} = {}) {
|
|||||||
const {limit} = await graphql("{ limit:rateLimit {limit remaining reset:resetAt used} }")
|
const {limit} = await graphql("{ limit:rateLimit {limit remaining reset:resetAt used} }")
|
||||||
Object.assign(requests, {
|
Object.assign(requests, {
|
||||||
rest:(await rest.rateLimit.get()).data.rate,
|
rest:(await rest.rateLimit.get()).data.rate,
|
||||||
graphql:{...limit, reset:new Date(limit.reset).getTime()}
|
graphql:{...limit, reset:new Date(limit.reset).getTime()},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|||||||
@@ -96,7 +96,8 @@
|
|||||||
try {
|
try {
|
||||||
const { data: requests } = await axios.get("/.requests")
|
const { data: requests } = await axios.get("/.requests")
|
||||||
this.requests = requests
|
this.requests = requests
|
||||||
} catch {}
|
}
|
||||||
|
catch {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -150,7 +151,7 @@
|
|||||||
rlreset() {
|
rlreset() {
|
||||||
const reset = new Date(Math.max(this.requests.graphql.reset, this.requests.rest.reset))
|
const reset = new Date(Math.max(this.requests.graphql.reset, this.requests.rest.reset))
|
||||||
return `${reset.getHours()}:${reset.getMinutes()}`
|
return `${reset.getHours()}:${reset.getMinutes()}`
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
//Data initialization
|
//Data initialization
|
||||||
data: {
|
data: {
|
||||||
@@ -160,7 +161,7 @@
|
|||||||
embed: false,
|
embed: false,
|
||||||
localstorage: false,
|
localstorage: false,
|
||||||
searchable: false,
|
searchable: false,
|
||||||
requests: {rest:{limit:0, used:0, remaining:0, reset:NaN}, graphql:{limit:0, used:0, remaining:0, reset:NaN}},
|
requests: { rest: { limit: 0, used: 0, remaining: 0, reset: NaN }, graphql: { limit: 0, used: 0, remaining: 0, reset: NaN } },
|
||||||
palette: "light",
|
palette: "light",
|
||||||
metrics: null,
|
metrics: null,
|
||||||
pending: false,
|
pending: false,
|
||||||
|
|||||||
@@ -90,24 +90,24 @@
|
|||||||
tab: "overview",
|
tab: "overview",
|
||||||
palette: "light",
|
palette: "light",
|
||||||
clipboard: null,
|
clipboard: null,
|
||||||
requests: {rest:{limit:0, used:0, remaining:0, reset:NaN}, graphql:{limit:0, used:0, remaining:0, reset:NaN}},
|
requests: { rest: { limit: 0, used: 0, remaining: 0, reset: NaN }, graphql: { limit: 0, used: 0, remaining: 0, reset: NaN } },
|
||||||
cached: new Map(),
|
cached: new Map(),
|
||||||
config: Object.fromEntries(Object.entries(metadata.core.web).map(([key, { defaulted }]) => [key, defaulted])),
|
config: Object.fromEntries(Object.entries(metadata.core.web).map(([key, { defaulted }]) => [key, defaulted])),
|
||||||
metadata: Object.fromEntries(Object.entries(metadata).map(([key, { web }]) => [key, web])),
|
metadata: Object.fromEntries(Object.entries(metadata).map(([key, { web }]) => [key, web])),
|
||||||
hosted: null,
|
hosted: null,
|
||||||
docs:{
|
docs: {
|
||||||
overview:{
|
overview: {
|
||||||
link:"https://github.com/lowlighter/metrics#-documentation",
|
link: "https://github.com/lowlighter/metrics#-documentation",
|
||||||
name:"Complete documentation",
|
name: "Complete documentation",
|
||||||
},
|
},
|
||||||
markdown:{
|
markdown: {
|
||||||
link:"https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/documentation/setup/shared.md",
|
link: "https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/documentation/setup/shared.md",
|
||||||
name:"Setup using the shared instance",
|
name: "Setup using the shared instance",
|
||||||
|
},
|
||||||
|
action: {
|
||||||
|
link: "https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/documentation/setup/action.md",
|
||||||
|
name: "Setup using GitHub Action on a profile repository",
|
||||||
},
|
},
|
||||||
action:{
|
|
||||||
link:"https://github.com/lowlighter/metrics/blob/master/.github/readme/partials/documentation/setup/action.md",
|
|
||||||
name:"Setup using GitHub Action on a profile repository",
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
plugins: {
|
plugins: {
|
||||||
base: {},
|
base: {},
|
||||||
@@ -269,7 +269,7 @@
|
|||||||
rlreset() {
|
rlreset() {
|
||||||
const reset = new Date(Math.max(this.requests.graphql.reset, this.requests.rest.reset))
|
const reset = new Date(Math.max(this.requests.graphql.reset, this.requests.rest.reset))
|
||||||
return `${reset.getHours()}:${reset.getMinutes()}`
|
return `${reset.getHours()}:${reset.getMinutes()}`
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
//Methods
|
//Methods
|
||||||
methods: {
|
methods: {
|
||||||
@@ -321,7 +321,8 @@
|
|||||||
try {
|
try {
|
||||||
const { data: requests } = await axios.get("/.requests")
|
const { data: requests } = await axios.get("/.requests")
|
||||||
this.requests = requests
|
this.requests = requests
|
||||||
} catch {}
|
}
|
||||||
|
catch {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -247,21 +247,25 @@
|
|||||||
? ({
|
? ({
|
||||||
notable: {
|
notable: {
|
||||||
contributions: new Array(2 + faker.datatype.number(2)).fill(null).map(_ => ({
|
contributions: new Array(2 + faker.datatype.number(2)).fill(null).map(_ => ({
|
||||||
get name() { return options["notable.repositories"] ? this.handle : this.handle.split("/")[0] },
|
get name() {
|
||||||
|
return options["notable.repositories"] ? this.handle : this.handle.split("/")[0]
|
||||||
|
},
|
||||||
handle: `${faker.lorem.slug()}/${faker.lorem.slug()}`,
|
handle: `${faker.lorem.slug()}/${faker.lorem.slug()}`,
|
||||||
avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
|
avatar: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
|
||||||
organization: faker.datatype.boolean(),
|
organization: faker.datatype.boolean(),
|
||||||
stars: faker.datatype.number(1000),
|
stars: faker.datatype.number(1000),
|
||||||
aggregated: faker.datatype.number(100),
|
aggregated: faker.datatype.number(100),
|
||||||
history: faker.datatype.number(1000),
|
history: faker.datatype.number(1000),
|
||||||
...(options["notable.indepth"] ? {
|
...(options["notable.indepth"]
|
||||||
user:{
|
? {
|
||||||
commits: faker.datatype.number(100),
|
user: {
|
||||||
percentage: faker.datatype.float({ max: 1 }),
|
commits: faker.datatype.number(100),
|
||||||
maintainer: false,
|
percentage: faker.datatype.float({ max: 1 }),
|
||||||
stars: faker.datatype.number(100),
|
maintainer: false,
|
||||||
|
stars: faker.datatype.number(100),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
} : null)
|
: null),
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -603,9 +607,9 @@
|
|||||||
...(set.plugins.enabled.fortune
|
...(set.plugins.enabled.fortune
|
||||||
? ({
|
? ({
|
||||||
fortune: faker.random.arrayElement([
|
fortune: faker.random.arrayElement([
|
||||||
{chance:.06, color:"#43FD3B", text:"Good news will come to you by mail"},
|
{ chance: .06, color: "#43FD3B", text: "Good news will come to you by mail" },
|
||||||
{chance:.06, color:"#00CBB0", text:"キタ━━━━━━(゚∀゚)━━━━━━ !!!!"},
|
{ chance: .06, color: "#00CBB0", text: "キタ━━━━━━(゚∀゚)━━━━━━ !!!!" },
|
||||||
{chance: 0.03, color: "#FD4D32", text: "Excellent Luck"}
|
{ chance: 0.03, color: "#FD4D32", text: "Excellent Luck" },
|
||||||
]),
|
]),
|
||||||
})
|
})
|
||||||
: null),
|
: null),
|
||||||
@@ -722,7 +726,7 @@
|
|||||||
? ({
|
? ({
|
||||||
topics: {
|
topics: {
|
||||||
mode: options["topics.mode"],
|
mode: options["topics.mode"],
|
||||||
type: {starred:"labels", labels:"labels", mastered:"icons", icons:"icons"}[options["topics.mode"]] || "labels",
|
type: { starred: "labels", labels: "labels", mastered: "icons", icons: "icons" }[options["topics.mode"]] || "labels",
|
||||||
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(),
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
|||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
let {provider, mode, playlist, limit, user, "played.at":played_at, "time.range":time_range, "top.type":top_type, token:_token} = imports.metadata.plugins.music.inputs({data, account, q})
|
let {provider, mode, playlist, limit, user, "played.at":played_at, "time.range":time_range, "top.type":top_type, token:_token} = imports.metadata.plugins.music.inputs({data, account, q})
|
||||||
if ((sandbox)&&(_token)) {
|
if ((sandbox) && (_token)) {
|
||||||
token = _token
|
token = _token
|
||||||
console.debug(`metrics/compute/${login}/plugins > music > overriden token value through user inputs as sandbox mode is enabled`)
|
console.debug(`metrics/compute/${login}/plugins > music > overriden token value through user inputs as sandbox mode is enabled`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user