added to thumbnail & image url
Signed-off-by: Ben Hall <ben@benh.codes>
This commit is contained in:
parent
98901b0714
commit
474a9bd408
@ -4,6 +4,10 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/TicketsBot/GoPanel/app"
|
||||
"github.com/TicketsBot/GoPanel/app/http/validation"
|
||||
"github.com/TicketsBot/GoPanel/app/http/validation/defaults"
|
||||
@ -15,9 +19,6 @@ import (
|
||||
"github.com/rxdn/gdl/objects/channel"
|
||||
"github.com/rxdn/gdl/objects/guild"
|
||||
"github.com/rxdn/gdl/objects/interaction/component"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func ApplyPanelDefaults(data *panelBody) {
|
||||
@ -171,7 +172,9 @@ var urlRegex = regexp.MustCompile(`^https?://([-a-zA-Z0-9@:%._+~#=]{1,256})\.[a-
|
||||
func validateNullableUrl(url *string) validation.ValidationFunc {
|
||||
return func() error {
|
||||
if url != nil && (len(*url) > 255 || !urlRegex.MatchString(*url)) {
|
||||
return validation.NewInvalidInputError("Invalid URL")
|
||||
if *url != "%avatar_url%" {
|
||||
return validation.NewInvalidInputError("Invalid URL")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -12,8 +12,8 @@ type CustomEmbed struct {
|
||||
Url *string `json:"url" validate:"omitempty,url,max=255"`
|
||||
Colour Colour `json:"colour" validate:"gte=0,lte=16777215"`
|
||||
Author Author `json:"author" validate:"dive"`
|
||||
ImageUrl *string `json:"image_url" validate:"omitempty,url,max=255"`
|
||||
ThumbnailUrl *string `json:"thumbnail_url" validate:"omitempty,url,max=255"`
|
||||
ImageUrl *string `json:"image_url" validate:"omitempty,max=255"`
|
||||
ThumbnailUrl *string `json:"thumbnail_url" validate:"omitempty,max=255"`
|
||||
Footer Footer `json:"footer" validate:"dive"`
|
||||
Timestamp *DateTimeLocal `json:"timestamp" validate:"omitempty"`
|
||||
Fields []Field `json:"fields" validate:"dive,max=25"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user