x
This commit is contained in:
@@ -40,6 +40,9 @@ func (s *PersistentKeyValueStore) Set(key string, value interface{}, dur int) er
|
||||
ExpiredAt: expiredAt,
|
||||
}
|
||||
go func() {
|
||||
defer func() {
|
||||
recover()
|
||||
}()
|
||||
jsonBytes, err := json.Marshal(s.data)
|
||||
if err == nil {
|
||||
ioutil.WriteFile(tempPath, jsonBytes, 0644)
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/cdle/sillyplus/mongodb"
|
||||
"github.com/cdle/sillyplus/utils"
|
||||
"github.com/dop251/goja"
|
||||
"github.com/dop251/goja_nodejs/require"
|
||||
@@ -438,6 +439,11 @@ func SetPluginMethod(vm *goja.Runtime, uuid string, on_start bool, running func(
|
||||
vm.Set("os", osjs)
|
||||
vm.Set("fs", osjs)
|
||||
vm.Set("forObject", ForeachObject)
|
||||
vm.Set("MongoClient", func(uri string) interface{} {
|
||||
return &mongodb.MongoClient{
|
||||
Uri: uri,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func EncryptPlugin(script string) string {
|
||||
|
||||
Reference in New Issue
Block a user