From fe9700b3f79eeeee12cafd5e82aa91b9592a01ed Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Wed, 30 Jan 2019 21:52:12 +0000 Subject: [PATCH] A handful more providers moved across & removed any that no longer supported --- .../config/EmbeddedMedia.config | 25 ----------------- src/Umbraco.Web/Media/EmbedProviders/Hulu.cs | 24 ++++++++++++++++ src/Umbraco.Web/Media/EmbedProviders/Issuu.cs | 28 +++++++++++++++++++ src/Umbraco.Web/Runtime/WebRuntimeComposer.cs | 9 +++++- src/Umbraco.Web/Umbraco.Web.csproj | 2 ++ 5 files changed, 62 insertions(+), 26 deletions(-) create mode 100644 src/Umbraco.Web/Media/EmbedProviders/Hulu.cs create mode 100644 src/Umbraco.Web/Media/EmbedProviders/Issuu.cs diff --git a/src/Umbraco.Web.UI/config/EmbeddedMedia.config b/src/Umbraco.Web.UI/config/EmbeddedMedia.config index 0e2c5aa988..a5edaf3834 100644 --- a/src/Umbraco.Web.UI/config/EmbeddedMedia.config +++ b/src/Umbraco.Web.UI/config/EmbeddedMedia.config @@ -11,15 +11,6 @@ https - - - - - - - json - - @@ -29,21 +20,5 @@ xml - - - - - - - xml - - - - - - - - - diff --git a/src/Umbraco.Web/Media/EmbedProviders/Hulu.cs b/src/Umbraco.Web/Media/EmbedProviders/Hulu.cs new file mode 100644 index 0000000000..150439832a --- /dev/null +++ b/src/Umbraco.Web/Media/EmbedProviders/Hulu.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; + +namespace Umbraco.Web.Media.EmbedProviders +{ + public class Hulu : EmbedProviderBase + { + public override string ApiEndpoint => "http://www.hulu.com/api/oembed.json"; + + public override string[] UrlSchemeRegex => new string[] + { + @"hulu.com/watch/.*" + }; + + public override Dictionary RequestParams => new Dictionary(); + + public override string GetMarkup(string url, int maxWidth = 0, int maxHeight = 0) + { + var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight); + var oembed = base.GetJsonResponse(requestUrl); + + return oembed.GetHtml(); + } + } +} diff --git a/src/Umbraco.Web/Media/EmbedProviders/Issuu.cs b/src/Umbraco.Web/Media/EmbedProviders/Issuu.cs new file mode 100644 index 0000000000..2b33473453 --- /dev/null +++ b/src/Umbraco.Web/Media/EmbedProviders/Issuu.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace Umbraco.Web.Media.EmbedProviders +{ + public class Issuu : EmbedProviderBase + { + public override string ApiEndpoint => "https://issuu.com/oembed"; + + public override string[] UrlSchemeRegex => new string[] + { + @"issuu.com/.*/docs/.*" + }; + + public override Dictionary RequestParams => new Dictionary() + { + //ApiUrl/?format=xml + {"format", "xml"} + }; + + public override string GetMarkup(string url, int maxWidth = 0, int maxHeight = 0) + { + var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight); + var xmlDocument = base.GetXmlResponse(requestUrl); + + return GetXmlProperty(xmlDocument, "/oembed/html"); + } + } +} diff --git a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs index 5696589647..5974288daf 100644 --- a/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs +++ b/src/Umbraco.Web/Runtime/WebRuntimeComposer.cs @@ -225,7 +225,14 @@ namespace Umbraco.Web.Runtime .Append() .Append() .Append() - .Append(); + .Append() + .Append() + .Append(); + + + //Giphy + //Meetup + //Spotify } } } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 3e767f97a8..e418cf8872 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -149,7 +149,9 @@ + +