From 3ba1b5f4178f9d3ca7e431aedff22ee051d5c31b Mon Sep 17 00:00:00 2001 From: cdle <798731886@qq.com> Date: Fri, 29 Oct 2021 08:52:15 +0800 Subject: [PATCH] update --- core/otto.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/otto.go b/core/otto.go index 049af98..b4acbe6 100644 --- a/core/otto.go +++ b/core/otto.go @@ -36,7 +36,12 @@ func init() { var OttoFuncs = map[string]func(string) string{ "machineId": func(_ string) string { data, _ := os.ReadFile("/var/lib/dbus/machine-id") - return regexp.MustCompile(`\w+`).FindString(string(data)) + id := regexp.MustCompile(`\w+`).FindString(string(data)) + if id == "" { + data, _ = os.ReadFile("/etc/machine-id") + id = regexp.MustCompile(`\w+`).FindString(string(data)) + } + return id }, "uuid": func(_ string) string { return GetUUID()