mirror of
https://github.com/kevachat/webapp.git
synced 2025-01-22 12:34:25 +00:00
add maintenance settings
This commit is contained in:
parent
24cd83d182
commit
1ea73b4b03
7
.env
7
.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=/.*/
|
||||
|
@ -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)%'
|
||||
|
@ -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;
|
||||
|
@ -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')
|
||||
)
|
||||
]
|
||||
);
|
||||
|
@ -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(
|
||||
|
@ -22,4 +22,16 @@
|
||||
<a href="{{ mine.solo.url }}" target="_blank">{{ 'solo' | trans }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if maintenance %}
|
||||
<div>
|
||||
<sub>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 16 16">
|
||||
<path d="m9.97 4.88.953 3.811C10.159 8.878 9.14 9 8 9c-1.14 0-2.158-.122-2.923-.309L6.03 4.88C6.635 4.957 7.3 5 8 5s1.365-.043 1.97-.12m-.245-.978L8.97.88C8.718-.13 7.282-.13 7.03.88L6.275 3.9C6.8 3.965 7.382 4 8 4c.618 0 1.2-.036 1.725-.098zm4.396 8.613a.5.5 0 0 1 .037.96l-6 2a.5.5 0 0 1-.316 0l-6-2a.5.5 0 0 1 .037-.96l2.391-.598.565-2.257c.862.212 1.964.339 3.165.339s2.303-.127 3.165-.339l.565 2.257 2.391.598"/>
|
||||
</svg>
|
||||
</sub>
|
||||
<code>
|
||||
{{ maintenance }}
|
||||
</code>
|
||||
</div>
|
||||
{% endif %}
|
Loading…
x
Reference in New Issue
Block a user