Add support for pagespeed

This commit is contained in:
lowlighter
2020-09-17 13:46:17 +02:00
parent 22d732c3f8
commit 62413b7d9d
15 changed files with 314 additions and 118 deletions

View File

@@ -17,8 +17,9 @@
//Load settings
const settings = JSON.parse((await fs.promises.readFile(path.join("settings.json"))).toString())
console.log(settings)
const {token, maxusers = 0, restricted = [], debug = false, cached = 30*60*1000, port = 3000, ratelimiter = null} = settings
const {token, maxusers = 0, restricted = [], debug = false, cached = 30*60*1000, port = 3000, ratelimiter = null, plugins = null} = settings
if (debug)
console.log(settings)
//Load svg template, style and query
let [template, style, query] = await load()
const graphql = octokit.graphql.defaults({headers:{authorization: `token ${token}`}})
@@ -68,7 +69,7 @@
//Render
if (debug)
[template, style, query] = await load()
const rendered = await metrics({login}, {template, style, query, graphql})
const rendered = await metrics({login, q:req.query}, {template, style, query, graphql, plugins})
//Cache
if ((!debug)&&(cached))
cache.put(login, rendered, cached)