add shields.io 'style' parameter

This commit is contained in:
Jens Neuber 2022-01-04 13:40:53 +01:00
parent 7abbf421d0
commit f455e3a454

View file

@ -225,6 +225,7 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response
downLabel = "Down", downLabel = "Down",
upColor = badgeConstants.defaultUpColor, upColor = badgeConstants.defaultUpColor,
downColor = badgeConstants.defaultDownColor, downColor = badgeConstants.defaultDownColor,
style = "flat",
value // for demo purpose only value // for demo purpose only
} = request.query; } = request.query;
@ -243,7 +244,7 @@ router.get("/api/badge/:id/status", cache("5 minutes"), async (request, response
[requestedMonitorId] [requestedMonitorId]
); );
const badgeValues = {}; const badgeValues = { style };
if (!publicMonitor) { if (!publicMonitor) {
// return a "N/A" badge in naColor (grey), if monitor is not public / not available / non exsitant // return a "N/A" badge in naColor (grey), if monitor is not public / not available / non exsitant
@ -279,6 +280,7 @@ router.get("/api/badge/:id/uptime/:duration?", cache("5 minutes"), async (reques
suffix = "%", suffix = "%",
color, color,
labelColor, labelColor,
style = "flat",
value // for demo purpose only value // for demo purpose only
} = request.query; } = request.query;
@ -299,7 +301,7 @@ router.get("/api/badge/:id/uptime/:duration?", cache("5 minutes"), async (reques
[requestedMonitorId] [requestedMonitorId]
); );
const badgeValues = {}; const badgeValues = { style };
if (!publicMonitor) { if (!publicMonitor) {
// return a "N/A" badge in naColor (grey), if monitor is not public / not available / non exsitant // return a "N/A" badge in naColor (grey), if monitor is not public / not available / non exsitant
@ -345,7 +347,8 @@ router.get("/api/badge/:id/ping/:duration?", cache("5 minutes"), async (request,
suffix = "ms", suffix = "ms",
color = badgeConstants.defaultPingColor, color = badgeConstants.defaultPingColor,
labelColor, labelColor,
value style = "flat",
value // for demo purpose only
} = request.query; } = request.query;
try { try {
@ -368,7 +371,7 @@ router.get("/api/badge/:id/ping/:duration?", cache("5 minutes"), async (request,
[-requestedDuration, requestedMonitorId] [-requestedDuration, requestedMonitorId]
)); ));
const badgeValues = {}; const badgeValues = { style };
if (!publicAvgPing) { if (!publicAvgPing) {
// return a "N/A" badge in naColor (grey), if monitor is not public / not available / non exsitant // return a "N/A" badge in naColor (grey), if monitor is not public / not available / non exsitant