fix http group sending
This commit is contained in:
@@ -281,28 +281,37 @@ func HttpHandleGroupAddClient(response http.ResponseWriter, request *http.Reques
|
||||
}
|
||||
|
||||
func HttpHandleNewMessage(response http.ResponseWriter, request *http.Request) {
|
||||
if !isMethodAllowed(&response, request) {
|
||||
return
|
||||
}
|
||||
|
||||
token := request.FormValue("token")
|
||||
if token == "" {
|
||||
http.Error(response, "invalid token", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
targetStr := request.FormValue("subject")
|
||||
if targetStr == "" {
|
||||
http.Error(response, "invalid subject", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
targetId, err := ConvertStringUint32(targetStr)
|
||||
if err != nil {
|
||||
http.Error(response, "invalid subject", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
content := request.FormValue("content")
|
||||
if content == "" {
|
||||
http.Error(response, "invalid content", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
clientId, err := TokenValidateGetId(token)
|
||||
if err != nil {
|
||||
http.Error(response, "invalid token", http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
ctx := request.Context()
|
||||
err = WsSendToGroup(ctx, targetId, clientId, content)
|
||||
|
||||
Reference in New Issue
Block a user