From f2eaf111c56922a138604743a57726ac389196eb Mon Sep 17 00:00:00 2001 From: Duckonaut Date: Tue, 10 Nov 2026 23:35:39 +0100 Subject: add statuses --- pages/home.luax | 45 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'pages') diff --git a/pages/home.luax b/pages/home.luax index 002d9bf..6ab86bc 100644 --- a/pages/home.luax +++ b/pages/home.luax @@ -13,6 +13,38 @@ local art = [[ __| |__ ]] +local function is_service_live(service, is_user) + local opt = '' + if is_user then + opt = '-U ' + end + local handle = io.popen('rc-service ' .. opt .. service .. ' status 2>&1') + local output = handle:read('*a') + + + local is_dummy = string.match(output, "not found") + if is_dummy then + return "unknown" + end + local is_running = string.match(output, "started") + if is_running then + return "online" + else + return "offline" + end +end + +local function Service(props) + return
+
+ {$ props.attrs.service $} +
+
+ {$ is_service_live(props.attrs.service, props.attrs.is_user) $} +
+
+end + return function(props) return
@@ -21,12 +53,13 @@ return function(props)
{$ art $}
-
- apparently like -
- {$ tostring(props.attrs.visits) $} -
- people saw this +
+ + + + + +
end -- cgit v1.3.1