Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kill figma spline #4579

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 2 additions & 32 deletions apps/api/src/lib/oembed/meta/generateIframe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,11 @@ const knownSites = [
'kick.com',
'open.spotify.com',
'soundcloud.com',
'oohlala.xyz',
'my.spline.design',
'www.figma.com',
'figma.com'
'oohlala.xyz'
];

// URLs that are manually picked to be embedded that dont have embed metatags
const pickUrlSites = [
'open.spotify.com',
'kick.com',
'my.spline.design',
'www.figma.com',
'figma.com'
];
const pickUrlSites = ['open.spotify.com', 'kick.com'];

// URLs that should not have query params removed
const skipClean = ['youtube.com', 'youtu.be'];
Expand All @@ -38,9 +29,6 @@ const tapeRegex =
/^https?:\/\/tape\.xyz\/watch\/[\dA-Za-z-]+(\?si=[\dA-Za-z]+)?$/;
const twitchRegex = /^https?:\/\/www\.twitch\.tv\/videos\/[\dA-Za-z-]+$/;
const kickRegex = /^https?:\/\/kick\.com\/[\dA-Za-z-]+$/;
const splineRegex = /^https?:\/\/my\.spline\.design\/[\dA-Za-z-]+\/?$/;
const figmaRegex =
/^https:\/\/(www\.)?figma\.com\/(file|proto)\/[^/]+\/[^/?]+\/?$/;

const generateIframe = (
embedUrl: null | string,
Expand All @@ -57,8 +45,6 @@ const generateIframe = (
return null;
}

console.log('figmaRegex', figmaRegex.test(cleanedUrl));

switch (hostname) {
case 'youtube.com':
case 'youtu.be': {
Expand Down Expand Up @@ -122,22 +108,6 @@ const generateIframe = (

return null;
}
case 'my.spline.design': {
if (splineRegex.test(cleanedUrl)) {
return `<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" src="${pickedUrl}" ${universalSize}></iframe>`;
}

return null;
}
case 'figma.com':
case 'www.figma.com': {
if (figmaRegex.test(cleanedUrl)) {
const figmaUrl = `https://www.figma.com/embed?embed_host=share&url=${cleanedUrl}`;
return `<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" src="${figmaUrl}" ${universalSize} allowfullscreen></iframe>`;
}

return null;
}
default:
return `<iframe src="${pickedUrl}" width="560"></iframe>`;
}
Expand Down