update
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
@@ -29,6 +31,15 @@ var OttoFuncs = map[string]func(string) string{
|
||||
data, _ := os.ReadFile("/var/lib/dbus/machine-id")
|
||||
return regexp.MustCompile(`\w+`).FindString(string(data))
|
||||
},
|
||||
"uuid": func(_ string) string {
|
||||
return GetUUID()
|
||||
},
|
||||
"md5": func(str string) string {
|
||||
w := md5.New()
|
||||
io.WriteString(w, str)
|
||||
md5str := fmt.Sprintf("%x", w.Sum(nil))
|
||||
return md5str
|
||||
},
|
||||
}
|
||||
|
||||
func init123() {
|
||||
|
||||
Reference in New Issue
Block a user