From fa81c739942d479b55e0226194239622645c0bdb Mon Sep 17 00:00:00 2001 From: blankie Date: Thu, 15 Feb 2024 16:12:04 +1100 Subject: [PATCH] Support usernames with dashes --- main.cpp | 3 ++- models.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 39bbb49..63f07b0 100644 --- a/main.cpp +++ b/main.cpp @@ -9,7 +9,8 @@ #define DOMAIN_RE "(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}" // https://docs.joinmastodon.org/methods/accounts/#422-unprocessable-entity -#define USERNAME_RE "[a-zA-Z0-9_]+" +// https://akko.erincandescent.net/@postmaster-emeritus +#define USERNAME_RE "[a-zA-Z0-9\\-_]+" #define ACCT_RE USERNAME_RE "(?:@" DOMAIN_RE ")?" int main(int argc, char** argv) { diff --git a/models.cpp b/models.cpp index 0c66ea6..6ccd2b8 100644 --- a/models.cpp +++ b/models.cpp @@ -9,7 +9,8 @@ #define DOMAIN_RE "(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}" // https://docs.joinmastodon.org/methods/accounts/#422-unprocessable-entity -#define USERNAME_RE "[a-zA-Z0-9_]+" +// https://akko.erincandescent.net/@postmaster-emeritus +#define USERNAME_RE "[a-zA-Z0-9\\-_]+" using json = nlohmann::json; static time_t parse_rfc3339(const std::string& str);