mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-15 04:27:46 +02:00
feat(nodeinfo2): add .well-known route for nodeinfo2 containing metadata about the castopod instance
This commit is contained in:
parent
5bf7200fb3
commit
88fddc81d7
5 changed files with 154 additions and 0 deletions
|
|
@ -470,6 +470,7 @@ class PostModel extends BaseUuidModel
|
|||
'actor_id' => $actor->id,
|
||||
'reblog_of_id' => $post->id,
|
||||
'published_at' => Time::now(),
|
||||
'created_by' => user_id(),
|
||||
]);
|
||||
|
||||
// add reblog
|
||||
|
|
@ -593,6 +594,31 @@ class PostModel extends BaseUuidModel
|
|||
}
|
||||
}
|
||||
|
||||
public function getTotalLocalPosts(): int
|
||||
{
|
||||
helper('fediverse');
|
||||
|
||||
$cacheName = config('Fediverse')
|
||||
->cachePrefix . 'blocked_actors';
|
||||
if (! ($found = cache($cacheName))) {
|
||||
$tablePrefix = config('Fediverse')
|
||||
->tablesPrefix;
|
||||
$result = $this->select('COUNT(*) as total_local_posts')
|
||||
->join($tablePrefix . 'actors', $tablePrefix . 'actors.id = ' . $tablePrefix . 'posts.actor_id')
|
||||
->where($tablePrefix . 'actors.domain', get_current_domain())
|
||||
->where('`published_at` <= NOW()', null, false)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
$found = (int) $result[0]['total_local_posts'];
|
||||
|
||||
cache()
|
||||
->save($cacheName, $found, DECADE);
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
public function clearCache(Post $post): void
|
||||
{
|
||||
$cachePrefix = config('Fediverse')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue