tests: change nosttings/mock to sandbox setting
This commit is contained in:
@@ -60,7 +60,7 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q
|
|||||||
pending.push((async () => {
|
pending.push((async () => {
|
||||||
try {
|
try {
|
||||||
console.debug(`metrics/compute/${login}/plugins > ${name} > started`)
|
console.debug(`metrics/compute/${login}/plugins > ${name} > started`)
|
||||||
data.plugins[name] = await imports.plugins[name]({login, q, imports, data, computed, rest, graphql, queries, account}, {extras:conf.settings?.extras?.features ?? conf.settings?.extras?.default ?? false, ...plugins[name]})
|
data.plugins[name] = await imports.plugins[name]({login, q, imports, data, computed, rest, graphql, queries, account}, {extras:conf.settings?.extras?.features ?? conf.settings?.extras?.default ?? false, sandbox:conf.settings?.sandbox ?? false, ...plugins[name]})
|
||||||
console.debug(`metrics/compute/${login}/plugins > ${name} > completed`)
|
console.debug(`metrics/compute/${login}/plugins > ${name} > completed`)
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const modes = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Setup
|
//Setup
|
||||||
export default async function({login, imports, data, q, account}, {enabled = false, token = ""} = {}) {
|
export default async function({login, imports, data, q, account}, {enabled = false, token = "", sandbox = false} = {}) {
|
||||||
//Plugin execution
|
//Plugin execution
|
||||||
try {
|
try {
|
||||||
//Check if plugin is enabled and requirements are met
|
//Check if plugin is enabled and requirements are met
|
||||||
@@ -47,7 +47,12 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
|||||||
let tracks = null
|
let tracks = null
|
||||||
|
|
||||||
//Load inputs
|
//Load inputs
|
||||||
let {provider, mode, playlist, limit, user, "played.at":played_at, "time.range":time_range, "top.type":top_type} = 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)) {
|
||||||
|
token = _token
|
||||||
|
console.debug(`metrics/compute/${login}/plugins > music > overriden token value through user inputs as sandbox mode is enabled`)
|
||||||
|
}
|
||||||
|
|
||||||
//Auto-guess parameters
|
//Auto-guess parameters
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
if (playlist) {
|
if (playlist) {
|
||||||
@@ -119,7 +124,7 @@ export default async function({login, imports, data, q, account}, {enabled = fal
|
|||||||
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 ?? document.querySelector("button").parentNode, null).backgroundImage.match(/^url\("(?<url>https:...+)"\)$/)?.groups?.url ?? null,
|
||||||
}))
|
}))
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user