summaryrefslogtreecommitdiff
path: root/internal/regexes/regexes.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/regexes/regexes.go')
-rw-r--r--internal/regexes/regexes.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/regexes/regexes.go b/internal/regexes/regexes.go
index aca502345..799557657 100644
--- a/internal/regexes/regexes.go
+++ b/internal/regexes/regexes.go
@@ -38,6 +38,7 @@ const (
follow = "follow"
blocks = "blocks"
reports = "reports"
+ accepts = "accepts"
schemes = `(http|https)://` // Allowed URI protocols for parsing links in text.
alphaNumeric = `\p{L}\p{M}*|\p{N}` // A single number or script character in any language, including chars with accents.
@@ -71,6 +72,7 @@ const (
followPath = userPathPrefix + `/` + follow + `/(` + ulid + `)$`
likePath = userPathPrefix + `/` + liked + `/(` + ulid + `)$`
statusesPath = userPathPrefix + `/` + statuses + `/(` + ulid + `)$`
+ acceptsPath = userPathPrefix + `/` + accepts + `/(` + ulid + `)$`
blockPath = userPathPrefix + `/` + blocks + `/(` + ulid + `)$`
reportPath = `^/?` + reports + `/(` + ulid + `)$`
filePath = `^/?(` + ulid + `)/([a-z]+)/([a-z]+)/(` + ulid + `)\.([a-z0-9]+)$`
@@ -158,6 +160,10 @@ var (
// from eg /reports/01GP3AWY4CRDVRNZKW0TEAMB5R
ReportPath = regexp.MustCompile(reportPath)
+ // ReportPath parses a path that validates and captures the username part and the ulid part
+ // from eg /users/example_username/accepts/01GP3AWY4CRDVRNZKW0TEAMB5R
+ AcceptsPath = regexp.MustCompile(acceptsPath)
+
// FilePath parses a file storage path of the form [ACCOUNT_ID]/[MEDIA_TYPE]/[MEDIA_SIZE]/[FILE_NAME]
// eg 01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01F8MH8RMYQ6MSNY3JM2XT1CQ5.jpeg
// It captures the account id, media type, media size, file name, and file extension, eg