Merge branch 'dev' into nomadic

This commit is contained in:
Mike Macgirvin 2024-06-29 05:43:07 +10:00
commit 2fb1f6d7ba
8 changed files with 10100 additions and 10044 deletions

View file

@ -447,7 +447,7 @@ function contact_remove($channel_id, $abook_id, $atoken_sync = false)
Hook::call('connection_remove', $x);
$archive = get_pconfig($channel_id, 'system', 'archive_removed_contacts', true);
$archive = get_pconfig($channel_id, 'system', 'archive_removed_contacts');
if ($archive) {
q(
"update abook set abook_archived = 1 where abook_id = %d and abook_channel = %d",

View file

@ -2658,9 +2658,9 @@ class Activity
}
$m = parse_url($url);
if ($m['scheme'] && $m['host']) {
$site_url = $m['scheme'] . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : '');
$collection = parse_url($url);
if ($collection['scheme'] && $collection['host']) {
$site_url = $collection['scheme'] . '://' . $collection['host'] . (($collection['port']) ? ':' . $collection['port'] : '');
if (!SConfig::Get($site_url,'system','owa')) {
if ($webfinger === null) {
$webfinger = Webfinger::exec($webfingerAddress);
@ -2723,6 +2723,20 @@ class Activity
if ($collections) {
set_xconfig($url, 'activitypub', 'collections', $collections);
$followers = $following = 'unset';
if (isset($collections['followers'])) {
$collection = Activity::fetch($collections['followers']);
if (is_array($collection) && isset($collection['totalItems'])) {
$followers = intval($collection['totalItems']);
}
}
if (isset($collections['following'])) {
$collection = Activity::fetch($collections['following']);
if (is_array($collection) && isset($collection['totalItems'])) {
$following = intval($collection['totalItems']);
}
}
set_xconfig($url, 'activitypub', 'follows', $followers . '/' . $following);
}
$h = q(
@ -2731,10 +2745,10 @@ class Activity
);
$m = parse_url($url);
if ($m) {
$hostname = $m['host'];
$baseurl = $m['scheme'] . '://' . $m['host'] . ((isset($m['port']) && intval($m['port'])) ? ':' . $m['port'] : '');
$collection = parse_url($url);
if ($collection) {
$hostname = $collection['host'];
$baseurl = $collection['scheme'] . '://' . $collection['host'] . ((isset($collection['port']) && intval($collection['port'])) ? ':' . $collection['port'] : '');
}
if (!$h) {
@ -3450,6 +3464,11 @@ class Activity
$item['edited'] = $item['created'];
}
// lemmy comment controls
if (isset($act->obj['commentEnabled']) && !$act->obj['commentsEnabled']) {
$item['comment_policy'] = 'none';
}
if ($item['mid'] === $item['parent_mid']) {
// it is a parent node - decode the comment policy info if present
if ($act->objprop('commentPolicy')) {
@ -4799,7 +4818,7 @@ class Activity
if (isset($a['name']) && $a['name']) {
$alt = htmlspecialchars($a['name'], ENT_QUOTES, 'UTF-8', false);
$alt = str_replace(['[', ']'], ['[', ']'], $alt);
$item['body'] .= "\n\n" . '[video title="' . $alt . '"]' . $a['href'] . '[/img]';
$item['body'] .= "\n\n" . '[video title="' . $alt . '"]' . $a['href'] . '[/video]';
} else {
$item['body'] .= "\n\n" . '[video]' . $a['href'] . '[/video]';
}
@ -4810,6 +4829,15 @@ class Activity
$item['body'] .= "\n\n" . '[audio]' . $a['href'] . '[/audio]';
}
}
if (!isset($a['type']) && ActivityStreams::is_url($a['href']) && !strpos($item['body'], $a['href'])) {
$li = Url::get(z_root() . '/linkinfo?binurl=' . bin2hex($a['href']));
if ($li['success'] && $li['body']) {
$item['body'] .= "\n" . $li['body'];
} else {
$item['body'] .= "\n\n" . $a['href'];
}
}
if (array_key_exists('type', $a) && stripos($a['type'], 'activity') !== false) {
if (self::share_not_in_body($item['body'])) {
$item = self::get_quote($a['href'], $item);

View file

@ -3,6 +3,7 @@
namespace Code\Module;
use App;
use Code\Lib\XConfig;
use Code\Web\Controller;
use Code\Lib\Libzot;
use Code\Lib\Zotfinger;
@ -115,10 +116,9 @@ class Chanview extends Controller
$about = zidify_links(bbcode($xprof[0]['xprof_about']));
}
$followers = t('Not available');
$following = t('Not available');
$followers = $following = 'unset';
$f = get_xconfig(App::$poi['xchan_hash'], 'activitypub', 'collections');
$f = XConfig::Get(App::$poi['xchan_hash'], 'activitypub', 'collections');
if ($f && isset($f['followers'])) {
$m = Activity::fetch($f['followers']);
if (is_array($m) && isset($m['totalItems'])) {
@ -131,6 +131,8 @@ class Chanview extends Controller
$following = intval($m['totalItems']);
}
}
XConfig::Set(App::$poi['xchan_hash'], 'activitypub', 'follows', $followers . '/' . $following);
$o = replace_macros(Theme::get_template('chanview.tpl'), [
'$url' => $url,
@ -139,8 +141,8 @@ class Chanview extends Controller
'$about' => $about,
'$followers_txt' => t('Followers'),
'$following_txt' => t('Following'),
'$followers' => $followers,
'$following' => $following,
'$followers' => (($followers === 'unset') ? t('Not available') : $followers),
'$following' => (($following === 'unset') ? t('Not available') : $following),
'$visit' => t('Visit'),
'$outbox' => $load_outbox,
'$view' => t('View Recent'),

View file

@ -459,6 +459,10 @@ class Directory extends Controller
'keywords' => $out,
'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '',
'ignore_label' => t('Don\'t suggest'),
'followers_label' => t('Followers:'),
'following_label' => t('Following:'),
'followers' => (($rr['followers'] === 'unset') ? '' : $rr['followers']),
'following' => (($rr['following'] === 'unset') ? '' : $rr['following']),
'common_friends' => (($common[$rr['hash']]) ? intval($common[$rr['hash']]) : ''),
'common_label' => t('Suggestion ranking:'),
'common_count' => intval($common[$rr['hash']]),

View file

@ -4,6 +4,7 @@ namespace Code\Module;
use App;
use Code\Lib\Time;
use Code\Lib\XConfig;
use Code\Web\Controller;
// This is the primary endpoint for communicating with Zot directory services.
@ -203,12 +204,6 @@ class Dirsearch extends Controller
if ($sort_order == 'normal') {
$order = " order by xchan_name asc ";
// Start the alphabetic search at 'A'
// This will make a handful of channels whose names begin with
// punctuation un-searchable in this mode
$safesql .= " and ascii(substring(xchan_name FROM 1 FOR 1)) > 64 ";
} elseif ($sort_order == 'reverse') {
$order = " order by xchan_name desc ";
} elseif ($sort_order == 'reversedate') {
@ -268,6 +263,7 @@ class Dirsearch extends Controller
continue;
}
$follows = explode('/', XConfig::Get($rr['xchan_hash'], 'activitypub', 'follows', 'unset/unset'));
$entry = [];
@ -295,7 +291,8 @@ class Dirsearch extends Controller
$entry['homepage'] = $rr['xprof_homepage'];
$entry['hometown'] = $rr['xprof_hometown'];
$entry['keywords'] = $rr['xprof_keywords'];
$entry['followers'] = $follows[0];
$entry['following'] = $follows[1];
$entries[] = $entry;
}

File diff suppressed because it is too large Load diff

View file

@ -1,2 +1,2 @@
<?php
define ('STD_VERSION', '24.06.22');
define ('STD_VERSION', '24.06.29');

View file

@ -33,6 +33,18 @@
</div>
{{/if}}
{{if $entry.followers}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.followers_label}}</span> {{$entry.followers}}
</div>
{{/if}}
{{if $entry.following}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.following_label}}</span> {{$entry.following}}
</div>
{{/if}}
{{if $entry.common_friends}}
<div id="dir-common" class="contact-info-element">
<span class="contact-info-label">{{$entry.common_label}}</span> {{$entry.common_count}}