mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-06-19 13:40:43 +00:00
This should be quicker, because it queries the users in one go instead of jumping straight to iterating over them, and it checks if a user blocks the poster before allowing them to be tagged.
12 lines
455 B
Python
12 lines
455 B
Python
""" defining regexes for regularly used concepts """
|
|
|
|
DOMAIN = r"[\w_\-\.]+\.[a-z\-]{2,}"
|
|
LOCALNAME = r"@?[a-zA-Z_\-\.0-9]+"
|
|
STRICT_LOCALNAME = r"@[a-zA-Z_\-\.0-9]+"
|
|
USERNAME = rf"{LOCALNAME}(@{DOMAIN})?"
|
|
STRICT_USERNAME = rf"(\B{STRICT_LOCALNAME}(@{DOMAIN})?\b)"
|
|
FULL_USERNAME = rf"{LOCALNAME}@{DOMAIN}\b"
|
|
SLUG = r"/s/(?P<slug>[-_a-z0-9]*)"
|
|
# should match (BookWyrm/1.0.0; or (BookWyrm/99.1.2;
|
|
BOOKWYRM_USER_AGENT = r"\(BookWyrm/[0-9]+\.[0-9]+\.[0-9]+;"
|