activitypub, cont.
This commit is contained in:
parent
42abc2201c
commit
d8c93c0d13
@ -43,7 +43,7 @@ class ActivityStreams2 {
|
|||||||
function fetch_property($url) {
|
function fetch_property($url) {
|
||||||
$redirects = 0;
|
$redirects = 0;
|
||||||
$x = z_fetch_url($url,true,$redirects,
|
$x = z_fetch_url($url,true,$redirects,
|
||||||
['headers' => [ 'Accept' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"']]);
|
['headers' => [ 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"']]);
|
||||||
if($x['success'])
|
if($x['success'])
|
||||||
return json_decode($x['body'],true);
|
return json_decode($x['body'],true);
|
||||||
return null;
|
return null;
|
||||||
|
33
Zotlabs/Module/Ap_probe.php
Normal file
33
Zotlabs/Module/Ap_probe.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
namespace Zotlabs\Module;
|
||||||
|
|
||||||
|
require_once('include/zot.php');
|
||||||
|
|
||||||
|
|
||||||
|
class Ap_probe extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
|
function get() {
|
||||||
|
|
||||||
|
$o .= '<h3>ActivityPub Probe Diagnostic</h3>';
|
||||||
|
|
||||||
|
$o .= '<form action="ap_probe" method="get">';
|
||||||
|
$o .= 'Lookup URI: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />';
|
||||||
|
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
|
||||||
|
|
||||||
|
$o .= '<br /><br />';
|
||||||
|
|
||||||
|
if(x($_GET,'addr')) {
|
||||||
|
$addr = $_GET['addr'];
|
||||||
|
|
||||||
|
$redirects = 0;
|
||||||
|
$x = z_fetch_url($addr,true,$redirects,
|
||||||
|
[ 'headers' => [ 'Accept: application/ld+json; profile="https://www.w3.org/ns/activitystreams"']]);
|
||||||
|
logger('fetch: ' . print_r($x,true));
|
||||||
|
|
||||||
|
if($x['success'])
|
||||||
|
$o .= '<pre>' . str_replace('\\','',jindent($x['body'])) . '</pre>';
|
||||||
|
}
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1937,22 +1937,34 @@ function asencode_note($i) {
|
|||||||
|
|
||||||
|
|
||||||
function asencode_person($p) {
|
function asencode_person($p) {
|
||||||
$ret = array();
|
$ret = [];
|
||||||
$ret['type'] = 'Person';
|
$ret['type'] = 'Person';
|
||||||
$ret['id'] = $p['xchan_url'];
|
$ret['id'] = $p['xchan_url'];
|
||||||
$ret['name'] = $p['xchan_name'];
|
$ret['name'] = $p['xchan_name'];
|
||||||
$ret['image'] = array(
|
$ret['icon'] = [ $p['xchan_photo_l'] ];
|
||||||
'type' => 'Link',
|
$ret['image'] = [
|
||||||
|
'type' => 'Link',
|
||||||
'mediaType' => $p['xchan_photo_mimetype'],
|
'mediaType' => $p['xchan_photo_mimetype'],
|
||||||
'href' => $p['xchan_photo_l'],
|
'href' => $p['xchan_photo_l'],
|
||||||
'height' => 300,
|
'height' => 300,
|
||||||
'width' => 300
|
'width' => 300
|
||||||
);
|
];
|
||||||
$ret['url'] = array(
|
$ret['url'] = [
|
||||||
'type' => 'Link',
|
'type' => 'Link',
|
||||||
'mediaType' => 'text/html',
|
'mediaType' => 'text/html',
|
||||||
'href' => $p['xchan_url']
|
'href' => $p['xchan_url']
|
||||||
);
|
];
|
||||||
|
|
||||||
|
if(array_key_exists('channel_id',$p)) {
|
||||||
|
$ret['inbox'] = z_root() . '/inbox/' . $p['channel_address'];
|
||||||
|
$ret['outbox'] = z_root() . '/outbox/' . $p['channel_address'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$collections = get_xconfig($p['xchan_hash'],'activitystreams','collections',[]);
|
||||||
|
if($collections) {
|
||||||
|
$ret = array_merge($ret,$collections);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user