From: Zach Copley Date: Fri, 30 Sep 2011 19:51:23 +0000 (+0000) Subject: Switch from oohembed to noembed for default oembed provider X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c137d69aee2ab6f6c846c128aca675b47be93d37;p=quix0rs-gnu-social.git Switch from oohembed to noembed for default oembed provider --- diff --git a/lib/default.php b/lib/default.php index 673c94769a..0f321efe0e 100644 --- a/lib/default.php +++ b/lib/default.php @@ -277,7 +277,7 @@ $default = 'allow_tagging' => array('all' => true), // equivalent to array('local' => true, 'remote' => true) 'desclimit' => null), 'oembed' => - array('endpoint' => 'http://oohembed.com/oohembed/', + array('endpoint' => 'https://noembed.com/embed/', 'order' => array('built-in', 'well-known', 'service', 'discovery'), ), 'search' => @@ -352,6 +352,5 @@ $default = array('cache' => true), // whether to cache the router object. Defaults to true, turn off for devel 'discovery' => array('cors' => false), // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) - 'performance' => array('high' => false), // disable some features for higher performance; default false - 'oldschool' => array('enabled' => false) // enable users to use old-style UI + 'performance' => array('high' => false) // disable some features for higher performance; default false ); diff --git a/lib/oembedhelper.php b/lib/oembedhelper.php index 6d8064e660..903f80c581 100644 --- a/lib/oembedhelper.php +++ b/lib/oembedhelper.php @@ -61,7 +61,7 @@ class oEmbedHelper * Some known hosts are whitelisted with API endpoints where we * know they exist but autodiscovery data isn't available. * If autodiscovery links are missing and we don't recognize the - * host, we'll pass it to oohembed.com's public service which + * host, we'll pass it to noembed.com's public service which * will either proxy or fake info on a lot of sites. * * A few hosts are blacklisted due to known problems with oohembed, @@ -94,7 +94,7 @@ class oEmbedHelper case 'built-in': common_log(LOG_INFO, 'Considering built-in oEmbed methods...'); // Blacklist: systems with no oEmbed API of their own, which are - // either missing from or broken on oohembed.com's proxy. + // either missing from or broken on noembed.com's proxy. // we know how to look data up in another way... if (array_key_exists($host, self::$functionMap)) { common_log(LOG_INFO, 'We have a built-in method for ' . $host); diff --git a/plugins/LinkPreview/linkpreview.js b/plugins/LinkPreview/linkpreview.js index 132c4c8d77..e6e98bdb4d 100644 --- a/plugins/LinkPreview/linkpreview.js +++ b/plugins/LinkPreview/linkpreview.js @@ -7,7 +7,7 @@ * Quickie wrapper around ooembed JSON lookup */ var oEmbed = { - api: 'http://oohembed.com/oohembed', + api: 'https://noembed.com/embed', width: 100, height: 75, cache: {}, diff --git a/plugins/LinkPreview/linkpreview.min.js b/plugins/LinkPreview/linkpreview.min.js index ea28f6bfee..99af83913e 100644 --- a/plugins/LinkPreview/linkpreview.min.js +++ b/plugins/LinkPreview/linkpreview.min.js @@ -1 +1 @@ -(function(){var b={api:"http://oohembed.com/oohembed",width:100,height:75,cache:{},callbacks:{},lookup:function(d,e){if(typeof b.cache[d]=="object"){e(b.cache[d])}else{if(typeof b.callbacks[d]=="undefined"){b.callbacks[d]=[e];b.rawLookup(d,function(h){b.cache[d]=h;var g=b.callbacks[d];b.callbacks[d]=undefined;for(var f=0;f')}},prepLinkPreview:function(g){var h="link-preview-"+g;var f=e.links[g];e.refresh[g]=false;e.markLoading(g);b.lookup(f,function(l){var i=null;var j=100;if(l&&typeof l.thumbnail_url=="string"){i=l.thumbnail_url;if(typeof l.thumbnail_width!=="undefined"){if(l.thumbnail_width');k.find("a").attr("href",f).attr("target","_blank").last().find("img").attr("src",i).attr("width",j).attr("title",l.title||l.url||f);d.find("."+h).empty().append(k)}else{e.clearLink(g)}if(e.refresh[g]){e.prepLinkPreview(g)}else{e.markDone(g)}})},previewLinks:function(j){var h;var f=e.links;var g=e.findLinks(j);e.links=g;for(h=0;hf.length){for(h=f.length;hg.length){for(h=g.length;h')}},clearLink:function(f){var g="link-preview-"+f;d.find("."+g).html("")},markLoading:function(f){e.state[f]="loading";var g="link-preview-"+f;d.find("."+g).attr("style","opacity: 0.5")},markDone:function(f){e.state[f]="done";var g="link-preview-"+f;d.find("."+g).removeAttr("style")},clear:function(){e.links=[];d.find(".link-preview").remove()}};d.data("LinkPreview",e)}})(); \ No newline at end of file +(function(){var b={api:"https://noembed.com/embed",width:100,height:75,cache:{},callbacks:{},lookup:function(d,e){if(typeof b.cache[d]=="object"){e(b.cache[d])}else{if(typeof b.callbacks[d]=="undefined"){b.callbacks[d]=[e];b.rawLookup(d,function(h){b.cache[d]=h;var g=b.callbacks[d];b.callbacks[d]=undefined;for(var f=0;f')}},prepLinkPreview:function(g){var h="link-preview-"+g;var f=e.links[g];e.refresh[g]=false;e.markLoading(g);b.lookup(f,function(l){var i=null;var j=100;if(l&&typeof l.thumbnail_url=="string"){i=l.thumbnail_url;if(typeof l.thumbnail_width!=="undefined"){if(l.thumbnail_width');k.find("a").attr("href",f).attr("target","_blank").last().find("img").attr("src",i).attr("width",j).attr("title",l.title||l.url||f);d.find("."+h).empty().append(k)}else{e.clearLink(g)}if(e.refresh[g]){e.prepLinkPreview(g)}else{e.markDone(g)}})},previewLinks:function(j){var h;var f=e.links;var g=e.findLinks(j);e.links=g;for(h=0;hf.length){for(h=f.length;hg.length){for(h=g.length;h')}},clearLink:function(f){var g="link-preview-"+f;d.find("."+g).html("")},markLoading:function(f){e.state[f]="loading";var g="link-preview-"+f;d.find("."+g).attr("style","opacity: 0.5")},markDone:function(f){e.state[f]="done";var g="link-preview-"+f;d.find("."+g).removeAttr("style")},clear:function(){e.links=[];d.find(".link-preview").remove()}};d.data("LinkPreview",e)}})(); \ No newline at end of file diff --git a/plugins/LinkPreview/oembedproxyaction.php b/plugins/LinkPreview/oembedproxyaction.php index fd2f46f5fc..7e54aca570 100644 --- a/plugins/LinkPreview/oembedproxyaction.php +++ b/plugins/LinkPreview/oembedproxyaction.php @@ -35,7 +35,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { * * This class provides an interface for our JS-side code to pull info on * links from other sites, using either native oEmbed, our own custom - * handlers, or the oohEmbed.com offsite proxy service as configured. + * handlers, or the noembed.com offsite proxy service as configured. * * @category oEmbed * @package StatusNet diff --git a/tests/oEmbedTest.php b/tests/oEmbedTest.php index b5e441c42f..1f1d5f826c 100644 --- a/tests/oEmbedTest.php +++ b/tests/oEmbedTest.php @@ -15,22 +15,22 @@ class oEmbedTest extends PHPUnit_Framework_TestCase public function setup() { - $this->old_oohembed = common_config('oohembed', 'endpoint'); + $this->old_ohembed = common_config('ohembed', 'endpoint'); } public function tearDown() { - $GLOBALS['config']['oohembed']['endpoint'] = $this->old_oohembed; + $GLOBALS['config']['oembed']['endpoint'] = $this->old_ohembed; } /** - * Test with oohembed DISABLED. + * Test with ohembed DISABLED. * * @dataProvider discoverableSources */ public function testoEmbed($url, $expectedType) { - $GLOBALS['config']['oohembed']['endpoint'] = false; + $GLOBALS['config']['oembed']['endpoint'] = false; $this->_doTest($url, $expectedType); } @@ -39,14 +39,14 @@ class oEmbedTest extends PHPUnit_Framework_TestCase * * @dataProvider fallbackSources */ - public function testoohEmbed($url, $expectedType) + public function testnoEmbed($url, $expectedType) { - $GLOBALS['config']['oohembed']['endpoint'] = $this->_endpoint(); + $GLOBALS['config']['oembed']['endpoint'] = $this->_endpoint(); $this->_doTest($url, $expectedType); } /** - * Get default oohembed endpoint. + * Get default oembed endpoint. * * @return string */ @@ -55,7 +55,7 @@ class oEmbedTest extends PHPUnit_Framework_TestCase $default = array(); $_server = 'localhost'; $_path = ''; require INSTALLDIR . '/lib/default.php'; - return $default['oohembed']['endpoint']; + return $default['oembed']['endpoint']; } /** @@ -113,7 +113,6 @@ class oEmbedTest extends PHPUnit_Framework_TestCase static public function discoverableSources() { $sources = array( - array('http://identi.ca/attachment/34437400', 'photo'), array('http://www.youtube.com/watch?v=eUgLR232Cnw', 'video'), array('http://vimeo.com/9283184', 'video'), @@ -125,16 +124,20 @@ class oEmbedTest extends PHPUnit_Framework_TestCase } /** - * Sample oEmbed targets that can be found via oohembed.com. + * Sample oEmbed targets that can be found via noembed.com. * Includes also discoverableSources() output. * * @return array */ static public function fallbackSources() { + $sources = array( - array('http://en.wikipedia.org/wiki/File:Wiki.png', 'link'), // @fixme in future there may be a native provider -- will change to 'photo' + array('https://github.com/git/git/commit/85e9c7e1d42849c5c3084a9da748608468310c0e', 'Github Commit'), // @fixme in future there may be a native provider -- will change to 'photo' ); + + $sources = array(); + return array_merge(self::discoverableSources(), $sources); } }