mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:35:13 +00:00
store follow counts
This commit is contained in:
parent
4b1fd36e86
commit
31fa60f6eb
2 changed files with 28 additions and 12 deletions
|
@ -2573,9 +2573,9 @@ class Activity
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$m = parse_url($url);
|
$collection = parse_url($url);
|
||||||
if ($m['scheme'] && $m['host']) {
|
if ($collection['scheme'] && $collection['host']) {
|
||||||
$site_url = $m['scheme'] . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : '');
|
$site_url = $collection['scheme'] . '://' . $collection['host'] . (($collection['port']) ? ':' . $collection['port'] : '');
|
||||||
if (!SConfig::Get($site_url,'system','owa')) {
|
if (!SConfig::Get($site_url,'system','owa')) {
|
||||||
if ($webfinger === null) {
|
if ($webfinger === null) {
|
||||||
$webfinger = Webfinger::exec($webfingerAddress);
|
$webfinger = Webfinger::exec($webfingerAddress);
|
||||||
|
@ -2638,6 +2638,20 @@ class Activity
|
||||||
|
|
||||||
if ($collections) {
|
if ($collections) {
|
||||||
set_xconfig($url, 'activitypub', 'collections', $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(
|
$h = q(
|
||||||
|
@ -2646,10 +2660,10 @@ class Activity
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$m = parse_url($url);
|
$collection = parse_url($url);
|
||||||
if ($m) {
|
if ($collection) {
|
||||||
$hostname = $m['host'];
|
$hostname = $collection['host'];
|
||||||
$baseurl = $m['scheme'] . '://' . $m['host'] . ((isset($m['port']) && intval($m['port'])) ? ':' . $m['port'] : '');
|
$baseurl = $collection['scheme'] . '://' . $collection['host'] . ((isset($collection['port']) && intval($collection['port'])) ? ':' . $collection['port'] : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$h) {
|
if (!$h) {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Code\Module;
|
namespace Code\Module;
|
||||||
|
|
||||||
use App;
|
use App;
|
||||||
|
use Code\Lib\XConfig;
|
||||||
use Code\Web\Controller;
|
use Code\Web\Controller;
|
||||||
use Code\Lib\Libzot;
|
use Code\Lib\Libzot;
|
||||||
use Code\Lib\Zotfinger;
|
use Code\Lib\Zotfinger;
|
||||||
|
@ -115,10 +116,9 @@ class Chanview extends Controller
|
||||||
$about = zidify_links(bbcode($xprof[0]['xprof_about']));
|
$about = zidify_links(bbcode($xprof[0]['xprof_about']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$followers = t('Not available');
|
$followers = $following = 'unset';
|
||||||
$following = t('Not available');
|
|
||||||
|
|
||||||
$f = get_xconfig(App::$poi['xchan_hash'], 'activitypub', 'collections');
|
$f = XConfig::Get(App::$poi['xchan_hash'], 'activitypub', 'collections');
|
||||||
if ($f && isset($f['followers'])) {
|
if ($f && isset($f['followers'])) {
|
||||||
$m = Activity::fetch($f['followers']);
|
$m = Activity::fetch($f['followers']);
|
||||||
if (is_array($m) && isset($m['totalItems'])) {
|
if (is_array($m) && isset($m['totalItems'])) {
|
||||||
|
@ -131,6 +131,8 @@ class Chanview extends Controller
|
||||||
$following = intval($m['totalItems']);
|
$following = intval($m['totalItems']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
XConfig::Set(App::$poi['xchan_hash'], 'activitypub', 'follows', $followers . '/' . $following);
|
||||||
|
|
||||||
|
|
||||||
$o = replace_macros(Theme::get_template('chanview.tpl'), [
|
$o = replace_macros(Theme::get_template('chanview.tpl'), [
|
||||||
'$url' => $url,
|
'$url' => $url,
|
||||||
|
@ -139,8 +141,8 @@ class Chanview extends Controller
|
||||||
'$about' => $about,
|
'$about' => $about,
|
||||||
'$followers_txt' => t('Followers'),
|
'$followers_txt' => t('Followers'),
|
||||||
'$following_txt' => t('Following'),
|
'$following_txt' => t('Following'),
|
||||||
'$followers' => $followers,
|
'$followers' => (($followers === 'unset') ? t('Not available') : $followers),
|
||||||
'$following' => $following,
|
'$following' => (($following === 'unset') ? t('Not available') : $following),
|
||||||
'$visit' => t('Visit'),
|
'$visit' => t('Visit'),
|
||||||
'$outbox' => $load_outbox,
|
'$outbox' => $load_outbox,
|
||||||
'$view' => t('View Recent'),
|
'$view' => t('View Recent'),
|
||||||
|
|
Loading…
Reference in a new issue