commit
505350c9fb
54 changed files with 4014 additions and 1065 deletions
|
@ -1488,7 +1488,7 @@ function admin_page_site(App $a)
|
|||
'$community_page_style' => ['community_page_style', L10n::t("Community pages for visitors"), Config::get('system','community_page_style'), L10n::t("Which community pages should be available for visitors. Local users always see both pages."), $community_page_style_choices],
|
||||
'$max_author_posts_community_page' => ['max_author_posts_community_page', L10n::t("Posts per user on community page"), Config::get('system','max_author_posts_community_page'), L10n::t("The maximum number of posts per user on the community page. \x28Not valid for 'Global Community'\x29")],
|
||||
'$ostatus_disabled' => ['ostatus_disabled', L10n::t("Enable OStatus support"), !Config::get('system','ostatus_disabled'), L10n::t("Provide built-in OStatus \x28StatusNet, GNU Social etc.\x29 compatibility. All communications in OStatus are public, so privacy warnings will be occasionally displayed.")],
|
||||
'$ostatus_full_threads' => ['ostatus_full_threads', L10n::t("Only import OStatus threads from our contacts"), Config::get('system','ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus contacts. With this option we only store threads that are started by a contact that is known on our system.")],
|
||||
'$ostatus_full_threads' => ['ostatus_full_threads', L10n::t("Only import OStatus/ActivityPub threads from our contacts"), Config::get('system','ostatus_full_threads'), L10n::t("Normally we import every content from our OStatus and ActivityPub contacts. With this option we only store threads that are started by a contact that is known on our system.")],
|
||||
'$ostatus_not_able' => L10n::t("OStatus support can only be enabled if threading is enabled."),
|
||||
'$diaspora_able' => $diaspora_able,
|
||||
'$diaspora_not_able' => L10n::t("Diaspora support can't be enabled because Friendica was installed into a sub directory."),
|
||||
|
|
|
@ -533,7 +533,7 @@ function contacts_content(App $a, $update = 0)
|
|||
$relation_text = '';
|
||||
}
|
||||
|
||||
if (!in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
|
||||
if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA])) {
|
||||
$relation_text = "";
|
||||
}
|
||||
|
||||
|
@ -555,7 +555,7 @@ function contacts_content(App $a, $update = 0)
|
|||
}
|
||||
$lblsuggest = (($contact['network'] === Protocol::DFRN) ? L10n::t('Suggest friends') : '');
|
||||
|
||||
$poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
|
||||
$poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
|
||||
|
||||
$nettype = L10n::t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact["url"]));
|
||||
|
||||
|
@ -966,7 +966,7 @@ function contact_conversations(App $a, $contact_id, $update)
|
|||
$profiledata = Contact::getDetailsByURL($contact["url"]);
|
||||
|
||||
if (local_user()) {
|
||||
if (in_array($profiledata["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
|
||||
if (in_array($profiledata["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
|
||||
$profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
|
||||
}
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ function contact_posts(App $a, $contact_id)
|
|||
$profiledata = Contact::getDetailsByURL($contact["url"]);
|
||||
|
||||
if (local_user()) {
|
||||
if (in_array($profiledata["network"], [Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
|
||||
if (in_array($profiledata["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS])) {
|
||||
$profiledata["remoteconnect"] = System::baseUrl()."/follow?url=".urlencode($profiledata["url"]);
|
||||
}
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ function _contact_detail_for_template(array $rr)
|
|||
*/
|
||||
function contact_actions($contact)
|
||||
{
|
||||
$poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
|
||||
$poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
|
||||
$contact_actions = [];
|
||||
|
||||
// Provide friend suggestion only for Friendica contacts
|
||||
|
|
|
@ -28,6 +28,7 @@ use Friendica\Model\Group;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -335,10 +336,17 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
intval($contact_id)
|
||||
);
|
||||
} else {
|
||||
if ($network == Protocol::ACTIVITYPUB) {
|
||||
ActivityPub::transmitContactAccept($contact['url'], $contact['hub-verify'], $uid);
|
||||
$pending = true;
|
||||
} else {
|
||||
$pending = false;
|
||||
}
|
||||
|
||||
// $network !== Protocol::DFRN
|
||||
$network = defaults($contact, 'network', Protocol::OSTATUS);
|
||||
|
||||
$arr = Probe::uri($contact['url']);
|
||||
$arr = Probe::uri($contact['url'], $network);
|
||||
|
||||
$notify = defaults($contact, 'notify' , $arr['notify']);
|
||||
$poll = defaults($contact, 'poll' , $arr['poll']);
|
||||
|
@ -348,7 +356,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
$new_relation = $contact['rel'];
|
||||
$writable = $contact['writable'];
|
||||
|
||||
if ($network === Protocol::DIASPORA) {
|
||||
if (in_array($network, [Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {
|
||||
if ($duplex) {
|
||||
$new_relation = Contact::FRIEND;
|
||||
} else {
|
||||
|
@ -362,30 +370,12 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
|
||||
DBA::delete('intro', ['id' => $intro_id]);
|
||||
|
||||
$r = q("UPDATE `contact` SET `name-date` = '%s',
|
||||
`uri-date` = '%s',
|
||||
`addr` = '%s',
|
||||
`notify` = '%s',
|
||||
`poll` = '%s',
|
||||
`blocked` = 0,
|
||||
`pending` = 0,
|
||||
`network` = '%s',
|
||||
`writable` = %d,
|
||||
`hidden` = %d,
|
||||
`rel` = %d
|
||||
WHERE `id` = %d
|
||||
",
|
||||
DBA::escape(DateTimeFormat::utcNow()),
|
||||
DBA::escape(DateTimeFormat::utcNow()),
|
||||
DBA::escape($addr),
|
||||
DBA::escape($notify),
|
||||
DBA::escape($poll),
|
||||
DBA::escape($network),
|
||||
intval($writable),
|
||||
intval($hidden),
|
||||
intval($new_relation),
|
||||
intval($contact_id)
|
||||
);
|
||||
$fields = ['name-date' => DateTimeFormat::utcNow(),
|
||||
'uri-date' => DateTimeFormat::utcNow(), 'addr' => $addr,
|
||||
'notify' => $notify, 'poll' => $poll, 'blocked' => false,
|
||||
'pending' => $pending, 'network' => $network,
|
||||
'writable' => $writable, 'hidden' => $hidden, 'rel' => $new_relation];
|
||||
DBA::update('contact', $fields, ['id' => $contact_id]);
|
||||
}
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
|
@ -403,6 +393,10 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
|||
|
||||
Group::addMember(User::getDefaultGroup($uid, $contact["network"]), $contact['id']);
|
||||
|
||||
if ($network == Protocol::ACTIVITYPUB && $duplex) {
|
||||
ActivityPub::transmitActivity('Follow', $contact['url'], $uid);
|
||||
}
|
||||
|
||||
// Let's send our user to the contact editor in case they want to
|
||||
// do anything special with this new friend.
|
||||
if ($handsfree === null) {
|
||||
|
|
|
@ -54,7 +54,7 @@ function dirfind_content(App $a, $prefix = "") {
|
|||
if ((valid_email($search) && Network::isEmailDomainValid($search)) ||
|
||||
(substr(normalise_link($search), 0, 7) == "http://")) {
|
||||
$user_data = Probe::uri($search);
|
||||
$discover_user = (in_array($user_data["network"], [Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]));
|
||||
$discover_user = (in_array($user_data["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ use Friendica\Model\Group;
|
|||
use Friendica\Model\Item;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
function display_init(App $a)
|
||||
{
|
||||
|
@ -43,7 +44,7 @@ function display_init(App $a)
|
|||
|
||||
$item = null;
|
||||
|
||||
$fields = ['id', 'parent', 'author-id', 'body', 'uid'];
|
||||
$fields = ['id', 'parent', 'author-id', 'body', 'uid', 'guid'];
|
||||
|
||||
// If there is only one parameter, then check if this parameter could be a guid
|
||||
if ($a->argc == 2) {
|
||||
|
@ -76,6 +77,10 @@ function display_init(App $a)
|
|||
displayShowFeed($item["id"], false);
|
||||
}
|
||||
|
||||
if (ActivityPub::isRequest()) {
|
||||
goaway(str_replace('display/', 'object/', $a->query_string));
|
||||
}
|
||||
|
||||
if ($item["id"] != $item["parent"]) {
|
||||
$item = Item::selectFirstForUser(local_user(), $fields, ['id' => $item["parent"]]);
|
||||
}
|
||||
|
|
26
mod/item.php
26
mod/item.php
|
@ -159,7 +159,7 @@ function item_post(App $a) {
|
|||
}
|
||||
|
||||
// Allow commenting if it is an answer to a public post
|
||||
$allow_comment = local_user() && ($profile_uid == 0) && $parent && in_array($parent_item['network'], [Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
|
||||
$allow_comment = local_user() && ($profile_uid == 0) && $parent && in_array($parent_item['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::DFRN]);
|
||||
|
||||
// Now check that valid personal details have been provided
|
||||
if (!can_write_wall($profile_uid) && !$allow_comment) {
|
||||
|
@ -240,7 +240,7 @@ function item_post(App $a) {
|
|||
$emailcc = notags(trim(defaults($_REQUEST, 'emailcc' , '')));
|
||||
$body = escape_tags(trim(defaults($_REQUEST, 'body' , '')));
|
||||
$network = notags(trim(defaults($_REQUEST, 'network' , Protocol::DFRN)));
|
||||
$guid = System::createGUID(32);
|
||||
$guid = System::createUUID();
|
||||
|
||||
$postopts = defaults($_REQUEST, 'postopts', '');
|
||||
|
||||
|
@ -343,20 +343,11 @@ function item_post(App $a) {
|
|||
|
||||
$tags = get_tags($body);
|
||||
|
||||
// Add a tag if the parent contact is from OStatus (This will notify them during delivery)
|
||||
if ($parent) {
|
||||
if ($thr_parent_contact['network'] == Protocol::OSTATUS) {
|
||||
$contact = '@[url=' . $thr_parent_contact['url'] . ']' . $thr_parent_contact['nick'] . '[/url]';
|
||||
if (!stripos(implode($tags), '[url=' . $thr_parent_contact['url'] . ']')) {
|
||||
$tags[] = $contact;
|
||||
}
|
||||
}
|
||||
|
||||
if ($parent_contact['network'] == Protocol::OSTATUS) {
|
||||
$contact = '@[url=' . $parent_contact['url'] . ']' . $parent_contact['nick'] . '[/url]';
|
||||
if (!stripos(implode($tags), '[url=' . $parent_contact['url'] . ']')) {
|
||||
$tags[] = $contact;
|
||||
}
|
||||
// Add a tag if the parent contact is from ActivityPub or OStatus (This will notify them)
|
||||
if ($parent && in_array($thr_parent_contact['network'], [Protocol::OSTATUS, Protocol::ACTIVITYPUB])) {
|
||||
$contact = '@[url=' . $thr_parent_contact['url'] . ']' . $thr_parent_contact['nick'] . '[/url]';
|
||||
if (!stripos(implode($tags), '[url=' . $thr_parent_contact['url'] . ']')) {
|
||||
$tags[] = $contact;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1026,8 +1017,7 @@ function handle_tag(App $a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $n
|
|||
$alias = $contact["alias"];
|
||||
$newname = $contact["nick"];
|
||||
|
||||
if (($newname == "") || (($contact["network"] != Protocol::OSTATUS) && ($contact["network"] != Protocol::TWITTER)
|
||||
&& ($contact["network"] != Protocol::STATUSNET))) {
|
||||
if (($newname == "") || !in_array($contact["network"], [Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::TWITTER, Protocol::STATUSNET])) {
|
||||
$newname = $contact["name"];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@ function photos_post(App $a)
|
|||
$uri = Item::newURI($page_owner_uid);
|
||||
|
||||
$arr = [];
|
||||
$arr['guid'] = System::createGUID(32);
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = $uri;
|
||||
|
@ -651,7 +651,7 @@ function photos_post(App $a)
|
|||
$uri = Item::newURI($page_owner_uid);
|
||||
|
||||
$arr = [];
|
||||
$arr['guid'] = System::createGUID(32);
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = $uri;
|
||||
|
@ -889,7 +889,7 @@ function photos_post(App $a)
|
|||
$arr['coord'] = $lat . ' ' . $lon;
|
||||
}
|
||||
|
||||
$arr['guid'] = System::createGUID(32);
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uid'] = $page_owner_uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = $uri;
|
||||
|
|
|
@ -97,7 +97,7 @@ function poke_init(App $a)
|
|||
|
||||
$arr = [];
|
||||
|
||||
$arr['guid'] = System::createGUID(32);
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uid'] = $uid;
|
||||
$arr['uri'] = $uri;
|
||||
$arr['parent-uri'] = (!empty($parent_uri) ? $parent_uri : $uri);
|
||||
|
|
|
@ -20,6 +20,7 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Module\Login;
|
||||
use Friendica\Protocol\DFRN;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
||||
function profile_init(App $a)
|
||||
{
|
||||
|
@ -49,6 +50,16 @@ function profile_init(App $a)
|
|||
DFRN::autoRedir($a, $which);
|
||||
}
|
||||
|
||||
if (ActivityPub::isRequest()) {
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $which]);
|
||||
if (DBA::isResult($user)) {
|
||||
$data = ActivityPub::profile($user['uid']);
|
||||
echo json_encode($data);
|
||||
header('Content-Type: application/activity+json');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
Profile::load($a, $which, $profile);
|
||||
|
||||
$blocked = !local_user() && !remote_user() && Config::get('system', 'block_public');
|
||||
|
|
|
@ -108,7 +108,7 @@ EOT;
|
|||
|
||||
$arr = [];
|
||||
|
||||
$arr['guid'] = System::createGUID(32);
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uri'] = $uri;
|
||||
$arr['uid'] = $owner_uid;
|
||||
$arr['contact-id'] = $contact['id'];
|
||||
|
|
|
@ -115,7 +115,7 @@ EOT;
|
|||
|
||||
$arr = [];
|
||||
|
||||
$arr['guid'] = System::createGUID(32);
|
||||
$arr['guid'] = System::createUUID();
|
||||
$arr['uri'] = $uri;
|
||||
$arr['uid'] = $owner_uid;
|
||||
$arr['contact-id'] = $contact['id'];
|
||||
|
|
|
@ -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,6 +93,7 @@ function xrd_json($a, $uri, $alias, $profile_url, $r)
|
|||
['rel' => 'http://purl.org/openwebauth/v1', 'type' => 'application/x-dfrn+json', 'href' => System::baseUrl().'/owa']
|
||||
]
|
||||
];
|
||||
|
||||
echo json_encode($json);
|
||||
killme();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue