Support usernames with dashes

This commit is contained in:
blankie 2024-02-15 16:12:04 +11:00
parent d69ad198c1
commit fa81c73994
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 4 additions and 2 deletions

View File

@ -9,7 +9,8 @@
#define DOMAIN_RE "(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}" #define DOMAIN_RE "(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}"
// https://docs.joinmastodon.org/methods/accounts/#422-unprocessable-entity // 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 ")?" #define ACCT_RE USERNAME_RE "(?:@" DOMAIN_RE ")?"
int main(int argc, char** argv) { int main(int argc, char** argv) {

View File

@ -9,7 +9,8 @@
#define DOMAIN_RE "(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}" #define DOMAIN_RE "(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}"
// https://docs.joinmastodon.org/methods/accounts/#422-unprocessable-entity // 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; using json = nlohmann::json;
static time_t parse_rfc3339(const std::string& str); static time_t parse_rfc3339(const std::string& str);