add configs from file, continue develpoment on hubs
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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,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,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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user