mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 13:02:25 -05:00
[feature] Configurable custom css length (#1827)
* [feature] Make accounts custom css length configurable * test custom css validation
This commit is contained in:
parent
45f961a9fe
commit
fc524f8cf1
9 changed files with 174 additions and 89 deletions
|
|
@ -41,7 +41,6 @@ const (
|
|||
maximumDescriptionLength = 5000
|
||||
maximumSiteTermsLength = 5000
|
||||
maximumUsernameLength = 64
|
||||
maximumCustomCSSLength = 5000
|
||||
maximumEmojiCategoryLength = 64
|
||||
maximumProfileFieldLength = 255
|
||||
maximumProfileFields = 6
|
||||
|
|
@ -170,9 +169,11 @@ func CustomCSS(customCSS string) error {
|
|||
return errors.New("accounts-allow-custom-css is not enabled for this instance")
|
||||
}
|
||||
|
||||
maximumCustomCSSLength := config.GetAccountsCustomCSSLength()
|
||||
if length := len([]rune(customCSS)); length > maximumCustomCSSLength {
|
||||
return fmt.Errorf("custom_css must be less than %d characters, but submitted custom_css was %d characters", maximumCustomCSSLength, length)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue