diff options
author | 2023-01-10 15:19:05 +0100 | |
---|---|---|
committer | 2023-01-10 14:19:05 +0000 | |
commit | d6487933c758be647bff7a568d6a33e6155e6599 (patch) | |
tree | fbc2d466dc2d0833a7ceec1200643e78dae4f916 /internal/regexes/regexes.go | |
parent | [chore] Bump json5 from 1.0.1 to 1.0.2 in /web/source (#1308) (diff) | |
download | gotosocial-d6487933c758be647bff7a568d6a33e6155e6599.tar.xz |
[feature] Implement Report database model and utility functions (#1310)
* implement report database model
* implement report cache + config changes
* implement report database functions
* report uri / regex functions
* update envparsing test
* remove unnecessary uri index
* remove unused function + cache lookup
* process error when storing report
Diffstat (limited to 'internal/regexes/regexes.go')
-rw-r--r-- | internal/regexes/regexes.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/internal/regexes/regexes.go b/internal/regexes/regexes.go index 8c5b0b601..4c9d48dac 100644 --- a/internal/regexes/regexes.go +++ b/internal/regexes/regexes.go @@ -36,12 +36,10 @@ const ( followers = "followers" following = "following" liked = "liked" - // collections = "collections" - // featured = "featured" publicKey = "main-key" follow = "follow" - // update = "updates" - blocks = "blocks" + blocks = "blocks" + reports = "reports" ) const ( @@ -141,6 +139,11 @@ var ( // from eg /users/example_username/blocks/01F7XT5JZW1WMVSW1KADS8PVDH BlockPath = regexp.MustCompile(blockPath) + reportPath = fmt.Sprintf(`^/?%s/(%s)$`, reports, ulid) + // ReportPath parses a path that validates and captures the ulid part + // from eg /reports/01GP3AWY4CRDVRNZKW0TEAMB5R + ReportPath = regexp.MustCompile(reportPath) + filePath = fmt.Sprintf(`^(%s)/([a-z]+)/([a-z]+)/(%s)\.([a-z]+)$`, ulid, ulid) // FilePath parses a file storage path of the form [ACCOUNT_ID]/[MEDIA_TYPE]/[MEDIA_SIZE]/[FILE_NAME] // eg 01F8MH1H7YV1Z7D2C8K2730QBF/attachment/small/01F8MH8RMYQ6MSNY3JM2XT1CQ5.jpeg |