mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-01 21:22:24 -05:00
move to ulid
This commit is contained in:
parent
625e6d654c
commit
26ee190338
51 changed files with 398 additions and 514 deletions
|
|
@ -85,21 +85,20 @@ var (
|
|||
// followingPathRegex parses a path that validates and captures the username part from eg /users/example_username/following
|
||||
followingPathRegex = regexp.MustCompile(followingPathRegexString)
|
||||
|
||||
// see https://ihateregex.io/expr/uuid/
|
||||
uuidRegexString = `[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}`
|
||||
ulidRegexString = `[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}`
|
||||
|
||||
likedPathRegexString = fmt.Sprintf(`^/?%s/(%s)/%s$`, UsersPath, usernameRegexString, LikedPath)
|
||||
// likedPathRegex parses a path that validates and captures the username part from eg /users/example_username/liked
|
||||
likedPathRegex = regexp.MustCompile(likedPathRegexString)
|
||||
|
||||
likePathRegexString = fmt.Sprintf(`^/?%s/(%s)/%s/(%s)$`, UsersPath, usernameRegexString, LikedPath, uuidRegexString)
|
||||
// likePathRegex parses a path that validates and captures the username part and the uuid part
|
||||
// from eg /users/example_username/liked/123e4567-e89b-12d3-a456-426655440000.
|
||||
likePathRegexString = fmt.Sprintf(`^/?%s/(%s)/%s/(%s)$`, UsersPath, usernameRegexString, LikedPath, ulidRegexString)
|
||||
// likePathRegex parses a path that validates and captures the username part and the ulid part
|
||||
// from eg /users/example_username/like/01F7XT5JZW1WMVSW1KADS8PVDH
|
||||
likePathRegex = regexp.MustCompile(likePathRegexString)
|
||||
|
||||
statusesPathRegexString = fmt.Sprintf(`^/?%s/(%s)/%s/(%s)$`, UsersPath, usernameRegexString, StatusesPath, uuidRegexString)
|
||||
// statusesPathRegex parses a path that validates and captures the username part and the uuid part
|
||||
// from eg /users/example_username/statuses/123e4567-e89b-12d3-a456-426655440000.
|
||||
statusesPathRegexString = fmt.Sprintf(`^/?%s/(%s)/%s/(%s)$`, UsersPath, usernameRegexString, StatusesPath, ulidRegexString)
|
||||
// statusesPathRegex parses a path that validates and captures the username part and the ulid part
|
||||
// from eg /users/example_username/statuses/01F7XT5JZW1WMVSW1KADS8PVDH
|
||||
// The regex can be played with here: https://regex101.com/r/G9zuxQ/1
|
||||
statusesPathRegex = regexp.MustCompile(statusesPathRegexString)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue