package rest import ( "net/http" "goAuth/internal/user" ) // avatarLimitsResponse describes the constraints applied to avatar uploads so // the frontend can mirror them (file picker filter, size hint and client-side // pre-validation) without hardcoding values. type avatarLimitsResponse struct { MaxSizeBytes int `json:"maxSizeBytes"` MaxWidth int `json:"maxWidth"` MaxHeight int `json:"maxHeight"` AllowedMimeTypes []string `json:"allowedMimeTypes"` } type configResponse struct { Avatar avatarLimitsResponse `json:"avatar"` } // getConfig exposes public, non-secret limits used by the frontend. It is // served on the public chain so the CSRF cookie is seeded on this GET request // as well. func (h *Handler) getConfig(w http.ResponseWriter, r *http.Request) { writeJson(w, http.StatusOK, configResponse{ Avatar: avatarLimitsResponse{ MaxSizeBytes: user.MaxImageSize, MaxWidth: user.MaxImageWidth, MaxHeight: user.MaxImageHeight, AllowedMimeTypes: user.AllowedAvatarMIMETypes(), }, }) }