This commit is contained in:
aggie 2025-11-19 22:21:08 -05:00
parent ebc23d652f
commit 3a91ee6264

View file

@ -16,7 +16,7 @@ type Status struct {
Content string Content string
Face string Face string
CreatedAt time.Time CreatedAt time.Time
Number int `json:"number"` Number int `db:"number" json:"number"`
} }
var urlRegexp = regexp.MustCompile(`https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)`) var urlRegexp = regexp.MustCompile(`https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)`)
@ -34,7 +34,7 @@ func (s Status) ContentDisplay() string {
if userRegexp.MatchString(s.Content) { if userRegexp.MatchString(s.Content) {
matches := userRegexp.FindAllStringSubmatch(s.Content, -1) matches := userRegexp.FindAllStringSubmatch(s.Content, -1)
for _, m := range matches { for _, m := range matches {
content = strings.Replace(content, m[0], fmt.Sprintf("<a href=\"https://status.cafe/users/%s\" target=\"_blank\">%s</a>", m[1], m[0]), 1) content = strings.Replace(content, m[0], fmt.Sprintf("<a href=\"https://sillywordz.kissing.computer/users/%s\" target=\"_blank\">%s</a>", m[1], m[0]), 1)
} }
} }
return content return content
@ -45,8 +45,8 @@ func (s Status) ContentHtml() template.HTML {
} }
func (s Status) Validate() error { func (s Status) Validate() error {
if len(s.Content) == 0 { if s.Number == 0 {
return errors.New("content is empty") return errors.New("u gotta add a count man")
} }
return nil return nil
} }