mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 16:15:13 +00:00
xchan confusion
This commit is contained in:
parent
875b877763
commit
eb225639c6
1 changed files with 18 additions and 8 deletions
|
@ -6,6 +6,7 @@ namespace Code\Module;
|
|||
|
||||
|
||||
use App;
|
||||
use Code\Lib\ActorId;
|
||||
use Code\Lib\Time;
|
||||
use Code\Web\HTTPSig;
|
||||
use Code\Lib\ActivityStreams;
|
||||
|
@ -261,7 +262,7 @@ class Inbox extends Controller
|
|||
|
||||
$collections = Activity::get_actor_collections($observer_hash);
|
||||
|
||||
if (is_array($collections) && in_array($collections['followers'], $AS->recips)
|
||||
if ((is_array($collections) && in_array($collections['followers'], $AS->recips))
|
||||
|| in_array(ACTIVITY_PUBLIC_INBOX, $AS->recips)
|
||||
|| in_array('Public', $AS->recips)
|
||||
|| in_array('as:Public', $AS->recips)) {
|
||||
|
@ -280,14 +281,23 @@ class Inbox extends Controller
|
|||
// deliver to anybody at this site directly addressed
|
||||
$channel_addr = '';
|
||||
foreach($AS->recips as $recip) {
|
||||
if (str_starts_with($recip, z_root())) {
|
||||
$channel_addr .= '\'' . dbesc(basename($recip)) . '\',';
|
||||
if (!str_starts_with($recip, z_root())) {
|
||||
continue;
|
||||
}
|
||||
$actorId = new ActorId($recip);
|
||||
if ($actorId->getType() === ActorId::ACTORID_TYPE_URL) {
|
||||
$query = q("SELECT * from channel left join xchan on channel_hash = xchan_hash where xchan_url = '%s' and channel_removed = 0",
|
||||
dbesc($recip)
|
||||
);
|
||||
}
|
||||
else {
|
||||
$query = q("select * from channel left join xchan on channel_hash = xchan_hash where xchan_epubkey = '%s' and channel_removed = 0",
|
||||
dbesc(str_replace('did:key:', '', $actorId->getId()))
|
||||
);
|
||||
}
|
||||
if ($query) {
|
||||
$channels[] = array_shift($query);
|
||||
}
|
||||
}
|
||||
if ($channel_addr) {
|
||||
$channel_addr = rtrim($channel_addr, ',');
|
||||
$channels = dbq("SELECT * FROM channel
|
||||
WHERE channel_address IN ($channel_addr) AND channel_removed = 0");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue