change message sending to work via http

This commit is contained in:
gitGnome
2026-03-30 14:05:29 +02:00
parent 8f9503bbab
commit 5351d9686f
3 changed files with 31 additions and 38 deletions
+8 -4
View File
@@ -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)
}