mirror of
https://github.com/kevachat/webapp.git
synced 2025-01-22 20:44:59 +00:00
implement post sending api
This commit is contained in:
parent
be01354843
commit
fa2f21321e
@ -85,7 +85,7 @@ class RoomController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set identicon if not anonymous user
|
// Set identicon if not anonymous user
|
||||||
if ($post['key'] === 'anonymous')
|
if ($post['key'] === '@anonymous')
|
||||||
{
|
{
|
||||||
$icon = false;
|
$icon = false;
|
||||||
}
|
}
|
||||||
@ -331,22 +331,43 @@ class RoomController extends AbstractController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO Send message to DHT
|
// Send message to DHT
|
||||||
|
if (
|
||||||
|
$client->kevaPut(
|
||||||
|
$request->get('namespace'),
|
||||||
|
sprintf(
|
||||||
|
'@%s',
|
||||||
|
$request->get('user') === 'ip' ? $request->getClientIp() : 'anonymous'
|
||||||
|
),
|
||||||
|
$request->get('message')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Register event time
|
||||||
|
$memcached->set(
|
||||||
|
$memory['app.add.post.remote.ip.delay'],
|
||||||
|
time(),
|
||||||
|
(int) $this->getParameter('app.add.post.remote.ip.delay')
|
||||||
|
);
|
||||||
|
|
||||||
// Register event time
|
// Redirect back to room
|
||||||
$memcached->set(
|
return $this->redirectToRoute(
|
||||||
$memory['app.add.post.remote.ip.delay'],
|
'room_namespace',
|
||||||
time(),
|
[
|
||||||
(int) $this->getParameter('app.add.post.remote.ip.delay')
|
'namespace' => $request->get('namespace'),
|
||||||
);
|
'error' => null,
|
||||||
|
'message' => null
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Redirect back to room
|
// Something went wrong, return error message
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'room_namespace',
|
'room_namespace',
|
||||||
[
|
[
|
||||||
'namespace' => $request->get('namespace'),
|
'namespace' => $request->get('namespace'),
|
||||||
'error' => null,
|
'message' => $request->get('message'),
|
||||||
'message' => null
|
'error' => $translator->trans('Internal error! Please feedback')
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user