From c736561fab9fc04cddb3a8584967c6728350877d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxi=20Quo=C3=9F?= Date: Sun, 19 Oct 2025 22:42:27 +0200 Subject: [PATCH] feat: add ip and mac variables to wake/shutdown commands --- backend/networking/shutdown.go | 4 ++++ backend/networking/wake.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/backend/networking/shutdown.go b/backend/networking/shutdown.go index 793e487d..15b71c57 100644 --- a/backend/networking/shutdown.go +++ b/backend/networking/shutdown.go @@ -6,6 +6,7 @@ import ( "fmt" "os/exec" "runtime" + "strings" "time" "github.com/pocketbase/pocketbase/core" @@ -29,6 +30,9 @@ func ShutdownDevice(device *core.Record) error { shell_arg = "-c" } + shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_IP }}", device.GetString("ip")) + shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_MAC }}", device.GetString("mac")) + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() diff --git a/backend/networking/wake.go b/backend/networking/wake.go index 573a96d5..d573ef14 100644 --- a/backend/networking/wake.go +++ b/backend/networking/wake.go @@ -6,6 +6,7 @@ import ( "fmt" "os/exec" "runtime" + "strings" "time" "github.com/pocketbase/pocketbase/core" @@ -32,6 +33,9 @@ func WakeDevice(device *core.Record) error { shell_arg = "-c" } + wake_cmd = strings.ReplaceAll(wake_cmd, "{{ DEVICE_IP }}", device.GetString("ip")) + wake_cmd = strings.ReplaceAll(wake_cmd, "{{ DEVICE_MAC }}", device.GetString("mac")) + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel()