aboutsummaryrefslogtreecommitdiff
path: root/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js
diff options
context:
space:
mode:
Diffstat (limited to '174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js')
-rw-r--r--174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js b/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js
new file mode 100644
index 0000000..e2b6ab3
--- /dev/null
+++ b/174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js
@@ -0,0 +1,14 @@
+routerAdd("get", "/stats", (e) => {
+ const heartbeat = $http.send({
+ url: "https://db.174bg.net/api/heartbeat",
+ headers: { "content-type": "application/json" }
+ })
+
+ return e.html(200, $template.loadFiles(
+ `${__hooks}/views/_layout.html`,
+ `${__hooks}/views/stats.html`,
+ ).render({
+ "timeDifference": heartbeat.json.timeDifference,
+ "withinThreshold": heartbeat.json.withinThreshold,
+ }))
+}) \ No newline at end of file