summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--EVENTS.txt6
-rw-r--r--actions/hostmeta.php (renamed from plugins/OStatus/actions/hostmeta.php)24
-rw-r--r--index.php2
-rw-r--r--lib/router.php2
-rw-r--r--lib/xrd.php (renamed from plugins/OStatus/lib/xrd.php)0
-rw-r--r--plugins/OStatus/OStatusPlugin.php10
6 files changed, 35 insertions, 9 deletions
diff --git a/EVENTS.txt b/EVENTS.txt
index 8bdc93db8..9e274c731 100644
--- a/EVENTS.txt
+++ b/EVENTS.txt
@@ -591,6 +591,12 @@ EndPublicXRDS: End XRDS output (right before the closing XRDS tag)
- $action: the current action
- &$xrdsoutputter - XRDSOutputter object to write to
+StartHostMetaLinks: Start /.well-known/host-meta links
+- &links: array containing the links elements to be written
+
+EndHostMetaLinks: End /.well-known/host-meta links
+- &links: array containing the links elements to be written
+
StartCheckPassword: Check a username/password
- $nickname: The nickname to check
- $password: The password to check
diff --git a/plugins/OStatus/actions/hostmeta.php b/actions/hostmeta.php
index 14f69ac19..b7beee5a8 100644
--- a/plugins/OStatus/actions/hostmeta.php
+++ b/actions/hostmeta.php
@@ -18,8 +18,10 @@
*/
/**
- * @package OStatusPlugin
+ * @category Action
+ * @package StatusNet
* @maintainer James Walker <james@status.net>
+ * @author Craig Andrews <candrews@integralblue.com>
*/
if (!defined('STATUSNET')) {
@@ -28,19 +30,29 @@ if (!defined('STATUSNET')) {
class HostMetaAction extends Action
{
+
+ /**
+ * Is read only?
+ *
+ * @return boolean true
+ */
+ function isReadOnly()
+ {
+ return true;
+ }
+
function handle()
{
parent::handle();
$domain = common_config('site', 'server');
- $url = common_local_url('userxrd');
- $url.= '?uri={uri}';
$xrd = new XRD();
$xrd->host = $domain;
- $xrd->links[] = array('rel' => Discovery::LRDD_REL,
- 'template' => $url,
- 'title' => array('Resource Descriptor'));
+
+ if(Event::handle('StartHostMetaLinks', array(&$xrd->links))) {
+ Event::handle('EndHostMetaLinks', array(&$xrd->links));
+ }
header('Content-type: application/xrd+xml');
print $xrd->toXML();
diff --git a/index.php b/index.php
index 6079d1f2c..b060a3d52 100644
--- a/index.php
+++ b/index.php
@@ -189,7 +189,7 @@ function checkMirror($action_obj, $args)
function isLoginAction($action)
{
- static $loginActions = array('login', 'recoverpassword', 'api', 'doc', 'register', 'publicxrds', 'otp', 'opensearch', 'rsd');
+ static $loginActions = array('login', 'recoverpassword', 'api', 'doc', 'register', 'publicxrds', 'otp', 'opensearch', 'rsd', 'hostmeta');
$login = null;
diff --git a/lib/router.php b/lib/router.php
index c0f3bf31d..6912bd7cf 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -149,6 +149,8 @@ class Router
$m->connect('main/xrds',
array('action' => 'publicxrds'));
+ $m->connect('.well-known/host-meta',
+ array('action' => 'hostmeta'));
// these take a code
diff --git a/plugins/OStatus/lib/xrd.php b/lib/xrd.php
index c8cffed9c..c8cffed9c 100644
--- a/plugins/OStatus/lib/xrd.php
+++ b/lib/xrd.php
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php
index 4ab2023cb..e38d52d3d 100644
--- a/plugins/OStatus/OStatusPlugin.php
+++ b/plugins/OStatus/OStatusPlugin.php
@@ -52,8 +52,6 @@ class OStatusPlugin extends Plugin
function onRouterInitialized($m)
{
// Discovery actions
- $m->connect('.well-known/host-meta',
- array('action' => 'hostmeta'));
$m->connect('main/xrd',
array('action' => 'userxrd'));
$m->connect('main/ownerxrd',
@@ -1011,4 +1009,12 @@ class OStatusPlugin extends Plugin
return true;
}
+
+ function onStartHostMetaLinks(&$links) {
+ $url = common_local_url('userxrd');
+ $url.= '?uri={uri}';
+ $links[] = array('rel' => Discovery::LRDD_REL,
+ 'template' => $url,
+ 'title' => array('Resource Descriptor'));
+ }
}