Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
raikasdev committed Nov 24, 2022
1 parent 8c50094 commit 301aec3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chrome/m4redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var chrome;
// If someone knows a better way to detect Mastodon4 instances, please send me a message!
// [email protected]
const MASTODON_DIV = document.getElementById("mastodon");
const EXTERNAL_USER_REGEX = /^(@[a-zA-Z0-9_]+)(?!.*@)(?!\/.+)$/; // @username matches, @[email protected] @username/following doesn't
const EXTERNAL_USER_REGEX = /^\/(@[a-zA-Z0-9_]+)(?!.*@)(?!\/.+)$/; // @username matches, @[email protected] @username/following doesn't
const EXTERNAL_POST_REGEX = /(@[a-zA-Z0-9_]+)(?!.*@)\/(\d+)/; // @username matches, @[email protected] doesn't

if (MASTODON_DIV) {
Expand Down
2 changes: 1 addition & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "Mastodon4 Redirect",
"version": "1.3",
"version": "1.4",
"description": "Redirects users from Mastodon4 supported instances to their home instance",
"icons": {
"16": "icon-16.png",
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Mastodon4 Redirect",
"version": "1.3",
"version": "1.4",
"description": "Redirects users from Mastodon4 supported instances to their home instance",
"icons": {
"48": "icon.svg",
Expand Down
2 changes: 1 addition & 1 deletion src/m4redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var chrome;
// If someone knows a better way to detect Mastodon4 instances, please send me a message!
// [email protected]
const MASTODON_DIV = document.getElementById("mastodon");
const EXTERNAL_USER_REGEX = /^(@[a-zA-Z0-9_]+)(?!.*@)(?!\/.+)$/; // @username matches, @[email protected] @username/following doesn't
const EXTERNAL_USER_REGEX = /^\/(@[a-zA-Z0-9_]+)(?!.*@)(?!\/.+)$/; // @username matches, @[email protected] @username/following doesn't
const EXTERNAL_POST_REGEX = /(@[a-zA-Z0-9_]+)(?!.*@)\/(\d+)/; // @username matches, @[email protected] doesn't

if (MASTODON_DIV) {
Expand Down

0 comments on commit 301aec3

Please sign in to comment.