From dc4e9d61c2b87c6798ccbdf64ec02c35a73719ce Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 5 Dec 2023 17:36:26 +0200 Subject: [PATCH] add room namespaces whitelist --- .env | 12 ++++++------ config/services.yaml | 4 ++-- src/Controller/ModuleController.php | 4 ++-- src/Controller/RoomController.php | 4 ++-- templates/default/module/info.html.twig | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.env b/.env index fba4968..f9a2415 100644 --- a/.env +++ b/.env @@ -31,16 +31,16 @@ APP_KEVACOIN_PORT=9992 APP_KEVACOIN_USERNAME=EDIT_ME APP_KEVACOIN_PASSWORD=EDIT_ME -# Default room namespace (must be owned to accept posts) -APP_KEVACOIN_NAMESPACE=EDIT_ME - -# Address to receive kevacoin powers (make others able to fill node balance) -APP_KEVACOIN_ADDRESS=EDIT_ME - # Share with other some mining pool to get coins APP_KEVACOIN_MINE_POOL_URL=https://miningpoolstats.stream/kevacoin APP_KEVACOIN_MINE_SOLO_URL=https://kevacoin.org/tutorial_solo_mining.html +# Address to receive kevacoin powers (make others able to fill node balance) +APP_KEVACOIN_MINE_ADDRESS=EDIT_ME + +# Allowed room namespaces, separated with | (must be owned to accept posts) +APP_KEVACOIN_ROOM_NAMESPACES=EDIT_ME + # Allow remotes to create new rooms (namespaces) APP_ADD_ROOM_REMOTE_IP_REGEX=/.*/ diff --git a/config/services.yaml b/config/services.yaml index 3a3d128..07d216e 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -12,8 +12,8 @@ parameters: app.kevacoin.port: '%env(APP_KEVACOIN_PORT)%' app.kevacoin.username: '%env(APP_KEVACOIN_USERNAME)%' app.kevacoin.password: '%env(APP_KEVACOIN_PASSWORD)%' - app.kevacoin.namespace: '%env(APP_KEVACOIN_NAMESPACE)%' - app.kevacoin.address: '%env(APP_KEVACOIN_ADDRESS)%' + app.kevacoin.room.namespaces: '%env(APP_KEVACOIN_ROOM_NAMESPACES)%' + 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)%' diff --git a/src/Controller/ModuleController.php b/src/Controller/ModuleController.php index ee51f07..7ed2222 100644 --- a/src/Controller/ModuleController.php +++ b/src/Controller/ModuleController.php @@ -26,11 +26,11 @@ class ModuleController extends AbstractController 'wallet' => [ 'balance' => (float) $client->getBalance(), - 'block' => (int) $client->getBlockCount(), - 'address' => $this->getParameter('app.kevacoin.address') + 'block' => (int) $client->getBlockCount() ], 'mine' => [ + 'address' => $this->getParameter('app.kevacoin.mine.address'), 'pool' => [ 'url' => $this->getParameter('app.kevacoin.mine.pool.url') diff --git a/src/Controller/RoomController.php b/src/Controller/RoomController.php index 90eaa63..1a53855 100644 --- a/src/Controller/RoomController.php +++ b/src/Controller/RoomController.php @@ -23,7 +23,7 @@ class RoomController extends AbstractController return $this->redirectToRoute( 'room_namespace', [ - 'namespace' => $this->getParameter('app.kevacoin.namespace') + 'namespace' => explode('|', $this->getParameter('app.kevacoin.room.namespaces'))[0] ] ); } @@ -149,7 +149,7 @@ class RoomController extends AbstractController return $this->redirectToRoute( 'room_namespace', [ - 'namespace' => $this->getParameter('app.kevacoin.namespace') + 'namespace' => explode('|', $this->getParameter('app.kevacoin.room.namespaces'))[0] ] ); } diff --git a/templates/default/module/info.html.twig b/templates/default/module/info.html.twig index 8ca818f..58d6eee 100644 --- a/templates/default/module/info.html.twig +++ b/templates/default/module/info.html.twig @@ -2,10 +2,10 @@ {{ 'block:' | trans }} {{ wallet.block }} / {{ 'balance:' | trans }} {{ wallet.balance }} - {% if wallet.address %} + {% if mine.address %} / {{ 'charge:' | trans }} -
{{ wallet.address }}
+
{{ mine.address }}
{% endif %} {% if mine.pool %} /