Skip to content

Commit

Permalink
feature/deseng692: Updateded strictness of URL checks as per the Copi…
Browse files Browse the repository at this point in the history
…lot suggestion.
  • Loading branch information
jareth-whitney committed Sep 19, 2024
1 parent a434866 commit edc1833
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,20 @@ const VideoWidgetView = ({ widget }: VideoWidgetProps) => {
};

const getVideoSource = (url: string) => {
if (url.includes('youtube.com') || url.includes('youtu.be')) {
const hostname = new URL(url).hostname;
if ('youtube.com' === hostname || 'youtu.be' === hostname) {
return 'YouTube';
} else if (url.includes('vimeo.com')) {
} else if ('vimeo.com' === hostname) {
return 'Vimeo';
} else if (url.includes('facebook.com')) {
} else if ('facebook.com' === hostname) {
return 'Facebook';
} else if (url.includes('twitch.tv')) {
} else if ('twitch.tv' === hostname) {
return 'Twitch';
} else if (url.includes('soundcloud.com')) {
} else if ('soundcloud.com' === hostname) {
return 'SoundCloud';
} else if (url.includes('mixcloud.com')) {
} else if ('mixcloud.com' === hostname) {
return 'Mixcloud';
} else if (url.includes('dailymotion.com')) {
} else if ('dailymotion.com' === hostname) {
return 'DailyMotion';
} else {
return 'Unknown';
Expand Down

0 comments on commit edc1833

Please sign in to comment.