add push events support

This commit is contained in:
ghost 2023-09-15 01:43:20 +03:00
parent 7c054557f3
commit 64693f7774
5 changed files with 151 additions and 24 deletions

View file

@ -188,6 +188,27 @@ else {
// Update form
if (!empty($_POST)) {
// Push event to other nodes
if (API_EXPORT_ENABLED &&
API_EXPORT_PUSH_ENABLED &&
API_EXPORT_USERS_ENABLED &&
API_EXPORT_MAGNETS_ENABLED)
{
if (!$memoryApiExportPush = $memory->get('api.export.push'))
{
$memoryApiExportPush = [];
}
$memoryApiExportPush[] = (object)
[
'time' => time(),
'userId' => $user->userId,
'magnetId' => $magnet->magnetId,
];
$memory->set('api.export.push', $memoryApiExportPush, 3600);
}
// Approve by moderation request
if (in_array($user->address, MODERATOR_IP_LIST))
{