From eb719a5416391521d536980e974f97b7ac8b78e3 Mon Sep 17 00:00:00 2001 From: "Alex Pooley (@zuedev)" Date: Fri, 24 Jul 2026 20:06:17 +0100 Subject: stats page --- .../volumes/pocketbase/pb_hooks/heartbeat.pb.js | 2 +- .../volumes/pocketbase/pb_hooks/stats.pb.js | 14 ++++++++++++ .../volumes/pocketbase/pb_hooks/views/_layout.html | 11 ++++++++++ .../volumes/pocketbase/pb_hooks/views/stats.html | 25 ++++++++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 174bg/database/volumes/pocketbase/pb_hooks/stats.pb.js create mode 100644 174bg/database/volumes/pocketbase/pb_hooks/views/_layout.html create mode 100644 174bg/database/volumes/pocketbase/pb_hooks/views/stats.html (limited to '174bg') diff --git a/174bg/database/volumes/pocketbase/pb_hooks/heartbeat.pb.js b/174bg/database/volumes/pocketbase/pb_hooks/heartbeat.pb.js index b7d385d..5579777 100644 --- a/174bg/database/volumes/pocketbase/pb_hooks/heartbeat.pb.js +++ b/174bg/database/volumes/pocketbase/pb_hooks/heartbeat.pb.js @@ -1,4 +1,4 @@ -routerAdd("GET", "/heartbeat", (e) => { +routerAdd("GET", "/api/heartbeat", (e) => { try { const result = new DynamicModel({ "value": nullString(), 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 diff --git a/174bg/database/volumes/pocketbase/pb_hooks/views/_layout.html b/174bg/database/volumes/pocketbase/pb_hooks/views/_layout.html new file mode 100644 index 0000000..4771057 --- /dev/null +++ b/174bg/database/volumes/pocketbase/pb_hooks/views/_layout.html @@ -0,0 +1,11 @@ + + + + {{block "title" .}}Default app title{{end}} + + + {{block "body" .}} + Default app body... + {{end}} + + \ 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 new file mode 100644 index 0000000..b59c1a7 --- /dev/null +++ b/174bg/database/volumes/pocketbase/pb_hooks/views/stats.html @@ -0,0 +1,25 @@ +{{define "title"}} + stats +{{end}} + +{{define "body"}} +

Time Difference: {{.timeDifference}}

+

Within Threshold: {{.withinThreshold}}

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