Fix missing closing tag in nightscout plugin and reduce svg size

This commit is contained in:
lowlighter
2021-03-04 21:03:24 +01:00
parent f6006e4e89
commit 9e9b066be9
3 changed files with 43 additions and 44 deletions

View File

@@ -8,7 +8,7 @@ export default function({faker, url}) {
const directionArray = ["SingleUp", "DoubleUp", "FortyFiveUp", "Flat", "FortyFiveDown", "SingleDown", "DoubleDown"] const directionArray = ["SingleUp", "DoubleUp", "FortyFiveUp", "Flat", "FortyFiveDown", "SingleDown", "DoubleDown"]
return ({ return ({
status:200, status:200,
data:[{ data:new Array(12).fill(null).map(_ => ({
_id:faker.git.commitSha().substring(0, 23), _id:faker.git.commitSha().substring(0, 23),
device:"xDrip-DexcomG5", device:"xDrip-DexcomG5",
date:lastInterval, date:lastInterval,
@@ -23,7 +23,7 @@ export default function({faker, url}) {
noise:1, noise:1,
sysTime:new Date(lastInterval).toISOString(), sysTime:new Date(lastInterval).toISOString(),
utcOffset:faker.random.number({min:-12, max:14})*60, utcOffset:faker.random.number({min:-12, max:14})*60,
}], })),
}) })
} }
} }

View File

@@ -6,10 +6,10 @@
if ((!enabled)||(!q.nightscout)) if ((!enabled)||(!q.nightscout))
return null return null
//Load inputs //Load inputs
let {url, datapoints, lowalert, highalert, urgentlowalert, urgenthighalert} = imports.metadata.plugins.nightscout.inputs({data, account, q}) let {url, datapoints, lowalert, highalert, urgentlowalert, urgenthighalert} = imports.metadata.plugins.nightscout.inputs({data, account, q})
if (!url || url === "https://example.herokuapp.com") throw "Nightscout site URL isn't set!" if (!url || url === "https://example.herokuapp.com") throw {error:{message:"Nightscout site URL isn't set!"}}
if (url.substring(url.length - 1) !== "/") url += "/" if (url.substring(url.length - 1) !== "/") url += "/"
if (url.substring(0, 7) === "http://") url = `https://${url.substring(7)}` if (url.substring(0, 7) === "http://") url = `https://${url.substring(7)}`
if (url.substring(0, 8) !== "https://") url = `https://${url}` if (url.substring(0, 8) !== "https://") url = `https://${url}`
@@ -43,6 +43,8 @@
} }
//Handle errors //Handle errors
catch (error) { catch (error) {
if (error.error?.message)
throw error
throw {error:{message:"An error occured", instance:error}} throw {error:{message:"An error occured", instance:error}}
} }
} }

File diff suppressed because one or more lines are too long