refactor: add fullNum props in telemetry badge
This commit is contained in:
parent
6f76a04abe
commit
44d5fb3f50
@ -10,7 +10,7 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
clearScreen: false,
|
clearScreen: false,
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
// host: '0.0.0.0',
|
||||||
proxy: {
|
proxy: {
|
||||||
'/socket.io': {
|
'/socket.io': {
|
||||||
target: 'ws://localhost:12345',
|
target: 'ws://localhost:12345',
|
||||||
|
@ -73,18 +73,21 @@ telemetryRouter.get(
|
|||||||
query('name').optional().isString(),
|
query('name').optional().isString(),
|
||||||
query('url').optional().isURL(),
|
query('url').optional().isURL(),
|
||||||
query('title').optional().isString(),
|
query('title').optional().isString(),
|
||||||
query('start').optional().isNumeric()
|
query('start').optional().isNumeric(),
|
||||||
|
query('fullNum').optional().isBoolean()
|
||||||
),
|
),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const title = req.query.title || 'visitor';
|
const title = req.query.title || 'visitor';
|
||||||
const start = req.query.start ? Number(req.query.start) : 0;
|
const start = req.query.start ? Number(req.query.start) : 0;
|
||||||
|
const fullNum = req.query.fullNum === 'true';
|
||||||
|
|
||||||
recordTelemetryEvent(req);
|
recordTelemetryEvent(req);
|
||||||
const num = await sumTelemetryEvent(req);
|
const num = await sumTelemetryEvent(req);
|
||||||
|
const count = num + start;
|
||||||
|
|
||||||
const svg = makeBadge({
|
const svg = makeBadge({
|
||||||
label: String(title),
|
label: String(title),
|
||||||
message: numify(num + start),
|
message: fullNum ? String(count) : numify(count),
|
||||||
color: 'green',
|
color: 'green',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user