communicate install status to the plugin
Signed-off-by: Xe Iaso <me@christine.website>
This commit is contained in:
parent
d871074d29
commit
5ff618eee8
9
main.py
9
main.py
|
@ -9,17 +9,18 @@ class Plugin:
|
|||
|
||||
def _systemd_status(self, service = "tailscaled.service"):
|
||||
result = subprocess.run(["/bin/sh", "-c", "systemctl status tailscaled.service | grep active"], stdout=subprocess.PIPE)
|
||||
return result.stdout.decode("utf-8").split(": ")[1]
|
||||
return result.stdout.decode("utf-8").split(": ")[1].strip()
|
||||
|
||||
async def install_state(self, *args):
|
||||
print("got here")
|
||||
sysext = subprocess.run(["/usr/bin/systemd-sysext", "list", "--json=short"], stdout=subprocess.PIPE)
|
||||
sysexts = json.load(sysext.stdout.decode("utf-8"))
|
||||
sysexts = json.loads(sysext.stdout.decode("utf-8"))
|
||||
|
||||
if sysexts.len() == 0:
|
||||
if len(sysexts) == 0:
|
||||
return "not installed"
|
||||
|
||||
for ext in sysexts:
|
||||
if ext.name != "tailscale":
|
||||
if ext["name"] != "tailscale":
|
||||
continue
|
||||
|
||||
return self._systemd_status()
|
||||
|
|
|
@ -14,11 +14,6 @@
|
|||
}
|
||||
|
||||
async function onReady() {
|
||||
let heading = document.getElementById("heading");
|
||||
let id = await getUID();
|
||||
|
||||
heading.innerText = `Hello ${id}`;
|
||||
|
||||
let status = document.getElementById("status");
|
||||
let install_status = await getInstallState();
|
||||
|
||||
|
@ -27,7 +22,6 @@
|
|||
</script>
|
||||
</head>
|
||||
<body onload="onReady()">
|
||||
<h2 id="heading">Hello World</h2>
|
||||
<h3 id="status">Status: loading</h3>
|
||||
<h3>Status: <span id="status">loading</span></h3>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue