AP is enabled for all users

This commit is contained in:
Michael 2018-09-22 23:49:27 +00:00
parent ca574e1027
commit a56565fa99
6 changed files with 14 additions and 15 deletions

View file

@ -79,7 +79,7 @@ function display_init(App $a)
if (ActivityPub::isRequest()) {
$wall_item = Item::selectFirst(['id', 'uid'], ['guid' => $item['guid'], 'wall' => true]);
if ($wall_item['uid'] == 180) {
if (DBA::isResult($wall_item)) {
$data = ActivityPub::createObjectFromItemID($wall_item['id']);
echo json_encode($data);
exit();

View file

@ -31,8 +31,7 @@ function follow_post(App $a)
// This is just a precaution if maybe this page is called somewhere directly via POST
$_SESSION['fastlane'] = $url;
$result = Contact::createFromProbe($uid, $url, true, Protocol::ACTIVITYPUB);
// $result = Contact::createFromProbe($uid, $url, true);
$result = Contact::createFromProbe($uid, $url, true);
if ($result['success'] == false) {
if ($result['message']) {

View file

@ -52,7 +52,7 @@ function profile_init(App $a)
if (ActivityPub::isRequest()) {
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]);
if ($user['uid'] == 180) {
if (DBM::isResult($user)) {
$data = ActivityPub::profile($user['uid']);
echo json_encode($data);
exit();

View file

@ -80,6 +80,7 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
['rel' => NAMESPACE_DFRN, 'href' => $profile_url],
['rel' => NAMESPACE_FEED, 'type' => 'application/atom+xml', 'href' => System::baseUrl().'/dfrn_poll/'.$r['nickname']],
['rel' => 'http://webfinger.net/rel/profile-page', 'type' => 'text/html', 'href' => $profile_url],
['rel' => 'self', 'type' => 'application/activity+json', 'href' => $profile_url],
['rel' => 'http://microformats.org/profile/hcard', 'type' => 'text/html', 'href' => System::baseUrl().'/hcard/'.$r['nickname']],
['rel' => NAMESPACE_POCO, 'href' => System::baseUrl().'/poco/'.$r['nickname']],
['rel' => 'http://webfinger.net/rel/avatar', 'type' => 'image/jpeg', 'href' => System::baseUrl().'/photo/profile/'.$r['uid'].'.jpg'],
@ -92,9 +93,6 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
['rel' => 'http://purl.org/openwebauth/v1', 'type' => 'application/x-dfrn+json', 'href' => System::baseUrl().'/owa']
]
];
if ($r['uid'] == 180) {
$json['links'][] = ['rel' => 'self', 'type' => 'application/activity+json', 'href' => $profile_url];
}
echo json_encode($json);
killme();

View file

@ -335,8 +335,9 @@ class Probe
$data = null;
}
if (in_array(defaults($data, 'network', ''), ['', Protocol::PHANTOM])) {
$ap_profile = ActivityPub::probeProfile($uri);
if (!empty($ap_profile) && (defaults($data, 'network', '') != Protocol::DFRN)) {
if (!empty($ap_profile) && ($ap_profile['network'] == Protocol::ACTIVITYPUB)) {
$data = $ap_profile;
}

View file

@ -332,9 +332,9 @@ class ActivityPub
}
$data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
['ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive',
'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri',
'conversation' => 'ostatus:conversation',
['ostatus' => 'http://ostatus.org#', 'uuid' => 'http://schema.org/identifier',
'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag',
'atomUri' => 'ostatus:atomUri', 'conversation' => 'ostatus:conversation',
'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri']]];
$data['id'] = $item['uri'] . '#activity';
@ -372,9 +372,9 @@ class ActivityPub
}
$data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
['ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive',
'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri',
'conversation' => 'ostatus:conversation',
['ostatus' => 'http://ostatus.org#', 'uuid' => 'http://schema.org/identifier',
'sensitive' => 'as:sensitive', 'Hashtag' => 'as:Hashtag',
'atomUri' => 'ostatus:atomUri', 'conversation' => 'ostatus:conversation',
'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri']]];
$data = array_merge($data, self::CreateNote($item));
@ -433,6 +433,7 @@ class ActivityPub
$data['inReplyTo'] = null;
}
$data['uuid'] = $item['guid'];
$data['published'] = DateTimeFormat::utc($item["created"]."+00:00", DateTimeFormat::ATOM);
if ($item["created"] != $item["edited"]) {