forked from GNUsocial/gnu-social
move xrd and hostmeta out of the OStatus plugin and into core
add event for setting up hostmeta, and use them in the OStatus plugin
This commit is contained in:
parent
3dd734b2c3
commit
8d54809c35
@ -551,6 +551,12 @@ EndPublicXRDS: End XRDS output (right before the closing XRDS tag)
|
|||||||
- $action: the current action
|
- $action: the current action
|
||||||
- &$xrdsoutputter - XRDSOutputter object to write to
|
- &$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
|
StartCheckPassword: Check a username/password
|
||||||
- $nickname: The nickname to check
|
- $nickname: The nickname to check
|
||||||
- $password: The password to check
|
- $password: The password to check
|
||||||
@ -1095,4 +1101,4 @@ StartShowPageTitle: when beginning to show the page title <h1>
|
|||||||
- $action: action being shown
|
- $action: action being shown
|
||||||
|
|
||||||
EndShowPageTitle: when done showing the page title <h1>
|
EndShowPageTitle: when done showing the page title <h1>
|
||||||
- $action: action being shown
|
- $action: action being shown
|
||||||
|
@ -18,8 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package OStatusPlugin
|
* @category Action
|
||||||
|
* @package StatusNet
|
||||||
* @maintainer James Walker <james@status.net>
|
* @maintainer James Walker <james@status.net>
|
||||||
|
* @author Craig Andrews <candrews@integralblue.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
||||||
@ -27,19 +29,28 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
|
|||||||
class HostMetaAction extends Action
|
class HostMetaAction extends Action
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is read only?
|
||||||
|
*
|
||||||
|
* @return boolean true
|
||||||
|
*/
|
||||||
|
function isReadOnly()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function handle()
|
function handle()
|
||||||
{
|
{
|
||||||
parent::handle();
|
parent::handle();
|
||||||
|
|
||||||
$domain = common_config('site', 'server');
|
$domain = common_config('site', 'server');
|
||||||
$url = common_local_url('userxrd');
|
|
||||||
$url.= '?uri={uri}';
|
|
||||||
|
|
||||||
$xrd = new XRD();
|
$xrd = new XRD();
|
||||||
$xrd->host = $domain;
|
$xrd->host = $domain;
|
||||||
$xrd->links[] = array('rel' => Discovery::LRDD_REL,
|
|
||||||
'template' => $url,
|
if(Event::handle('StartHostMetaLinks', array(&$xrd->links))) {
|
||||||
'title' => array('Resource Descriptor'));
|
Event::handle('EndHostMetaLinks', array(&$xrd->links));
|
||||||
|
}
|
||||||
|
|
||||||
header('Content-type: application/xrd+xml');
|
header('Content-type: application/xrd+xml');
|
||||||
print $xrd->toXML();
|
print $xrd->toXML();
|
@ -204,7 +204,7 @@ function checkMirror($action_obj, $args)
|
|||||||
|
|
||||||
function isLoginAction($action)
|
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;
|
$login = null;
|
||||||
|
|
||||||
|
@ -151,6 +151,8 @@ class Router
|
|||||||
|
|
||||||
$m->connect('main/xrds',
|
$m->connect('main/xrds',
|
||||||
array('action' => 'publicxrds'));
|
array('action' => 'publicxrds'));
|
||||||
|
$m->connect('.well-known/host-meta',
|
||||||
|
array('action' => 'hostmeta'));
|
||||||
|
|
||||||
// these take a code
|
// these take a code
|
||||||
|
|
||||||
|
@ -50,8 +50,6 @@ class OStatusPlugin extends Plugin
|
|||||||
function onRouterInitialized($m)
|
function onRouterInitialized($m)
|
||||||
{
|
{
|
||||||
// Discovery actions
|
// Discovery actions
|
||||||
$m->connect('.well-known/host-meta',
|
|
||||||
array('action' => 'hostmeta'));
|
|
||||||
$m->connect('main/xrd',
|
$m->connect('main/xrd',
|
||||||
array('action' => 'userxrd'));
|
array('action' => 'userxrd'));
|
||||||
$m->connect('main/ownerxrd',
|
$m->connect('main/ownerxrd',
|
||||||
@ -1012,4 +1010,12 @@ class OStatusPlugin extends Plugin
|
|||||||
|
|
||||||
return true;
|
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'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user