Improve reliability of embed regex (missing start char)

This commit is contained in:
Tom Moor
2023-07-08 12:04:03 -04:00
parent 6bc1b789ee
commit 98a182c892
10 changed files with 13 additions and 11 deletions

View File

@@ -15,8 +15,8 @@ function Abstract(props: Props) {
}
Abstract.ENABLED = [
new RegExp("https?://share\\.(?:go)?abstract\\.com/(.*)$"),
new RegExp("https?://app\\.(?:go)?abstract\\.com/(?:share|embed)/(.*)$"),
new RegExp("^https?://share\\.(?:go)?abstract\\.com/(.*)$"),
new RegExp("^https?://app\\.(?:go)?abstract\\.com/(?:share|embed)/(.*)$"),
];
export default Abstract;

View File

@@ -2,7 +2,7 @@ import * as React from "react";
import Frame from "../components/Frame";
import { EmbedProps as Props } from ".";
const URL_REGEX = new RegExp("https://airtable.com/(?:embed/)?(shr.*)$");
const URL_REGEX = new RegExp("^https://airtable.com/(?:embed/)?(shr.*)$");
function Airtable(props: Props) {
const { matches } = props.attrs;

View File

@@ -2,7 +2,7 @@ import * as React from "react";
import Frame from "../components/Frame";
import { EmbedProps as Props } from ".";
const URL_REGEX = new RegExp("https?://cawemo.com/(?:share|embed)/(.*)$");
const URL_REGEX = new RegExp("^https?://cawemo.com/(?:share|embed)/(.*)$");
export default function Cawemo(props: Props) {
const { matches } = props.attrs;

View File

@@ -17,4 +17,4 @@ export default function DBDiagram(props: Props) {
);
}
DBDiagram.ENABLED = [new RegExp("https://dbdiagram.io/(embed|d)/(\\w+)$")];
DBDiagram.ENABLED = [new RegExp("^https://dbdiagram.io/(embed|d)/(\\w+)$")];

View File

@@ -15,4 +15,6 @@ export default function Descript(props: Props) {
);
}
Descript.ENABLED = [new RegExp("https?://share\\.descript\\.com/view/(\\w+)$")];
Descript.ENABLED = [
new RegExp("^https?://share\\.descript\\.com/view/(\\w+)$"),
];

View File

@@ -15,7 +15,7 @@ function Figma(props: Props) {
Figma.ENABLED = [
new RegExp(
"https://([w.-]+\\.)?figma\\.com/(file|proto)/([0-9a-zA-Z]{22,128})(?:/.*)?$"
"^https://([w.-]+\\.)?figma\\.com/(file|proto)/([0-9a-zA-Z]{22,128})(?:/.*)?$"
),
];

View File

@@ -20,6 +20,6 @@ function JSFiddle(props: Props) {
);
}
JSFiddle.ENABLED = [new RegExp("https?://jsfiddle\\.net/(.*)/(.*)$")];
JSFiddle.ENABLED = [new RegExp("^https?://jsfiddle\\.net/(.*)/(.*)$")];
export default JSFiddle;

View File

@@ -14,6 +14,6 @@ function Otter(props: Props) {
);
}
Otter.ENABLED = [new RegExp("https?://otter\\.ai/[su]/(.*)$")];
Otter.ENABLED = [new RegExp("^https?://otter\\.ai/[su]/(.*)$")];
export default Otter;

View File

@@ -39,6 +39,6 @@ const SpotifyFrame = styled(Frame)`
border-radius: 13px;
`;
Spotify.ENABLED = [new RegExp("https?://open\\.spotify\\.com/(.*)$")];
Spotify.ENABLED = [new RegExp("^https?://open\\.spotify\\.com/(.*)$")];
export default Spotify;

View File

@@ -14,6 +14,6 @@ function Tldraw(props: Props) {
);
}
Tldraw.ENABLED = [new RegExp("https?://beta\\.tldraw\\.com/r/(.*)")];
Tldraw.ENABLED = [new RegExp("^https?://beta\\.tldraw\\.com/r/(.*)")];
export default Tldraw;