x
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
|
||||
"github.com/cdle/sillyplus/core/common"
|
||||
"github.com/cdle/sillyplus/core/logs"
|
||||
"github.com/cdle/sillyplus/proto3/srpc"
|
||||
"github.com/cdle/sillyplus/utils"
|
||||
"github.com/dop251/goja"
|
||||
// "golang.org/x/image/webp"
|
||||
@@ -47,6 +49,21 @@ type Console struct {
|
||||
var console = &Console{}
|
||||
var Logs = &Console{}
|
||||
|
||||
func (sg *SillyGirlService) Console(ctx context.Context, req *srpc.ConsoleRequest) (*srpc.Empty, error) {
|
||||
log := &Console{
|
||||
UUID: req.PluginId,
|
||||
}
|
||||
switch req.Type {
|
||||
case "info", "log":
|
||||
log.Info(req.Content)
|
||||
case "error":
|
||||
log.Error(req.Content)
|
||||
case "debug":
|
||||
log.Debug(req.Content)
|
||||
}
|
||||
return &srpc.Empty{}, nil
|
||||
}
|
||||
|
||||
func pluginConsole(uuid string) *Console {
|
||||
return &Console{
|
||||
UUID: uuid,
|
||||
|
||||
Reference in New Issue
Block a user