Skip to content

Commit 431fc09

Browse files
committed
Generalized supademo REGEX
1 parent e9b0d45 commit 431fc09

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/common/constants.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const NEETO_RECORD_URL_REGEXP =
5353
/((?:http|https):\/\/)?(www\.)?[a-zA-Z0-9-]+\.(neetorecord\.com)\/(watch)\/([0-9a-f]{20})/;
5454

5555
export const SUPA_DEMO_URL_REGEXP =
56-
/((?:http|https):\/\/)?(www\.)?app\.(supademo\.com)\/(demo|embed)\/([0-9a-z]+)/;
56+
/((?:http|https):\/\/)?(www\.)?([a-zA-Z0-9-]+)\.([a-zA-Z0-9-]+\.[a-zA-Z0-9-]+)\/(demo|embed)\/([0-9a-z]+)/;
5757

5858
export const COMBINED_REGEX = new RegExp(
5959
pluck("source", [
@@ -92,7 +92,9 @@ export const URL_VALIDATORS = {
9292
supademo: url => {
9393
const match = url.match(SUPA_DEMO_URL_REGEXP);
9494

95-
return match && `https://app.supademo.com/embed/${match[5]}?embed_v=2`;
95+
return (
96+
match && `https://${match[3]}.${match[4]}/embed/${match[6]}?embed_v=2`
97+
);
9698
},
9799
};
98100

0 commit comments

Comments
 (0)