Fix links to users and communities not including query in hyperlink (#2368)

Co-authored-by: SleeplessOne1917 <insomnia-void@protonmail.com>
This commit is contained in:
SleeplessOne1917 2024-02-16 22:59:26 +00:00 committed by GitHub
parent 5eb97edf09
commit 72b3d6b828
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 3 deletions

@ -1 +1 @@
Subproject commit 91563f222284e19def549ac5247039b398c78931
Subproject commit 6c03b403c79bc5a893527d1fe217690db774a7ef

View file

@ -33,6 +33,8 @@ export const authCookieName = "jwt";
// page on route "/communities"
export const communityLimit = 50;
const queryPairRegex = "[a-zA-Zd_-]+=[a-zA-Zd+-_]+";
/**
* Accepted formats:
* !community@server.com
@ -40,7 +42,9 @@ export const communityLimit = 50;
* /m/community@server.com
* /u/username@server.com
*/
export const instanceLinkRegex =
/(\/[cmu]\/|!)[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;
export const instanceLinkRegex = new RegExp(
`(/[cmu]/|!)[a-zA-Z\\d._%+-]+@[a-zA-Z\\d.-]+\\.[a-zA-Z]{2,}(?:/?\\?${queryPairRegex}(?:&${queryPairRegex})*)?`,
"g",
);
export const testHost = "0.0.0.0:8536";