]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
LinkPreview: use a local proxy for oEmbed lookups so we use a consistent common code...
authorBrion Vibber <brion@pobox.com>
Tue, 16 Nov 2010 22:41:30 +0000 (14:41 -0800)
committerBrion Vibber <brion@pobox.com>
Tue, 16 Nov 2010 22:41:30 +0000 (14:41 -0800)
plugins/LinkPreview/LinkPreviewPlugin.php
plugins/LinkPreview/linkpreview.js

index 6f7c99a38c519b98a16ddab696e829aa712c4dac..da798114823c4cecb3c55d6ead4209b36b0ccdb7 100644 (file)
@@ -53,7 +53,7 @@ class LinkPreviewPlugin extends Plugin
         if ($user) {
             $action->script('plugins/LinkPreview/linkpreview.js');
             $data = json_encode(array(
-                'api' => common_config('oohembed', 'endpoint'),
+                'api' => common_local_url('oembedproxy'),
                 'width' => common_config('attachments', 'thumbwidth'),
                 'height' => common_config('attachments', 'thumbheight'),
             ));
@@ -73,10 +73,11 @@ class LinkPreviewPlugin extends Plugin
      */
     function onAutoload($cls)
     {
-        switch ($cls)
+        $lower = strtolower($cls);
+        switch ($lower)
         {
-        case 'LinkpreviewAction':
-            require_once dirname(__FILE__) . '/linkpreviewaction.php';
+        case 'oembedproxyaction':
+            require_once dirname(__FILE__) . '/' . $lower . '.php';
             return false;
         default:
             return true;
@@ -92,8 +93,8 @@ class LinkPreviewPlugin extends Plugin
      */
     function onStartInitializeRouter($m)
     {
-        $m->connect('main/preview/link',
-                array('action' => 'linkpreview'));
+        $m->connect('main/oembed/proxy',
+                array('action' => 'oembedproxy'));
 
         return true;
     }
index db992122928d4053a7783e2f385266292b85b191..8e411f908e5fd7bcd656236572aa09591b5e4ade 100644 (file)
                 url: url,
                 format: 'json',
                 maxwidth: oEmbed.width,
-                maxheight: oEmbed.height,
-                callback: '?'
+                maxheight: oEmbed.height
             };
             $.get(oEmbed.api, params, function(data, xhr) {
                 callback(data);
-            }, 'jsonp');
+            }, 'json');
         }
     };