add windowid

This commit is contained in:
sawka 2022-06-16 15:51:41 -07:00
parent a5fedb3668
commit 862014bd82
2 changed files with 10 additions and 3 deletions

View File

@ -141,6 +141,7 @@ func WriteJsonSuccess(w http.ResponseWriter, data interface{}) {
type runCommandParams struct {
SessionId string `json:"sessionid"`
WindowId string `json:"windowid"`
Command string `json:"command"`
}
@ -174,7 +175,7 @@ func HandleRunCommand(w http.ResponseWriter, r *http.Request) {
WriteJsonError(w, fmt.Errorf("invalid emtpty command"))
return
}
rtnLine := sstore.MakeNewLineCmd(commandStr)
rtnLine := sstore.MakeNewLineCmd(params.SessionId, params.WindowId, commandStr)
runPacket := packet.MakeRunPacket()
runPacket.SessionId = params.SessionId
runPacket.CmdId = rtnLine.CmdId

View File

@ -12,6 +12,8 @@ const LineTypeCmd = "cmd"
const LineTypeText = "text"
type LineType struct {
SessionId string `json:"sessionid"`
WindowId string `json:"windowid"`
LineId int `json:"lineid"`
Ts int64 `json:"ts"`
UserId string `json:"userid"`
@ -22,8 +24,10 @@ type LineType struct {
CmdRemote string `json:"cmdremote,omitempty"`
}
func MakeNewLineCmd(cmdText string) *LineType {
func MakeNewLineCmd(sessionId string, windowId string, cmdText string) *LineType {
rtn := &LineType{}
rtn.SessionId = sessionId
rtn.WindowId = windowId
rtn.LineId = NextLineId
NextLineId++
rtn.Ts = time.Now().UnixMilli()
@ -34,8 +38,10 @@ func MakeNewLineCmd(cmdText string) *LineType {
return rtn
}
func MakeNewLineText(text string) *LineType {
func MakeNewLineText(sessionId string, windowId string, text string) *LineType {
rtn := &LineType{}
rtn.SessionId = sessionId
rtn.WindowId = windowId
rtn.LineId = NextLineId
NextLineId++
rtn.Ts = time.Now().UnixMilli()