diff --git a/.env b/.env index 38af90b..d03d30a 100644 --- a/.env +++ b/.env @@ -23,6 +23,9 @@ APP_VERSION=1.0.0 APP_NAME=KevaChat +# Disable any activity and print the message +APP_MAINTENANCE= + # Connect memcached APP_MEMCACHED_HOST=127.0.0.1 APP_MEMCACHED_PORT=11211 @@ -55,8 +58,8 @@ 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 users to read external node rooms +APP_KEVACOIN_ROOM_NAMESPACE_EXTERNAL= # Allow remotes to create new rooms (namespaces) APP_ADD_ROOM_REMOTE_IP_REGEX=/.*/ diff --git a/config/services.yaml b/config/services.yaml index 650f477..bc2d523 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -6,6 +6,7 @@ parameters: app.version: '%env(APP_VERSION)%' app.name: '%env(APP_NAME)%' + app.maintenance: '%env(APP_MAINTENANCE)%' app.memcached.host: '%env(APP_MEMCACHED_HOST)%' app.memcached.port: '%env(APP_MEMCACHED_PORT)%' app.memcached.timeout: '%env(APP_MEMCACHED_TIMEOUT)%' @@ -16,8 +17,8 @@ parameters: app.kevacoin.password: '%env(APP_KEVACOIN_PASSWORD)%' app.kevacoin.room.namespaces: '%env(APP_KEVACOIN_ROOM_NAMESPACES)%' app.kevacoin.room.namespaces.readonly: '%env(APP_KEVACOIN_ROOM_NAMESPACES_READONLY)%' + app.kevacoin.room.namespaces.external: '%env(APP_KEVACOIN_ROOM_NAMESPACES_EXTERNAL)%' app.kevacoin.room.namespace.default: '%env(APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT)%' - app.kevacoin.room.namespace.external: '%env(APP_KEVACOIN_ROOM_NAMESPACE_EXTERNAL)%' app.kevacoin.boost.address: '%env(APP_KEVACOIN_BOOST_ADDRESS)%' app.kevacoin.explorer.url: '%env(APP_KEVACOIN_EXPLORER_URL)%' app.kevacoin.mine.pool.url: '%env(APP_KEVACOIN_MINE_POOL_URL)%' diff --git a/public/css/default.css b/public/css/default.css index 884ae8c..b69597b 100644 --- a/public/css/default.css +++ b/public/css/default.css @@ -12,6 +12,9 @@ /* vars */ --container-max-width: 768px; + --color-warning: #ee784e; + --color-error: #ff6363; + --color-default: #999; } *::placeholder @@ -52,6 +55,17 @@ header > div margin: 8px 0; } +header > div > code +{ + color: var(--color-error); + font-weight: bold; +} + +header > div > sub > svg +{ + fill: var(--color-error); +} + main { display: block; @@ -91,7 +105,7 @@ main ul > li margin: 8px 0; padding: 8px 0; word-wrap: break-word; - border-bottom: 1px #999 solid; + border-bottom: 1px var(--color-default) solid; } main ul > li:last-child @@ -107,13 +121,13 @@ main ul > li p main ul li > span > svg { cursor: default; - fill: #999; + fill: var(--color-default); float: right; } main > sup > a > svg { - fill: #ee784e; + fill: var(--color-warning); } footer @@ -157,7 +171,7 @@ footer > form > button footer > form > output { - color: #ff6363; + color: var(--color-error); display: block; font-weight: bolder; margin-bottom: 16px; diff --git a/src/Controller/ModuleController.php b/src/Controller/ModuleController.php index 5cb6fc2..9fc5b05 100644 --- a/src/Controller/ModuleController.php +++ b/src/Controller/ModuleController.php @@ -46,7 +46,8 @@ class ModuleController extends AbstractController 'explorer' => [ 'url' => $this->getParameter('app.kevacoin.explorer.url') - ] + ], + 'maintenance' => $this->getParameter('app.maintenance') ] ); } @@ -133,6 +134,8 @@ class ModuleController extends AbstractController $request->get('namespace'), explode('|', $this->getParameter('app.kevacoin.room.namespaces.readonly')) ) + && + !$this->getParameter('app.maintenance') ) ] ); diff --git a/src/Controller/RoomController.php b/src/Controller/RoomController.php index 0fa0241..41b5710 100644 --- a/src/Controller/RoomController.php +++ b/src/Controller/RoomController.php @@ -68,7 +68,7 @@ class RoomController extends AbstractController (array) explode('|', $this->getParameter('app.kevacoin.room.namespaces')) ) && - $this->getParameter('app.kevacoin.room.namespace.external') === 'false' + $this->getParameter('app.kevacoin.room.namespaces.external') ) { // @TODO process to error page instead of redirect to default room return $this->redirectToRoute( @@ -198,6 +198,19 @@ class RoomController extends AbstractController TranslatorInterface $translator ): Response { + // Check maintenance mode disabled + if ($this->getParameter('app.maintenance')) + { + return $this->redirectToRoute( + 'room_namespace', + [ + 'namespace' => $request->get('namespace'), + 'message' => $request->get('message'), + 'error' => $this->getParameter('app.maintenance') + ] + ); + } + // Connect memcached $memcached = new \Memcached(); $memcached->addServer( diff --git a/templates/default/module/info.html.twig b/templates/default/module/info.html.twig index 0d8406a..142e7e4 100644 --- a/templates/default/module/info.html.twig +++ b/templates/default/module/info.html.twig @@ -22,4 +22,16 @@ {{ 'solo' | trans }} {% endif %} {% endif %} - \ No newline at end of file + +{% if maintenance %} +
+ + + + + + + {{ maintenance }} + +
+{% endif %} \ No newline at end of file