From 7dfd7b404cdcf0db8e44a8b357cd108e10a725e1 Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Fri, 24 Jul 2026 20:10:53 +0100 Subject: better arch of stats --- .../volumes/pocketbase/pb_hooks/stats.pb.js | 18 +++++++++++++---- .../volumes/pocketbase/pb_hooks/views/stats.html | 23 ++++++++++++++-------- 2 files changed, 29 insertions(+), 12 deletions(-) (limited to '174bg') diff --git a/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js b/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js index e2b6ab3..3c9617b 100644 --- a/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js +++ b/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js @@ -1,6 +1,6 @@ routerAdd("get", "/stats", (e) => { - const heartbeat = $http.send({ - url: "https://db.174bg.net/api/heartbeat", + const stats = $http.send({ + url: "https://db.174bg.net/api/stats", headers: { "content-type": "application/json" } }) @@ -8,7 +8,17 @@ routerAdd("get", "/stats", (e) => { `${__hooks}/views/_layout.html`, `${__hooks}/views/stats.html`, ).render({ - "timeDifference": heartbeat.json.timeDifference, - "withinThreshold": heartbeat.json.withinThreshold, + stats: stats.json, })) +}) + +routerAdd("get", "/api/stats", (e) => { + const heartbeat = $http.send({ + url: "https://db.174bg.net/api/heartbeat", + headers: { "content-type": "application/json" } + }) + + return e.json(200, { + heartbeat: heartbeat.json, + }) }) \ No newline at end of file diff --git a/174bg/database/volumes/pocketbase/pb_hooks/views/stats.html b/174bg/database/volumes/pocketbase/pb_hooks/views/stats.html index b59c1a7..b61a1ba 100644 --- a/174bg/database/volumes/pocketbase/pb_hooks/views/stats.html +++ b/174bg/database/volumes/pocketbase/pb_hooks/views/stats.html @@ -3,8 +3,7 @@ {{end}} {{define "body"}} -

Time Difference: {{.timeDifference}}

-

Within Threshold: {{.withinThreshold}}

+

{{end}} \ No newline at end of file -- cgit v1.2.3