mirror of
https://github.com/kevachat/webapp.git
synced 2025-02-08 12:54:14 +00:00
draft post features
This commit is contained in:
parent
6275f7d427
commit
7e0d0e2b7d
8
.env
8
.env
@ -54,4 +54,10 @@ APP_ADD_ROOM_REMOTE_IP_REGEX=/.*/
|
|||||||
APP_ADD_POST_REMOTE_IP_REGEX=/.*/
|
APP_ADD_POST_REMOTE_IP_REGEX=/.*/
|
||||||
|
|
||||||
# Time quota for remote publications by IP (seconds)
|
# Time quota for remote publications by IP (seconds)
|
||||||
APP_ADD_POST_REMOTE_IP_DELAY=60
|
APP_ADD_POST_REMOTE_IP_DELAY=60
|
||||||
|
|
||||||
|
# Skip access limits for following IPs separated by |
|
||||||
|
APP_ADD_POST_REMOTE_IP_MODERATORS=
|
||||||
|
|
||||||
|
# Post content rules (for kevacoin value)
|
||||||
|
APP_ADD_POST_VALUE_REGEX=/[\w]{2,3072}/
|
@ -18,6 +18,11 @@ parameters:
|
|||||||
app.kevacoin.mine.address: '%env(APP_KEVACOIN_MINE_ADDRESS)%'
|
app.kevacoin.mine.address: '%env(APP_KEVACOIN_MINE_ADDRESS)%'
|
||||||
app.kevacoin.mine.pool.url: '%env(APP_KEVACOIN_MINE_POOL_URL)%'
|
app.kevacoin.mine.pool.url: '%env(APP_KEVACOIN_MINE_POOL_URL)%'
|
||||||
app.kevacoin.mine.solo.url: '%env(APP_KEVACOIN_MINE_SOLO_URL)%'
|
app.kevacoin.mine.solo.url: '%env(APP_KEVACOIN_MINE_SOLO_URL)%'
|
||||||
|
app.add.room.remote.ip.regex: '%env(APP_ADD_ROOM_REMOTE_IP_REGEX)%'
|
||||||
|
app.add.post.remote.ip.regex: '%env(APP_ADD_POST_REMOTE_IP_REGEX)%'
|
||||||
|
app.add.post.remote.ip.delay: '%env(APP_ADD_POST_REMOTE_IP_DELAY)%'
|
||||||
|
app.add.post.remote.ip.moderators: '%env(APP_ADD_POST_REMOTE_IP_MODERATORS)%'
|
||||||
|
app.add.post.value.regex: '%env(APP_ADD_POST_VALUE_REGEX)%'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# default configuration for services in *this* file
|
# default configuration for services in *this* file
|
||||||
|
@ -148,7 +148,7 @@ class RoomController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[Route(
|
#[Route(
|
||||||
'/room/{namespace}/post',
|
'/room/{namespace}',
|
||||||
name: 'room_post',
|
name: 'room_post',
|
||||||
requirements:
|
requirements:
|
||||||
[
|
[
|
||||||
@ -172,7 +172,7 @@ class RoomController extends AbstractController
|
|||||||
$this->getParameter('app.kevacoin.password')
|
$this->getParameter('app.kevacoin.password')
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check namespace exist for this wallet
|
// Get local namespaces
|
||||||
$namespaces = [];
|
$namespaces = [];
|
||||||
|
|
||||||
foreach ((array) $client->kevaListNamespaces() as $value)
|
foreach ((array) $client->kevaListNamespaces() as $value)
|
||||||
@ -180,14 +180,45 @@ class RoomController extends AbstractController
|
|||||||
$namespaces[] = $value['namespaceId'];
|
$namespaces[] = $value['namespaceId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check namespace exist for this wallet
|
||||||
if (!in_array($request->get('namespace'), $namespaces))
|
if (!in_array($request->get('namespace'), $namespaces))
|
||||||
{
|
{
|
||||||
exit('Namespace not related with this node!');
|
exit('Namespace not related with this node!');
|
||||||
}
|
}
|
||||||
|
|
||||||
// @TODO
|
// Check namespace writable
|
||||||
|
if (!in_array($request->get('namespace'), (array) explode('|', $this->getParameter('app.kevacoin.room.namespaces'))))
|
||||||
|
{
|
||||||
|
exit('Namespace not listed in settings!');
|
||||||
|
}
|
||||||
|
|
||||||
// Redirect back to the room
|
// Validate access to the room namespace
|
||||||
|
if
|
||||||
|
(
|
||||||
|
// Ignore this rule for is moderators
|
||||||
|
!in_array(
|
||||||
|
(array) explode('|', $this->getParameter('app.add.post.remote.ip.moderators'))
|
||||||
|
) &&
|
||||||
|
|
||||||
|
// Check namespace writable or user is moderator
|
||||||
|
in_array(
|
||||||
|
$request->get('namespace'),
|
||||||
|
(array) explode('|', $this->getParameter('app.kevacoin.room.namespaces.readonly'))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
exit('Namespace for read only!');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate remote IP regex
|
||||||
|
|
||||||
|
// Validate remote IP limits
|
||||||
|
|
||||||
|
// Validate funds
|
||||||
|
|
||||||
|
// @TODO Send message to DHT
|
||||||
|
|
||||||
|
// Redirect back to room
|
||||||
return $this->redirectToRoute(
|
return $this->redirectToRoute(
|
||||||
'room_namespace',
|
'room_namespace',
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user