mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 00:35:30 +00:00
check all protocol comparisons for nomadic suitability
This commit is contained in:
parent
2fb1f6d7ba
commit
982ff915f3
8 changed files with 11 additions and 11 deletions
|
@ -745,7 +745,7 @@ function get_security_ids($channel_id, $ob_hash)
|
||||||
if ($xchans[0]['xchan_network'] === 'zot6') {
|
if ($xchans[0]['xchan_network'] === 'zot6') {
|
||||||
$groups[] = 'zot:' . $rv['channel_hash'];
|
$groups[] = 'zot:' . $rv['channel_hash'];
|
||||||
}
|
}
|
||||||
if ($xchans[0]['xchan_network'] === 'activitypub') {
|
if (in_array($xchans[0]['xchan_network'], ['activitypub', 'apnomadic'])) {
|
||||||
$groups[] = 'activitypub:' . $rv['channel_hash'];
|
$groups[] = 'activitypub:' . $rv['channel_hash'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -272,7 +272,7 @@ class AccessList
|
||||||
$sql_extra = " and xchan_network in ('nomad','zot6') ";
|
$sql_extra = " and xchan_network in ('nomad','zot6') ";
|
||||||
break;
|
break;
|
||||||
case '3':
|
case '3':
|
||||||
$sql_extra = " and xchan_network = 'activitypub' ";
|
$sql_extra = " and xchan_network in ('activitypub', 'apnomadic') ";
|
||||||
break;
|
break;
|
||||||
case '1':
|
case '1':
|
||||||
default:
|
default:
|
||||||
|
@ -473,7 +473,7 @@ class AccessList
|
||||||
$sql_extra = " and xchan_network in ('nomad','zot6') ";
|
$sql_extra = " and xchan_network in ('nomad','zot6') ";
|
||||||
}
|
}
|
||||||
if (str_starts_with($gv, 'activitypub:')) {
|
if (str_starts_with($gv, 'activitypub:')) {
|
||||||
$sql_extra = " and xchan_network = 'activitypub' ";
|
$sql_extra = " and xchan_network in ('activitypub', 'apnomadic') ";
|
||||||
}
|
}
|
||||||
$r = q(
|
$r = q(
|
||||||
"select channel_id from channel where channel_hash = '%s' ",
|
"select channel_id from channel where channel_hash = '%s' ",
|
||||||
|
|
|
@ -501,7 +501,7 @@ class Activity
|
||||||
if ($items) {
|
if ($items) {
|
||||||
$x = [];
|
$x = [];
|
||||||
foreach ($items as $i) {
|
foreach ($items as $i) {
|
||||||
if ($i['xchan_network'] === 'activitypub') {
|
if (in_array($i['xchan_network'], ['activitypub', 'apnomadic'])) {
|
||||||
$x[] = $i['xchan_hash'];
|
$x[] = $i['xchan_hash'];
|
||||||
} else {
|
} else {
|
||||||
$x[] = $i['xchan_url'];
|
$x[] = $i['xchan_url'];
|
||||||
|
|
|
@ -381,7 +381,7 @@ class ActivityPub
|
||||||
$jmsg = json_encode($msg, JSON_UNESCAPED_SLASHES);
|
$jmsg = json_encode($msg, JSON_UNESCAPED_SLASHES);
|
||||||
|
|
||||||
$r = q("select * from abook left join hubloc on abook_xchan = hubloc_hash
|
$r = q("select * from abook left join hubloc on abook_xchan = hubloc_hash
|
||||||
where abook_channel = %d and hubloc_network = 'activitypub'",
|
where abook_channel = %d and hubloc_network in ('activitypub', 'apnomadic') ",
|
||||||
intval($x['sender']['channel_id'])
|
intval($x['sender']['channel_id'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class Connect
|
||||||
|
|
||||||
// ensure there's a valid hubloc for this xchan before proceeding - you cannot connect without it
|
// ensure there's a valid hubloc for this xchan before proceeding - you cannot connect without it
|
||||||
|
|
||||||
if (in_array($r['xchan_network'], ['nomad', 'zot6', 'activitypub'])) {
|
if (in_array($r['xchan_network'], ['nomad', 'zot6', 'activitypub', 'apnomadic'])) {
|
||||||
$h = q(
|
$h = q(
|
||||||
"select * from hubloc where hubloc_hash = '%s' and hubloc_deleted = 0",
|
"select * from hubloc where hubloc_hash = '%s' and hubloc_deleted = 0",
|
||||||
dbesc($r['xchan_hash'])
|
dbesc($r['xchan_hash'])
|
||||||
|
@ -111,7 +111,7 @@ class Connect
|
||||||
// Check the site table to see if we should have a zot6 hubloc,
|
// Check the site table to see if we should have a zot6 hubloc,
|
||||||
// If so, clear the xchan and start fresh
|
// If so, clear the xchan and start fresh
|
||||||
|
|
||||||
if ($r['xchan_network'] === 'activitypub') {
|
if (in_array($r['xchan_network'], [ 'activitypub', 'apnomadic'])) {
|
||||||
$m = parse_url($r['xchan_hash']);
|
$m = parse_url($r['xchan_hash']);
|
||||||
unset($m['path']);
|
unset($m['path']);
|
||||||
$h = unparse_url($m);
|
$h = unparse_url($m);
|
||||||
|
@ -177,7 +177,7 @@ class Connect
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($r['xchan_network'] === 'activitypub') {
|
if (in_array($r['xchan_network'], [ 'activitypub', 'apnomadic'])) {
|
||||||
if (!$ap_allowed) {
|
if (!$ap_allowed) {
|
||||||
$result['message'] = t('Protocol not supported');
|
$result['message'] = t('Protocol not supported');
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -548,7 +548,7 @@ class Libsync
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!$found) && (!in_array($abook['xchan_network'], ['nomad', 'zot6', 'activitypub']))) {
|
if ((!$found) && (!in_array($abook['xchan_network'], ['nomad', 'zot6', 'activitypub', 'apnomadic']))) {
|
||||||
// just import the record.
|
// just import the record.
|
||||||
$xc = [];
|
$xc = [];
|
||||||
foreach ($abook as $k => $v) {
|
foreach ($abook as $k => $v) {
|
||||||
|
|
|
@ -114,7 +114,7 @@ class Replies extends Controller
|
||||||
|
|
||||||
$observer = App::get_observer();
|
$observer = App::get_observer();
|
||||||
$parent = $i[0];
|
$parent = $i[0];
|
||||||
$recips = (($parent['owner']['xchan_network'] === 'activitypub') ? get_iconfig($parent['id'], 'activitypub', 'recips', []) : []);
|
$recips = ((in_array($parent['owner']['xchan_network'], ['activitypub', 'apnomadic'])) ? get_iconfig($parent['id'], 'activitypub', 'recips', []) : []);
|
||||||
$to = (($recips && array_key_exists('to', $recips) && is_array($recips['to'])) ? $recips['to'] : null);
|
$to = (($recips && array_key_exists('to', $recips) && is_array($recips['to'])) ? $recips['to'] : null);
|
||||||
$nitems = [];
|
$nitems = [];
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ class Webfinger extends Controller
|
||||||
|
|
||||||
$isNomadic = PConfig::Get($channel_target['channel_id'], 'system', 'nomadicAP');
|
$isNomadic = PConfig::Get($channel_target['channel_id'], 'system', 'nomadicAP');
|
||||||
$actorURI = $isNomadic
|
$actorURI = $isNomadic
|
||||||
? Channel::getDidResolver($channel_target) . '/actor'
|
? Channel::getDidResolver($channel_target, true)
|
||||||
: z_root() . '/channel/' . $channel_target['channel_address'];
|
: z_root() . '/channel/' . $channel_target['channel_address'];
|
||||||
|
|
||||||
if ($channel_target || $site_query) {
|
if ($channel_target || $site_query) {
|
||||||
|
|
Loading…
Reference in a new issue