forked from GNUsocial/gnu-social
Move user xrd action to core and use hooks to extend
Moved the Webfinger user XRD action from the OStatus plugin to core. Added hooks to add OStatus-specific stuff, but kept general stuff in the core.
This commit is contained in:
@@ -1017,4 +1017,38 @@ class OStatusPlugin extends Plugin
|
||||
'template' => $url,
|
||||
'title' => array('Resource Descriptor'));
|
||||
}
|
||||
|
||||
function onEndXrdActionLinks(&$xrd, $user)
|
||||
{
|
||||
// Salmon
|
||||
$salmon_url = common_local_url('usersalmon',
|
||||
array('id' => $user->id));
|
||||
|
||||
$xrd->links[] = array('rel' => Salmon::REL_SALMON,
|
||||
'href' => $salmon_url);
|
||||
// XXX : Deprecated - to be removed.
|
||||
$xrd->links[] = array('rel' => Salmon::NS_REPLIES,
|
||||
'href' => $salmon_url);
|
||||
|
||||
$xrd->links[] = array('rel' => Salmon::NS_MENTIONS,
|
||||
'href' => $salmon_url);
|
||||
|
||||
// Get this user's keypair
|
||||
$magickey = Magicsig::staticGet('user_id', $user->id);
|
||||
if (!$magickey) {
|
||||
// No keypair yet, let's generate one.
|
||||
$magickey = new Magicsig();
|
||||
$magickey->generate($user->id);
|
||||
}
|
||||
|
||||
$xrd->links[] = array('rel' => Magicsig::PUBLICKEYREL,
|
||||
'href' => 'data:application/magic-public-key,'. $magickey->toString(false));
|
||||
|
||||
// TODO - finalize where the redirect should go on the publisher
|
||||
$url = common_local_url('ostatussub') . '?profile={uri}';
|
||||
$xrd->links[] = array('rel' => 'http://ostatus.org/schema/1.0/subscribe',
|
||||
'template' => $url );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user