diff --git a/base/aaa/user.go b/base/aaa/user.go index 586b43c2..06234f9a 100644 --- a/base/aaa/user.go +++ b/base/aaa/user.go @@ -43,12 +43,14 @@ func _user_search(m *ice.Message, name, text string) { }) } -func UserRoot(m *ice.Message) { - m.Option(ice.MSG_USERROLE, ROOT) - m.Option(ice.MSG_USERNAME, ice.Info.UserName) +func UserRoot(m *ice.Message, arg ...string) { // password username userrole + userrole := kit.Select(ice.Info.UserName, arg, 2) + username := kit.Select(ice.Info.UserName, arg, 1) + m.Option(ice.MSG_USERROLE, userrole) + m.Option(ice.MSG_USERNAME, username) - if !_user_exists(m, ice.Info.UserName) { - _user_create(m, ROOT, ice.Info.UserName, "") + if !_user_exists(m, username) { + _user_create(m, userrole, username, kit.Select("", arg, 0)) } } func UserRole(m *ice.Message, username interface{}) (role string) { diff --git a/base/cli/runtime.go b/base/cli/runtime.go index 20a1ce33..7ad13ad4 100644 --- a/base/cli/runtime.go +++ b/base/cli/runtime.go @@ -55,6 +55,7 @@ func _runtime_init(m *ice.Message) { // 启动次数 count := kit.Int(m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT))) + 1 m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT), count) + m.Conf(RUNTIME, kit.Keys(BOOT, ice.BIN), m.Cmdx(SYSTEM, "which", os.Args[0])) // 节点信息 m.Conf(RUNTIME, kit.Keys(NODE, mdb.TIME), m.Time()) diff --git a/base/cli/system.go b/base/cli/system.go index e86aa958..e37fea5e 100644 --- a/base/cli/system.go +++ b/base/cli/system.go @@ -5,6 +5,7 @@ import ( "io" "os" "os/exec" + "strings" ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/ctx" @@ -63,7 +64,7 @@ func _system_exec(m *ice.Message, cmd *exec.Cmd) { defer func() { m.Push(CMD_OUT, out.String()) m.Push(CMD_ERR, err.String()) - m.Echo(kit.Select(out.String(), err.String())) + m.Echo(strings.TrimSpace(kit.Select(out.String(), err.String()))) }() cmd.Stdout, cmd.Stderr = out, err } diff --git a/base/web/render.go b/base/web/render.go index 75ed5f06..b2edef8c 100644 --- a/base/web/render.go +++ b/base/web/render.go @@ -86,7 +86,7 @@ func CookieName(url string) string { func RenderCookie(msg *ice.Message, value string, arg ...string) { // name path expire expire := time.Now().Add(kit.Duration(kit.Select(msg.Conf(aaa.SESS, "meta.expire"), arg, 2))) http.SetCookie(msg.W, &http.Cookie{Value: value, - Name: kit.Select(ice.MSG_SESSID, arg, 0), Path: kit.Select("/", arg, 1), Expires: expire}) + Name: kit.Select(CookieName(msg.Option(ice.MSG_USERWEB)), arg, 0), Path: kit.Select(ice.PS, arg, 1), Expires: expire}) } func RenderType(w http.ResponseWriter, name, mime string) { if mime != "" { diff --git a/base/web/serve.go b/base/web/serve.go index ceaab02d..b159f978 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -284,10 +284,11 @@ func init() { m.Config(kit.Keys(aaa.WHITE, k), ice.TRUE) } }}, - cli.START: {Name: "start dev name=ops proto=http host port=9020 nodename", Help: "启动", Hand: func(m *ice.Message, arg ...string) { + cli.START: {Name: "start dev name=ops proto=http host port=9020 nodename password username userrole", Help: "启动", Hand: func(m *ice.Message, arg ...string) { if cli.NodeInfo(m, SERVER, kit.Select(ice.Info.HostName, m.Option("nodename"))); m.Option(tcp.PORT) == tcp.RANDOM { m.Option(tcp.PORT, m.Cmdx(tcp.PORT, aaa.RIGHT)) } + aaa.UserRoot(m, m.Option(aaa.PASSWORD), m.Option(aaa.USERNAME), m.Option(aaa.USERROLE)) m.Target().Start(m, m.OptionSimple(mdb.NAME, tcp.HOST, tcp.PORT)...) m.Sleep300ms() diff --git a/core/code/vimer.go b/core/code/vimer.go index befa5faa..d1d5e6ee 100644 --- a/core/code/vimer.go +++ b/core/code/vimer.go @@ -22,11 +22,6 @@ func init() { m.Cmdy(AUTOGEN, mdb.CREATE, arg) }}, COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) { - defer m.ProcessInner() - if msg := m.Cmd(COMPILE, ice.SRC_MAIN_GO); !cli.IsSuccess(msg) { - _inner_make(m, msg) - return - } if msg := m.Cmd(COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN); !cli.IsSuccess(msg) { _inner_make(m, msg) return