change message sending to work via http
This commit is contained in:
@@ -299,8 +299,12 @@ func HttpHandleNewMessage(response http.ResponseWriter, request *http.Request) {
|
||||
http.Error(response, "invalid token", http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
subject := request.FormValue("subject")
|
||||
if subject == "" {
|
||||
targetStr := request.FormValue("subject")
|
||||
if targetStr == "" {
|
||||
http.Error(response, "invalid subject", http.StatusBadRequest)
|
||||
}
|
||||
targetId, err := ConvertStringUint32(targetStr)
|
||||
if err != nil {
|
||||
http.Error(response, "invalid subject", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
@@ -313,6 +317,6 @@ func HttpHandleNewMessage(response http.ResponseWriter, request *http.Request) {
|
||||
if err != nil {
|
||||
http.Error(response, "invalid token", http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
|
||||
ctx := request.Context()
|
||||
WsSendToGroup(ctx, targetId, clientId, content)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user