mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 23:55:19 +00:00
couple of tweaks
This commit is contained in:
parent
081cb7f0aa
commit
2a1a7e2e46
3 changed files with 36 additions and 16 deletions
|
@ -1570,13 +1570,28 @@ class Activity
|
||||||
{
|
{
|
||||||
|
|
||||||
$ret = [];
|
$ret = [];
|
||||||
|
$currhub = false;
|
||||||
|
|
||||||
if (!$p['xchan_url']) {
|
if (!$p['xchan_url']) {
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$h = q("select * from hubloc where hubloc_hash = '%s'",
|
||||||
|
dbesc($p['xchan_hash'])
|
||||||
|
);
|
||||||
|
if ($h) {
|
||||||
|
$currhub = $h[0];
|
||||||
|
foreach ($h as $hub) {
|
||||||
|
if ($hub['hubloc_url'] === z_root()) {
|
||||||
|
$currhub = $hub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$current_url = $currhub ? $currhub['hubloc_id_url'] : $p['xchan_url'];
|
||||||
|
|
||||||
if (!$extended) {
|
if (!$extended) {
|
||||||
return $p['xchan_url'];
|
return $current_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
$c = ((array_key_exists('channel_id', $p)) ? $p : Channel::from_hash($p['xchan_hash']));
|
$c = ((array_key_exists('channel_id', $p)) ? $p : Channel::from_hash($p['xchan_hash']));
|
||||||
|
@ -1595,7 +1610,7 @@ class Activity
|
||||||
if ($c) {
|
if ($c) {
|
||||||
$ret['id'] = Channel::url($c);
|
$ret['id'] = Channel::url($c);
|
||||||
} else {
|
} else {
|
||||||
$ret['id'] = ((strpos($p['xchan_hash'], 'http') === 0) ? $p['xchan_hash'] : $p['xchan_url']);
|
$ret['id'] = ((strpos($p['xchan_hash'], 'http') === 0) ? $p['xchan_hash'] : $current_url);
|
||||||
}
|
}
|
||||||
if ($p['xchan_addr'] && strpos($p['xchan_addr'], '@')) {
|
if ($p['xchan_addr'] && strpos($p['xchan_addr'], '@')) {
|
||||||
$ret['preferredUsername'] = substr($p['xchan_addr'], 0, strpos($p['xchan_addr'], '@'));
|
$ret['preferredUsername'] = substr($p['xchan_addr'], 0, strpos($p['xchan_addr'], '@'));
|
||||||
|
@ -1610,7 +1625,7 @@ class Activity
|
||||||
'height' => 300,
|
'height' => 300,
|
||||||
'width' => 300,
|
'width' => 300,
|
||||||
];
|
];
|
||||||
$ret['url'] = $p['xchan_url'];
|
$ret['url'] = $current_url;
|
||||||
if (isset($p['channel_location']) && $p['channel_location']) {
|
if (isset($p['channel_location']) && $p['channel_location']) {
|
||||||
$ret['location'] = ['type' => 'Place', 'name' => $p['channel_location']];
|
$ret['location'] = ['type' => 'Place', 'name' => $p['channel_location']];
|
||||||
}
|
}
|
||||||
|
@ -1640,8 +1655,8 @@ class Activity
|
||||||
|
|
||||||
$ret['discoverable'] = ((1 - intval($p['xchan_hidden'])) ? true : false);
|
$ret['discoverable'] = ((1 - intval($p['xchan_hidden'])) ? true : false);
|
||||||
$ret['publicKey'] = [
|
$ret['publicKey'] = [
|
||||||
'id' => $p['xchan_url'] . '?operation=getkey',
|
'id' => $current_url . '?operation=getkey',
|
||||||
'owner' => $p['xchan_url'],
|
'owner' => $current_url,
|
||||||
'signatureAlgorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
|
'signatureAlgorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
|
||||||
'publicKeyPem' => $p['xchan_pubkey']
|
'publicKeyPem' => $p['xchan_pubkey']
|
||||||
];
|
];
|
||||||
|
@ -1730,8 +1745,8 @@ class Activity
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$ret['publicKey'] = [
|
$ret['publicKey'] = [
|
||||||
'id' => $p['xchan_url'],
|
'id' => $current_url,
|
||||||
'owner' => $p['xchan_url'],
|
'owner' => $current_url,
|
||||||
'publicKeyPem' => $p['xchan_pubkey']
|
'publicKeyPem' => $p['xchan_pubkey']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,16 +118,20 @@ function localize_item(&$item)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($obj['author']) && $obj['author'] && $obj['author']['link']) {
|
if (isset($obj['actor']) && is_string($obj['actor']) && $obj['actor']) {
|
||||||
$author_link = get_rel_link($obj['author']['link'], 'alternate');
|
$author_link = $obj['actor'];
|
||||||
} else {
|
} elseif (isset($obj['attributedTo']) && is_string($obj['attributedTo']) && $obj['attributedTo']) {
|
||||||
$author_link = '';
|
$author_link = $obj['attributedTo'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$author_link = EMPTY_STR;
|
||||||
}
|
}
|
||||||
|
|
||||||
$author_name = (($obj['author'] && $obj['author']['name']) ? $obj['author']['name'] : '');
|
$author_name = ((array_path_exists('author/name',$obj) && $obj['author']['name']) ? $obj['author']['name'] : '');
|
||||||
|
|
||||||
$item_url = get_rel_link($obj['link'], 'alternate');
|
|
||||||
|
|
||||||
|
if (isset($obj['link'])) {
|
||||||
|
$item_url = get_rel_link($obj['link'], 'alternate');
|
||||||
|
}
|
||||||
$Bphoto = '';
|
$Bphoto = '';
|
||||||
|
|
||||||
switch ($obj['type']) {
|
switch ($obj['type']) {
|
||||||
|
|
|
@ -2439,7 +2439,8 @@ function send_status_notifications($post_id,$item) {
|
||||||
$unfollowed = false;
|
$unfollowed = false;
|
||||||
|
|
||||||
$parent = 0;
|
$parent = 0;
|
||||||
|
$thr_parent_id = 0;
|
||||||
|
|
||||||
if(array_key_exists('verb',$item) && (activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE))) {
|
if(array_key_exists('verb',$item) && (activity_match($item['verb'], ACTIVITY_LIKE) || activity_match($item['verb'], ACTIVITY_DISLIKE))) {
|
||||||
|
|
||||||
$r = q("select id from item where mid = '%s' and uid = %d limit 1",
|
$r = q("select id from item where mid = '%s' and uid = %d limit 1",
|
||||||
|
|
Loading…
Reference in a new issue