diff --git a/src/Umbraco.Web/Media/EmbedProviders/Giphy.cs b/src/Umbraco.Web/Media/EmbedProviders/Giphy.cs new file mode 100644 index 0000000000..1069de749c --- /dev/null +++ b/src/Umbraco.Web/Media/EmbedProviders/Giphy.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Umbraco.Web.Media.EmbedProviders +{ + /// + /// Embed Provider for Giphy.com the popular online GIFs and animated sticker provider. + /// + public class Giphy : EmbedProviderBase + { + public override string ApiEndpoint => "https://giphy.com/services/oembed?url="; + + public override string[] UrlSchemeRegex => new string[] + { + @"giphy\.com/*", + @"gph\.is/*" + }; + + 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/Runtime/WebInitialComposer.cs b/src/Umbraco.Web/Runtime/WebInitialComposer.cs index a37f9c3588..e2b6313ca6 100644 --- a/src/Umbraco.Web/Runtime/WebInitialComposer.cs +++ b/src/Umbraco.Web/Runtime/WebInitialComposer.cs @@ -264,7 +264,9 @@ namespace Umbraco.Web.Runtime .Append() .Append() .Append() - .Append(); + .Append() + .Append(); + // replace with web implementation composition.RegisterUnique(); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 8d1b106ba4..e604ddba6f 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -149,6 +149,7 @@ +