- three destinations for info panel thumbnails : the panel image preview, new page, external page (URL). Two destinations for other elements (other page, external URL) - toggle for info panel media opening (fullscreen or in the panel) - ability to replace background with info panel media (image, video, 360 panorama) - ability to make 360 panorama as page background - global mute button -
53 lines
1.2 KiB
TypeScript
53 lines
1.2 KiB
TypeScript
/**
|
|
* Helpers for trusted third-party embed URLs.
|
|
*/
|
|
|
|
const ALLOWED_EMBED_DOMAINS = [
|
|
'matterport.com',
|
|
'my.matterport.com',
|
|
'kuula.co',
|
|
'roundme.com',
|
|
'sketchfab.com',
|
|
'youtube.com',
|
|
'www.youtube.com',
|
|
'vimeo.com',
|
|
'player.vimeo.com',
|
|
'google.com',
|
|
'maps.google.com',
|
|
'www.google.com',
|
|
'docs.google.com',
|
|
'drive.google.com',
|
|
'360stories.com',
|
|
];
|
|
|
|
export const isValidEmbedUrl = (url: string): boolean => {
|
|
try {
|
|
const parsed = new URL(url);
|
|
return ALLOWED_EMBED_DOMAINS.some(
|
|
(domain) =>
|
|
parsed.hostname === domain || parsed.hostname.endsWith(`.${domain}`),
|
|
);
|
|
} catch {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
export const buildChromeFreeEmbedUrl = (url: string): string => {
|
|
try {
|
|
const parsed = new URL(url);
|
|
const hostname = parsed.hostname.replace(/^www\./, '');
|
|
|
|
if (hostname === 'kuula.co' || hostname.endsWith('.kuula.co')) {
|
|
parsed.searchParams.set('logo', '-1');
|
|
parsed.searchParams.set('info', '0');
|
|
parsed.searchParams.set('fs', '0');
|
|
parsed.searchParams.set('vr', '0');
|
|
parsed.searchParams.set('thumbs', '-1');
|
|
}
|
|
|
|
return parsed.toString();
|
|
} catch {
|
|
return url;
|
|
}
|
|
};
|