|
|
|
@ -30,6 +30,7 @@ use App\Util\ActivityPub\{
|
|
|
|
|
};
|
|
|
|
|
use Zttp\Zttp;
|
|
|
|
|
use App\Services\InstanceService;
|
|
|
|
|
use App\Services\AccountService;
|
|
|
|
|
|
|
|
|
|
class FederationController extends Controller
|
|
|
|
|
{
|
|
|
|
@ -239,12 +240,15 @@ class FederationController extends Controller
|
|
|
|
|
{
|
|
|
|
|
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
|
|
|
|
|
|
|
|
|
$id = AccountService::usernameToId($username);
|
|
|
|
|
abort_if(!$id, 404);
|
|
|
|
|
$account = AccountService::get($id);
|
|
|
|
|
abort_if(!$account || !isset($account['following_count']), 404);
|
|
|
|
|
$obj = [
|
|
|
|
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
|
|
|
|
'id' => $request->getUri(),
|
|
|
|
|
'type' => 'OrderedCollectionPage',
|
|
|
|
|
'totalItems' => 0,
|
|
|
|
|
'orderedItems' => []
|
|
|
|
|
'type' => 'OrderedCollection',
|
|
|
|
|
'totalItems' => $account['following_count'] ?? 0,
|
|
|
|
|
];
|
|
|
|
|
return response()->json($obj);
|
|
|
|
|
}
|
|
|
|
@ -252,15 +256,16 @@ class FederationController extends Controller
|
|
|
|
|
public function userFollowers(Request $request, $username)
|
|
|
|
|
{
|
|
|
|
|
abort_if(!config_cache('federation.activitypub.enabled'), 404);
|
|
|
|
|
|
|
|
|
|
$id = AccountService::usernameToId($username);
|
|
|
|
|
abort_if(!$id, 404);
|
|
|
|
|
$account = AccountService::get($id);
|
|
|
|
|
abort_if(!$account || !isset($account['followers_count']), 404);
|
|
|
|
|
$obj = [
|
|
|
|
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
|
|
|
|
'id' => $request->getUri(),
|
|
|
|
|
'type' => 'OrderedCollectionPage',
|
|
|
|
|
'totalItems' => 0,
|
|
|
|
|
'orderedItems' => []
|
|
|
|
|
'type' => 'OrderedCollection',
|
|
|
|
|
'totalItems' => $account['followers_count'] ?? 0,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return response()->json($obj);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|