add external room settings

This commit is contained in:
ghost 2023-12-06 05:02:11 +02:00
parent 0aecdd302d
commit 816e8c61db
3 changed files with 20 additions and 1 deletions

3
.env
View File

@ -51,6 +51,9 @@ APP_KEVACOIN_ROOM_NAMESPACES_READONLY=EDIT_ME
# Redirect from index page to default room
APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT=EDIT_ME
# Allow users to read external node rooms (true|false)
APP_KEVACOIN_ROOM_NAMESPACE_EXTERNAL=false
# Allow remotes to create new rooms (namespaces)
APP_ADD_ROOM_REMOTE_IP_REGEX=/.*/

View File

@ -16,6 +16,7 @@ parameters:
app.kevacoin.room.namespaces: '%env(APP_KEVACOIN_ROOM_NAMESPACES)%'
app.kevacoin.room.namespaces.readonly: '%env(APP_KEVACOIN_ROOM_NAMESPACES_READONLY)%'
app.kevacoin.room.namespace.default: '%env(APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT)%'
app.kevacoin.room.namespace.external: '%env(APP_KEVACOIN_ROOM_NAMESPACE_EXTERNAL)%'
app.kevacoin.mine.address: '%env(APP_KEVACOIN_MINE_ADDRESS)%'
app.kevacoin.mine.pool.url: '%env(APP_KEVACOIN_MINE_POOL_URL)%'
app.kevacoin.mine.solo.url: '%env(APP_KEVACOIN_MINE_SOLO_URL)%'

View File

@ -75,6 +75,21 @@ class RoomController extends AbstractController
}
}
// Check for external rooms reading allowed in config
if (
!in_array(
$request->get('namespace'),
(array) explode('|', $this->getParameter('app.kevacoin.room.namespaces'))
)
&&
$this->getParameter('app.kevacoin.room.namespace.external') === 'false'
) {
// @TODO process to error page instead of redirect to default room
return $this->redirectToRoute(
'room_index'
);
}
// Get room feed
$feed = [];
@ -225,7 +240,7 @@ class RoomController extends AbstractController
);
}
// Check namespace writable
// Check namespace defined in config
if (!in_array($request->get('namespace'), (array) explode('|', $this->getParameter('app.kevacoin.room.namespaces'))))
{
return $this->redirectToRoute(