some lil fixes for kibou compatibility
This commit is contained in:
@ -85,6 +85,11 @@ var (
|
||||
// followingPathRegex parses a path that validates and captures the username part from eg /users/example_username/following
|
||||
followingPathRegex = regexp.MustCompile(followingPathRegexString)
|
||||
|
||||
followPathRegexString = fmt.Sprintf(`^/?%s/(%s)/%s/(%s)$`, UsersPath, usernameRegexString, FollowPath, ulidRegexString)
|
||||
// followPathRegex parses a path that validates and captures the username part and the ulid part
|
||||
// from eg /users/example_username/follow/01F7XT5JZW1WMVSW1KADS8PVDH
|
||||
followPathRegex = regexp.MustCompile(followPathRegexString)
|
||||
|
||||
ulidRegexString = `[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}`
|
||||
|
||||
likedPathRegexString = fmt.Sprintf(`^/?%s/(%s)/%s$`, UsersPath, usernameRegexString, LikedPath)
|
||||
|
||||
@ -189,6 +189,11 @@ func IsFollowingPath(id *url.URL) bool {
|
||||
return followingPathRegex.MatchString(id.Path)
|
||||
}
|
||||
|
||||
// IsFollowPath returns true if the given URL path corresponds to eg /users/example_username/follow/SOME_ULID_OF_A_FOLLOW
|
||||
func IsFollowPath(id *url.URL) bool {
|
||||
return followPathRegex.MatchString(id.Path)
|
||||
}
|
||||
|
||||
// IsLikedPath returns true if the given URL path corresponds to eg /users/example_username/liked
|
||||
func IsLikedPath(id *url.URL) bool {
|
||||
return likedPathRegex.MatchString(id.Path)
|
||||
|
||||
Reference in New Issue
Block a user