add configs from file, continue develpoment on hubs

This commit is contained in:
2026-04-23 14:34:47 +02:00
parent 35827f7214
commit 8a66a905cb
13 changed files with 151 additions and 82 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ import (
"go-socket/packages/Enums/ConnectionState"
"go-socket/packages/Enums/WsEventType"
"go-socket/packages/cache"
"go-socket/packages/config"
"go-socket/packages/convertions"
"go-socket/packages/globals"
"go-socket/packages/postgresql"
"go-socket/packages/types"
"go-socket/packages/wsServer"
@@ -158,7 +158,7 @@ func HandleUserGetConnectionMessages(response http.ResponseWriter, request *http
messagesCap, err := convertions.StringToUint32(request.URL.Query().Get("messages"))
if err != nil {
messagesCap = globals.MaxDirectMsgCache
messagesCap = config.MaxDirectMsgCache
}
buffer, bufferSize := conn.GetSortedMessagesBuff()
+3 -3
View File
@@ -5,8 +5,8 @@ import (
"net/http"
"strings"
"go-socket/packages/config"
"go-socket/packages/convertions"
"go-socket/packages/globals"
"go-socket/packages/minio"
)
@@ -22,9 +22,9 @@ func HandleAttachmentFileUpload(response http.ResponseWriter, request *http.Requ
return
}
request.Body = http.MaxBytesReader(response, request.Body, int64(globals.MaxRequestWithFileBytes))
request.Body = http.MaxBytesReader(response, request.Body, int64(config.MaxRequestWithFileBytes))
if err = request.ParseMultipartForm(int64(globals.MaxRequestBytes)); err != nil {
if err = request.ParseMultipartForm(int64(config.MaxRequestBytes)); err != nil {
http.Error(response, "invalid multipart form", http.StatusBadRequest)
return
}
+5 -5
View File
@@ -5,7 +5,7 @@ import (
"net/http"
"strings"
"go-socket/packages/globals"
"go-socket/packages/config"
)
type postType uint8
@@ -21,13 +21,13 @@ func validCheckWithResponseOnFail(response *http.ResponseWriter, request *http.R
var maxSize int64
switch pt {
case file:
maxSize = int64(globals.MaxRequestWithFileBytes)
maxSize = int64(config.MaxRequestWithFileBytes)
case avatar:
maxSize = int64(globals.MaxRequestWithAvatarBytes)
maxSize = int64(config.MaxRequestWithAvatarBytes)
case profileBg:
maxSize = int64(globals.MaxRequestWithProfileBgBytes)
maxSize = int64(config.MaxRequestWithProfileBgBytes)
default:
maxSize = int64(globals.MaxRequestBytes)
maxSize = int64(config.MaxRequestBytes)
}
if request.ContentLength > maxSize {
+5 -5
View File
@@ -5,8 +5,8 @@ import (
"net/http"
"time"
"go-socket/packages/config"
"go-socket/packages/convertions"
"go-socket/packages/globals"
"go-socket/packages/minio"
"go-socket/packages/cache"
@@ -202,9 +202,9 @@ func HandleUserModAvatar(response http.ResponseWriter, request *http.Request) {
return
}
request.Body = http.MaxBytesReader(response, request.Body, int64(globals.MaxRequestWithAvatarBytes))
request.Body = http.MaxBytesReader(response, request.Body, int64(config.MaxRequestWithAvatarBytes))
if err = request.ParseMultipartForm(int64(globals.MaxRequestBytes)); err != nil {
if err = request.ParseMultipartForm(int64(config.MaxRequestBytes)); err != nil {
http.Error(response, "invalid multipart form", http.StatusBadRequest)
return
}
@@ -265,9 +265,9 @@ func HandleUserModProfileBg(response http.ResponseWriter, request *http.Request)
return
}
request.Body = http.MaxBytesReader(response, request.Body, int64(globals.MaxRequestWithProfileBgBytes))
request.Body = http.MaxBytesReader(response, request.Body, int64(config.MaxRequestWithProfileBgBytes))
if err = request.ParseMultipartForm(int64(globals.MaxRequestBytes)); err != nil {
if err = request.ParseMultipartForm(int64(config.MaxRequestBytes)); err != nil {
http.Error(response, "invalid multipart form", http.StatusBadRequest)
return
}