xchan_url for local channels is not tracking nomadic state

This commit is contained in:
Mike Macgirvin 2024-08-10 14:40:42 +10:00
parent f1db154fbe
commit 2301f2c5a1
4 changed files with 40 additions and 3 deletions

View file

@ -27,7 +27,7 @@ use Code\Lib\Url;
*/
const REPOSITORY_ID = 'streams';
const DB_UPDATE_VERSION = 1282;
const DB_UPDATE_VERSION = 1283;
const PROJECT_BASE = __DIR__;
const ACTIVITYPUB_ENABLED = true;
const NOMAD_PROTOCOL_VERSION = '13.3';

View file

@ -928,7 +928,7 @@ function builtin_activity_puller($item, &$conv_responses)
foreach ($conv_responses as $mode => $v) {
if (!$item['author']['xchan_name']) {
continue;
}

View file

@ -479,7 +479,7 @@ class Channel
'xchan_photo_m' => z_root() . "/photo/profile/m/{$newuid}",
'xchan_photo_s' => z_root() . "/photo/profile/s/{$newuid}",
'xchan_addr' => self::get_webfinger($ret['channel']),
'xchan_url' => (($system) ? z_root() : Channel::url($ret['channel'])),
'xchan_url' => (($system) ? z_root() : Channel::getDidResolver($ret['channel'],true)),
'xchan_follow' => z_root() . '/follow?f=&url=%s',
'xchan_connurl' => z_root() . '/poco/' . $ret['channel']['channel_address'],
'xchan_name' => $ret['channel']['channel_name'],

37
src/Update/_1283.php Normal file
View file

@ -0,0 +1,37 @@
<?php
namespace Code\Update;
use Code\Lib\Channel;
use Code\Lib\PConfig;
class _1283
{
public function run()
{
$channels = q("select * from channel left join xchan on channel_hash = xchan_hash and xchan_network like ('%s')",
dbesc('nomad%')
);
if ($channels) {
foreach ($channels as $channel) {
$nomadic = (PConfig::Get($channel['channel_id'], 'system', 'nomadicAP') || $channel['xchan_network'] === 'nomadic');
if ($nomadic) {
q("UPDATE xchan set xchan_url = '%s' where xchan_id = %d",
dbesc(Channel::getDidResolver($channel, true)),
intval($channel['xchan_id'])
);
}
}
}
return UPDATE_SUCCESS;
}
public function verify()
{
return true;
}
}