From 39ef8955e6dd4d7e0447c1c4f151c1554e9ae408 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sat, 11 Mar 2023 13:26:33 -0700 Subject: [PATCH] Polished up and ready to distribute, maybe --- README.md | 54 +++++++- web/index.html | 4 +- web/{index.css => portal.css} | 0 web/portal.json | 68 ++-------- web/{index.mjs => portal.mjs} | 20 ++- web/{stat => }/stat.html | 15 ++- web/stat.mjs | 238 ++++++++++++++++++++++++++++++++++ web/stat/stat.mjs | 32 ----- web/stat/webstat.mjs | 168 ------------------------ 9 files changed, 324 insertions(+), 275 deletions(-) rename web/{index.css => portal.css} (100%) rename web/{index.mjs => portal.mjs} (86%) rename web/{stat => }/stat.html (54%) create mode 100644 web/stat.mjs delete mode 100644 web/stat/stat.mjs delete mode 100644 web/stat/webstat.mjs diff --git a/README.md b/README.md index 34cb530..3c2f38c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,52 @@ -# WebStat +# Homelab Portal -This is a simple service to provide `/proc/stat` on demand. -Some JavaScript parses it and graphs it. +This repository provide some simple scaffolding to build a landing page for your homelab. +You can link to all your stuff, +including pretty icons, +and your apps will show up under the same top URL, +like they all work together somehow. -Essentially, this is a browser version of something like top or btop. +There are lots of other things like this around. +Probably the shiniest is called "Heimdall". +I made this one because I didn't want to run yet another database +or a PHP server +when I am perfectly happy editing a JSON file +and having my browser do all the work. + +# portal.json + +You define all your services in `/web/portal.json`. +It works like this: + +```json +[ + { + "name": "My Thing", + "href": "https://myhost.example.org/path/to/my/thing/", + "icon": "https://myhost.example.org/path/to/my/thing/icons.png" + }, + { + "name": "Another thing", + "href": "https://example.net/", + "target": "_blank" + }, + { + "name": "Stat", + "href": "/stat.html", + "app": "stat" + } +] +``` + +Some notes: + +* `"target": "_blank"` will cause clicks to open in a new tab +* `"app": "stat"` makes the icon be the built-in CPU stats pie chart + +# Other uses for this + +Since the portal stuff is all static files, +you could just not use any of that, +and instead use this as a service to provide CPU stats. +Just open `/stats.html` instead of `/`. +Or write your own ECMAScript code that imports `stat.mjs`. diff --git a/web/index.html b/web/index.html index cce5201..8e4ed97 100644 --- a/web/index.html +++ b/web/index.html @@ -5,8 +5,8 @@ - - + +