diff options
author | Ruxton <ruxton@thefrontiergroup.com.au> | 2013-04-29 11:11:05 +0400 |
---|---|---|
committer | Ruxton <ruxton@thefrontiergroup.com.au> | 2013-05-07 05:38:30 +0400 |
commit | 4f1bfd7eeadf14d2f3801154c20ed03ab92acb79 (patch) | |
tree | dff7aaa8b1efc94eb7ddb1b2b3f122dd015c24a6 /config/initializers | |
parent | f6e31fdd9596a671ee35c8b17ce4bc13dae2f31e (diff) |
oembed_providers.yml added for custom (outside of ruby-oembed) oEmbed providers.
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/oembed.rb | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/config/initializers/oembed.rb b/config/initializers/oembed.rb index 329163d79..e7d98d648 100644 --- a/config/initializers/oembed.rb +++ b/config/initializers/oembed.rb @@ -7,18 +7,6 @@ require 'uri' # note that 'trusted_endpoint_url' is the only information # in OEmbed that we can trust. anything else may be spoofed! -OEmbedCubbies = OEmbed::Provider.new("http://cubbi.es/oembed") - -OEmbedDailyMotion = OEmbed::Provider.new("http://www.dailymotion.com/services/oembed") -OEmbedDailyMotion << "http://www.dailymotion.com/video/*" - -OEmbedTwitter = OEmbed::Provider.new("https://api.twitter.com/1/statuses/oembed.json") -OEmbedTwitter << "http://twitter.com/*/status/*" -OEmbedTwitter << "https://twitter.com/*/status/*" - -OEmbedMixCloud = OEmbed::Provider.new("http://www.mixcloud.com/oembed/") -OEmbedMixCloud << "http://www.mixcloud.com/*/*" - # patch in support for new https soundcloud OEmbed::Providers::SoundCloud << "https://*.soundcloud.com/*" @@ -27,13 +15,19 @@ oembed_provider_list = [ OEmbed::Providers::Vimeo, OEmbed::Providers::SoundCloud, OEmbed::Providers::Instagram, - OEmbed::Providers::Flickr, - OEmbedCubbies, - OEmbedDailyMotion, - OEmbedTwitter, - OEmbedMixCloud + OEmbed::Providers::Flickr ] +oembed_providers = YAML.load_file(Rails.root.join("config", "oembed_providers.yml")) + +oembed_providers.each do |provider_name, provider| + oembed_provider = OEmbed::Provider.new(provider["endpoint"]) + provider["urls"].each do |provider_url| + oembed_provider << provider_url + end if provider["urls"] + oembed_provider_list << oembed_provider +end + SECURE_ENDPOINTS = oembed_provider_list.map do |provider| OEmbed::Providers.register(provider) provider.endpoint @@ -41,4 +35,4 @@ end OEmbed::Providers.register_fallback(OEmbed::ProviderDiscovery) -TRUSTED_OEMBED_PROVIDERS = OEmbed::Providers +TRUSTED_OEMBED_PROVIDERS = OEmbed::Providers
\ No newline at end of file |