Browse Source

add external room settings

main
ghost 11 months ago
parent
commit
816e8c61db
  1. 3
      .env
  2. 1
      config/services.yaml
  3. 17
      src/Controller/RoomController.php

3
.env

@ -51,6 +51,9 @@ APP_KEVACOIN_ROOM_NAMESPACES_READONLY=EDIT_ME @@ -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=/.*/

1
config/services.yaml

@ -16,6 +16,7 @@ parameters: @@ -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)%'

17
src/Controller/RoomController.php

@ -75,6 +75,21 @@ class RoomController extends AbstractController @@ -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 @@ -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(

Loading…
Cancel
Save