x
This commit is contained in:
+10
-44
@@ -350,47 +350,13 @@ func Convert(vm *goja.Runtime, data interface{}, fromFormat string, toFormat str
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// panic: interface conversion: interface {} is *cipher.cfb, not *core.AesCipher [recovered]
|
func cryptoModule(vm *goja.Runtime, module *goja.Object) {
|
||||||
// panic: interface conversion: interface {} is *cipher.cfb, not *core.AesCipher
|
cryto := Crypto{
|
||||||
|
vm: vm,
|
||||||
// goroutine 15 [running]:
|
}
|
||||||
// github.com/dop251/goja.(*Runtime).RunProgram.func1()
|
o := module.Get("exports").(*goja.Object)
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/runtime.go:1491 +0x3b8
|
o.Set("createCipheriv", cryto.CreateCipheriv)
|
||||||
// panic({0x1a5f6e0, 0xc0017a4780})
|
o.Set("createDecipheriv", cryto.CreateDecipheriv)
|
||||||
// C:/Program Files/Go/src/runtime/panic.go:884 +0x213
|
o.Set("createHash", cryto.CreateHash)
|
||||||
// github.com/dop251/goja.(*vm).handleThrow(0xc001312240, {0x1a5f6e0, 0xc0017a4780})
|
o.Set("createHmac", cryto.CreateHmac)
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/vm.go:788 +0x497
|
}
|
||||||
// github.com/dop251/goja.(*vm).runTryInner.func1()
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/vm.go:830 +0x45
|
|
||||||
// panic({0x1a5f6e0, 0xc0017a4780})
|
|
||||||
// C:/Program Files/Go/src/runtime/panic.go:884 +0x213
|
|
||||||
// github.com/cdle/sillyplus/core.(*Hmac).Final(0x2?, {0xc0008266d4?, 0x1?})
|
|
||||||
// C:/Users/Administrator/Desktop/sillyplus/core/node_ crypto.go:90 +0x145
|
|
||||||
// reflect.Value.call({0x1a8dfc0?, 0xc0017a43c0?, 0x1c5efb2f198?}, {0x1b85371, 0x4}, {0xc0009fc060, 0x1, 0x0?})
|
|
||||||
// C:/Program Files/Go/src/reflect/value.go:586 +0xb0b
|
|
||||||
// reflect.Value.Call({0x1a8dfc0?, 0xc0017a43c0?, 0xc000f687c0?}, {0xc0009fc060?, 0xc001076630?, 0x0?})
|
|
||||||
// C:/Program Files/Go/src/reflect/value.go:370 +0xbc
|
|
||||||
// github.com/dop251/goja.(*Runtime).wrapReflectFunc.func1({{0x2139e58, 0xc0017a43f0}, {0xc000110aa0, 0x1, 0x46}})
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/runtime.go:2056 +0x3dc
|
|
||||||
// github.com/dop251/goja.(*nativeFuncObject).vmCall(0xc001784780, 0xc001312240, 0x1)
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/func.go:559 +0x1af
|
|
||||||
// github.com/dop251/goja.call.exec(0x5?, 0xc001312240)
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/vm.go:3366 +0x6a
|
|
||||||
// github.com/dop251/goja.(*vm).run(0xc001312240)
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/vm.go:582 +0x62
|
|
||||||
// github.com/dop251/goja.(*vm).runTryInner(0x1b16220?)
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/vm.go:834 +0x70
|
|
||||||
// github.com/dop251/goja.(*vm).runTry(0xc001312240)
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/vm.go:820 +0x1c9
|
|
||||||
// github.com/dop251/goja.(*Runtime).RunProgram(0xc000b89c00, 0xc000ef1f20)
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja@v0.0.0-20230605162241-28ee0ee714f3/runtime.go:1513 +0x48d
|
|
||||||
// github.com/cdle/sillyplus/core.initPlugin.func3.1(0xc000b89c00)
|
|
||||||
// C:/Users/Administrator/Desktop/sillyplus/core/plugin_core.go:585 +0x61d
|
|
||||||
// github.com/dop251/goja_nodejs/eventloop.(*EventLoop).Run(0xc001583b00, 0xc00126df20)
|
|
||||||
// C:/Users/Administrator/go/pkg/mod/github.com/dop251/goja_nodejs@v0.0.0-20230602164024-804a84515562/eventloop/eventloop.go:203 +0x37
|
|
||||||
// github.com/cdle/sillyplus/core.initPlugin.func3({0x2141bb8, 0xc001312120}, 0x0)
|
|
||||||
// C:/Users/Administrator/Desktop/sillyplus/core/plugin_core.go:511 +0x126
|
|
||||||
// github.com/cdle/sillyplus/core.AddCommand.func1(0xc000ac1d40)
|
|
||||||
// C:/Users/Administrator/Desktop/sillyplus/core/function.go:372 +0xcb
|
|
||||||
// created by github.com/cdle/sillyplus/core.AddCommand
|
|
||||||
// C:/Users/Administrator/Desktop/sillyplus/core/function.go:369 +0xfe
|
|
||||||
|
|||||||
@@ -137,3 +137,8 @@ func (b *Buffer) Join(sep []byte, buffers ...[]byte) []byte {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func bufferModule(vm *goja.Runtime, module *goja.Object) {
|
||||||
|
o := module.Get("exports").(*goja.Object)
|
||||||
|
o.Set("Buffer", &BufferObj{vm: vm})
|
||||||
|
}
|
||||||
|
|||||||
+3
-15
@@ -114,6 +114,7 @@ func SetPluginMethod(vm *goja.Runtime, uuid string, on_start bool, running func(
|
|||||||
return JsBucket(vm, name, uuid, on_start)
|
return JsBucket(vm, name, uuid, on_start)
|
||||||
})
|
})
|
||||||
registry := require.NewRegistry(require.WithLoader(mapFileSystemSourceLoader(uuid)))
|
registry := require.NewRegistry(require.WithLoader(mapFileSystemSourceLoader(uuid)))
|
||||||
|
|
||||||
if on_start {
|
if on_start {
|
||||||
var ids = &[]cron.EntryID{}
|
var ids = &[]cron.EntryID{}
|
||||||
crons.Store(uuid, ids)
|
crons.Store(uuid, ids)
|
||||||
@@ -156,21 +157,8 @@ func SetPluginMethod(vm *goja.Runtime, uuid string, on_start bool, running func(
|
|||||||
return o
|
return o
|
||||||
})
|
})
|
||||||
|
|
||||||
// registry.RegisterNativeModule("express", func(runtime *goja.Runtime, module *goja.Object) {
|
registry.RegisterNativeModule("crypto", cryptoModule)
|
||||||
// o := module.Get("exports").(*goja.Object)
|
registry.RegisterNativeModule("buffer", bufferModule)
|
||||||
// methods := []string{"get", "post", "delete", "put", "fetch"}
|
|
||||||
// for i := range methods {
|
|
||||||
// method := methods[i]
|
|
||||||
// o.Set(method, func(path string, handles ...func(*Request, *Response)) {
|
|
||||||
// webs = append(webs, Web{
|
|
||||||
// uuid: uuid,
|
|
||||||
// method: strings.ToUpper(method),
|
|
||||||
// path: path,
|
|
||||||
// handles: handles,
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
vm.Set("gofor", func(running func() bool, handle func()) {
|
vm.Set("gofor", func(running func() bool, handle func()) {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
|||||||
Reference in New Issue
Block a user