feat(app/web): improve permissions
This commit is contained in:
@@ -20,6 +20,7 @@ inputs:
|
||||
default: no
|
||||
extras:
|
||||
- metrics.npm.optional.chartist
|
||||
- metrics.api.yahoo.finance
|
||||
|
||||
plugin_stock_token:
|
||||
description: |
|
||||
|
||||
@@ -79,5 +79,5 @@ inputs:
|
||||
"#️⃣ Others": ["*"]
|
||||
}
|
||||
extras:
|
||||
- metrics.runner.tempdir
|
||||
- metrics.runner.git
|
||||
- metrics.run.tempdir
|
||||
- metrics.run.git
|
||||
|
||||
@@ -52,6 +52,8 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
||||
token = _token
|
||||
console.debug(`metrics/compute/${login}/plugins > music > overriden token value through user inputs as sandbox mode is enabled`)
|
||||
}
|
||||
if (!imports.metadata.plugins.music.extras("token", {extras, error: false}))
|
||||
token = ""
|
||||
|
||||
//Auto-guess parameters
|
||||
if (!mode) {
|
||||
|
||||
@@ -51,6 +51,8 @@ inputs:
|
||||
- `youtube`: "cookie"
|
||||
type: token
|
||||
default: ""
|
||||
extras:
|
||||
- metrics.api.music.any
|
||||
|
||||
plugin_music_user:
|
||||
description: |
|
||||
|
||||
@@ -8,6 +8,9 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
||||
|
||||
//Load inputs
|
||||
let {detailed, screenshot, url, pwa} = imports.metadata.plugins.pagespeed.inputs({data, account, q})
|
||||
if (!imports.metadata.plugins.pagespeed.extras("token", {extras, error: false}))
|
||||
token = ""
|
||||
|
||||
//Format url if needed
|
||||
if (!url)
|
||||
throw {error: {message: "Website URL is not set"}}
|
||||
@@ -15,6 +18,7 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
||||
url = `https://${url}`
|
||||
const {protocol, host} = imports.url.parse(url)
|
||||
const result = {url: `${protocol}//${host}`, detailed, scores: [], metrics: {}}
|
||||
|
||||
//Load scores from API
|
||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > querying api for ${result.url}`)
|
||||
const categories = ["performance", "accessibility", "best-practices", "seo"]
|
||||
@@ -23,6 +27,7 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
||||
let categories_required = ""
|
||||
for (const category of categories)
|
||||
categories_required += `&category=${category}`
|
||||
|
||||
//Perform audit
|
||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > performing audit ${categories_required}`)
|
||||
const request = await imports.axios.get(`https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=${url}${categories_required}${token ? `&key=${token}` : ""}`)
|
||||
@@ -31,9 +36,11 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
||||
result.scores.push({score, title})
|
||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > performed audit ${category} (status code ${request.status})`)
|
||||
}
|
||||
|
||||
//Store screenshot
|
||||
if (screenshot)
|
||||
result.screenshot = request.data.lighthouseResult.audits["final-screenshot"].details.data
|
||||
|
||||
//Detailed metrics
|
||||
if (detailed) {
|
||||
console.debug(`metrics/compute/${login}/plugins > pagespeed > performing detailed audit`)
|
||||
|
||||
@@ -29,6 +29,8 @@ inputs:
|
||||
> ⚠️ While not mandatory, it is strongly advised pass a token to avoid triggering the rate limiter. See [PageSpeed documentation](https://developers.google.com/speed/docs/insights/v5/get-started) for more informations.
|
||||
type: token
|
||||
default: ""
|
||||
extras:
|
||||
- metrics.api.google.pagespeed
|
||||
|
||||
plugin_pagespeed_url:
|
||||
description: |
|
||||
|
||||
@@ -17,6 +17,8 @@ inputs:
|
||||
Enable tweets plugin
|
||||
type: boolean
|
||||
default: no
|
||||
extras:
|
||||
- metrics.api.twitter.tweets
|
||||
|
||||
plugin_tweets_token:
|
||||
description: |
|
||||
|
||||
Reference in New Issue
Block a user