check all protocol comparisons for nomadic suitability

This commit is contained in:
Mike Macgirvin 2024-06-29 06:34:57 +10:00
parent 2fb1f6d7ba
commit 982ff915f3
8 changed files with 11 additions and 11 deletions

View file

@ -745,7 +745,7 @@ function get_security_ids($channel_id, $ob_hash)
if ($xchans[0]['xchan_network'] === 'zot6') {
$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'];
}
}

View file

@ -272,7 +272,7 @@ class AccessList
$sql_extra = " and xchan_network in ('nomad','zot6') ";
break;
case '3':
$sql_extra = " and xchan_network = 'activitypub' ";
$sql_extra = " and xchan_network in ('activitypub', 'apnomadic') ";
break;
case '1':
default:
@ -473,7 +473,7 @@ class AccessList
$sql_extra = " and xchan_network in ('nomad','zot6') ";
}
if (str_starts_with($gv, 'activitypub:')) {
$sql_extra = " and xchan_network = 'activitypub' ";
$sql_extra = " and xchan_network in ('activitypub', 'apnomadic') ";
}
$r = q(
"select channel_id from channel where channel_hash = '%s' ",

View file

@ -501,7 +501,7 @@ class Activity
if ($items) {
$x = [];
foreach ($items as $i) {
if ($i['xchan_network'] === 'activitypub') {
if (in_array($i['xchan_network'], ['activitypub', 'apnomadic'])) {
$x[] = $i['xchan_hash'];
} else {
$x[] = $i['xchan_url'];

View file

@ -381,7 +381,7 @@ class ActivityPub
$jmsg = json_encode($msg, JSON_UNESCAPED_SLASHES);
$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'])
);

View file

@ -95,7 +95,7 @@ class Connect
// 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(
"select * from hubloc where hubloc_hash = '%s' and hubloc_deleted = 0",
dbesc($r['xchan_hash'])
@ -111,7 +111,7 @@ class Connect
// Check the site table to see if we should have a zot6 hubloc,
// 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']);
unset($m['path']);
$h = unparse_url($m);
@ -177,7 +177,7 @@ class Connect
return $result;
}
if ($r['xchan_network'] === 'activitypub') {
if (in_array($r['xchan_network'], [ 'activitypub', 'apnomadic'])) {
if (!$ap_allowed) {
$result['message'] = t('Protocol not supported');
return $result;

View file

@ -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.
$xc = [];
foreach ($abook as $k => $v) {

View file

@ -114,7 +114,7 @@ class Replies extends Controller
$observer = App::get_observer();
$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);
$nitems = [];
foreach ($items as $item) {

View file

@ -95,7 +95,7 @@ class Webfinger extends Controller
$isNomadic = PConfig::Get($channel_target['channel_id'], 'system', 'nomadicAP');
$actorURI = $isNomadic
? Channel::getDidResolver($channel_target) . '/actor'
? Channel::getDidResolver($channel_target, true)
: z_root() . '/channel/' . $channel_target['channel_address'];
if ($channel_target || $site_query) {