HTML fixes

main
Yasen Pramatarov 2025-01-17 16:08:37 +02:00
parent 55ab59372e
commit b2fcaf6793
5 changed files with 95 additions and 74 deletions

View File

@ -23,9 +23,9 @@ foreach ($platformsAll as $platform) {
// check if we can connect to the jilo database // check if we can connect to the jilo database
$response = connectDB($config, 'jilo', $platform['jilo_database'], $platform['id']); $response = connectDB($config, 'jilo', $platform['jilo_database'], $platform['id']);
if ($response['error'] !== null) { if ($response['error'] !== null) {
$jilo_database_status = '<span class="text-danger">' . htmlspecialchars($response['error']) . '</span>'; $jilo_database_status = $response['error'];
} else { } else {
$jilo_database_status = '<span class="text-success">OK</span>'; $jilo_database_status = 'OK';
} }
include '../app/templates/status-platform.php'; include '../app/templates/status-platform.php';
@ -44,19 +44,19 @@ foreach ($platformsAll as $platform) {
// determine agent availability based on response data // determine agent availability based on response data
if (json_last_error() === JSON_ERROR_NONE) { if (json_last_error() === JSON_ERROR_NONE) {
$agent_availability = '<span class="text-warning">unknown</span>'; $agent_availability = 'unknown';
foreach ($agent_data as $key => $value) { foreach ($agent_data as $key => $value) {
if ($key === 'error') { if ($key === 'error') {
$agent_availability = '<span class="text-danger">' . htmlspecialchars($value) . '</span>'; $agent_availability = $value;
break; break;
} }
if (preg_match('/_state$/', $key)) { if (preg_match('/_state$/', $key)) {
if ($value === 'error') { if ($value === 'error') {
$agent_availability = '<span class="text-danger">not running</span>'; $agent_availability = 'not running';
break; break;
} }
if ($value === 'running') { if ($value === 'running') {
$agent_availability = '<span class="text-success">running</span>'; $agent_availability = 'running';
break; break;
} }
} }
@ -66,6 +66,7 @@ foreach ($platformsAll as $platform) {
} }
include '../app/templates/status-agent.php'; include '../app/templates/status-agent.php';
echo '</div>';
} }
} }

View File

@ -1,22 +1,22 @@
<!-- Security Settings --> <!-- security settings -->
<div class="container"> <div class="container-fluid mt-2">
<div class="row mb-4"> <div class="row mb-4">
<div class="col"> <div class="col">
<h2>Security Settings</h2> <h2>Security settings</h2>
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<?php if ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit whitelist')) { ?> <?php if ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit whitelist')) { ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= $section === 'whitelist' ? 'active' : '' ?>" href="?page=security&section=whitelist">IP Whitelist</a> <a class="nav-link <?= $section === 'whitelist' ? 'active' : '' ?>" href="?page=security&section=whitelist">IP whitelist</a>
</li> </li>
<?php } ?> <?php } ?>
<?php if ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit blacklist')) { ?> <?php if ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit blacklist')) { ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= $section === 'blacklist' ? 'active' : '' ?>" href="?page=security&section=blacklist">IP Blacklist</a> <a class="nav-link <?= $section === 'blacklist' ? 'active' : '' ?>" href="?page=security&section=blacklist">IP blacklist</a>
</li> </li>
<?php } ?> <?php } ?>
<?php if ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit ratelimiting')) { ?> <?php if ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit ratelimiting')) { ?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= $section === 'ratelimit' ? 'active' : '' ?>" href="?page=security&section=ratelimit">Rate Limiting</a> <a class="nav-link <?= $section === 'ratelimit' ? 'active' : '' ?>" href="?page=security&section=ratelimit">Rate limiting</a>
</li> </li>
<?php } ?> <?php } ?>
</ul> </ul>
@ -24,12 +24,12 @@
</div> </div>
<?php if ($section === 'whitelist' && ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit whitelist'))) { ?> <?php if ($section === 'whitelist' && ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit whitelist'))) { ?>
<!-- Whitelist Section --> <!-- whitelist section -->
<div class="row mb-4"> <div class="row mb-4">
<div class="col"> <div class="col">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3>IP Whitelist</h3> <h3>IP whitelist</h3>
IP addresses and networks that will always bypass the ratelimiting login checks. IP addresses and networks that will always bypass the ratelimiting login checks.
</div> </div>
<div class="card-body"> <div class="card-body">
@ -37,7 +37,7 @@
<input type="hidden" name="action" value="add_whitelist"> <input type="hidden" name="action" value="add_whitelist">
<div class="row g-3"> <div class="row g-3">
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="form-control" name="ip_address" placeholder="IP Address or CIDR" required> <input type="text" class="form-control" name="ip_address" placeholder="IP address or CIDR" required>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
<input type="text" class="form-control" name="description" placeholder="Description"> <input type="text" class="form-control" name="description" placeholder="Description">
@ -45,11 +45,11 @@
<div class="col-md-2"> <div class="col-md-2">
<div class="form-check"> <div class="form-check">
<input type="checkbox" class="form-check-input" name="is_network" id="is_network_white"> <input type="checkbox" class="form-check-input" name="is_network" id="is_network_white">
<label class="form-check-label" for="is_network_white">Is Network</label> <label class="form-check-label" for="is_network_white">is network</label>
</div> </div>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<button type="submit" class="btn btn-primary">Add to Whitelist</button> <button type="submit" class="btn btn-primary">Add to whitelist</button>
</div> </div>
</div> </div>
</form> </form>
@ -57,11 +57,11 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>IP Address</th> <th>IP address</th>
<th>Network</th> <th>Network</th>
<th>Description</th> <th>Description</th>
<th>Added By</th> <th>Added by</th>
<th>Added On</th> <th>Added on</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
@ -91,12 +91,12 @@
<?php } ?> <?php } ?>
<?php if ($section === 'blacklist' && ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit blacklist'))) { ?> <?php if ($section === 'blacklist' && ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit blacklist'))) { ?>
<!-- Blacklist Section --> <!-- blacklist section -->
<div class="row mb-4"> <div class="row mb-4">
<div class="col"> <div class="col">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3>IP Blacklist</h3> <h3>IP blacklist</h3>
IP addresses and networks that will always get blocked at login. IP addresses and networks that will always get blocked at login.
</div> </div>
<div class="card-body"> <div class="card-body">
@ -104,7 +104,7 @@
<input type="hidden" name="action" value="add_blacklist"> <input type="hidden" name="action" value="add_blacklist">
<div class="row g-3"> <div class="row g-3">
<div class="col-md-3"> <div class="col-md-3">
<input type="text" class="form-control" name="ip_address" placeholder="IP Address or CIDR" required> <input type="text" class="form-control" name="ip_address" placeholder="IP address or CIDR" required>
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<input type="text" class="form-control" name="reason" placeholder="Reason"> <input type="text" class="form-control" name="reason" placeholder="Reason">
@ -115,11 +115,11 @@
<div class="col-md-2"> <div class="col-md-2">
<div class="form-check"> <div class="form-check">
<input type="checkbox" class="form-check-input" name="is_network" id="is_network_black"> <input type="checkbox" class="form-check-input" name="is_network" id="is_network_black">
<label class="form-check-label" for="is_network_black">Is Network</label> <label class="form-check-label" for="is_network_black">is network</label>
</div> </div>
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
<button type="submit" class="btn btn-primary">Add to Blacklist</button> <button type="submit" class="btn btn-primary">Add to blacklist</button>
</div> </div>
</div> </div>
</form> </form>
@ -127,11 +127,11 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>IP Address</th> <th>IP address</th>
<th>Network</th> <th>Network</th>
<th>Reason</th> <th>Reason</th>
<th>Added By</th> <th>Added by</th>
<th>Added On</th> <th>Added on</th>
<th>Expires</th> <th>Expires</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
@ -163,17 +163,17 @@
<?php } ?> <?php } ?>
<?php if ($section === 'ratelimit' && ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit ratelimiting'))) { ?> <?php if ($section === 'ratelimit' && ($userObject->hasRight($user_id, 'superuser') || $userObject->hasRight($user_id, 'edit ratelimiting'))) { ?>
<!-- Rate Limiting Section --> <!-- rate limiting section -->
<div class="row mb-4"> <div class="row mb-4">
<div class="col"> <div class="col">
<div class="card"> <div class="card">
<div class="card-header"> <div class="card-header">
<h3>Rate Limiting Settings</h3> <h3>Rate limiting settings</h3>
Rate limiting settings control how many failed login attempts are allowed before blocking an IP address. Rate limiting settings control how many failed login attempts are allowed before blocking an IP address.
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="alert alert-info"> <div class="alert alert-info">
<h4>Current Settings</h4> <h4>Current settings</h4>
<ul> <ul>
<li>Maximum login attempts: <?= $rateLimiter->maxAttempts ?></li> <li>Maximum login attempts: <?= $rateLimiter->maxAttempts ?></li>
<li>Time window: <?= $rateLimiter->decayMinutes ?> minutes</li> <li>Time window: <?= $rateLimiter->decayMinutes ?> minutes</li>
@ -185,13 +185,13 @@
</p> </p>
</div> </div>
<h4>Recent Failed Login Attempts</h4> <h4>Recent failed login attempts</h4>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>IP Address</th> <th>IP sddress</th>
<th>Username</th> <th>Username</th>
<th>Attempted At</th> <th>Attempted at</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -220,4 +220,4 @@
</div> </div>
<?php } ?> <?php } ?>
</div> </div>
<!-- /Security Settings --> <!-- /security settings -->

View File

@ -1,14 +1,19 @@
<!-- jilo agent status --> <!-- jilo agent status -->
<div class="card text-center w-75 mx-lef" style="padding-left: 80px;"> <div class="d-flex align-items-center flex-wrap border-top p-3">
<div class="card-body"> <div class="d-flex align-items-center me-4">
<p class="card-text text-left" style="text-align: left;"> <span class="me-2">Jilo agent
Jilo Agent <a href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform['id']) ?>agent<?= htmlspecialchars($agent['id']) ?>"><?= htmlspecialchars($agent['agent_description']) ?></a>: <a href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform['id']) ?>agent<?= htmlspecialchars($agent['id']) ?>" class="text-decoration-none">
<strong><?= $agent_availability ?></strong> <?= htmlspecialchars($agent['agent_description']) ?>
<br /> </a>:
host: <strong><?= htmlspecialchars($agent_host) ?></strong>, </span>
port: <strong><?= htmlspecialchars($agent_port) ?></strong>, <span class="badge <?= $agent_availability === 'running' ? 'bg-success' : 'bg-danger' ?>" title="<?= $agent_availability !== 'running' ? htmlspecialchars($agent_availability) : '' ?>" data-toggle="tooltip" data-placement="right" data-offset="30.0">
endpoint: <strong><?= htmlspecialchars($agent['agent_endpoint']) ?></strong> <?= $agent_availability === 'running' ? 'Running' : 'Error' ?>
</p> </span>
</div>
<div class="d-flex align-items-center me-4">
<span class="me-4">Host: <strong><?= htmlspecialchars($agent_host) ?></strong></span>
<span class="me-4">Port: <strong><?= htmlspecialchars($agent_port) ?></strong></span>
<span>Endpoint: <strong><?= htmlspecialchars($agent['agent_endpoint']) ?></strong></span>
</div> </div>
</div> </div>

View File

@ -1,13 +1,21 @@
<!-- jitsi platform status --> <!-- jitsi platform status -->
<br /> <div class="card mt-3 mb-3">
<div class="card text-center w-75 mx-lef" style="padding-left: 40px;"> <div class="card-header">
<h4>
<a href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform['id']) ?>" class="text-decoration-none">
Jitsi platform "<?= htmlspecialchars($platform['name']) ?>"
</a>
</h4>
<small class="text-muted">Remote Jitsi Meet installation with its database and agents here.</small>
</div>
<div class="card-body p-0">
<div class="card-body"> <div class="card-body">
<p class="card-text text-left" style="text-align: left;"> <div class="d-flex align-items-center flex-wrap">
Jitsi Meet platform: <a href="<?= htmlspecialchars($app_root) ?>?page=config#platform<?= htmlspecialchars($platform['id']) ?>"><?= htmlspecialchars($platform['name']) ?></a> <span class="me-4">Jilo database: <strong><?= htmlspecialchars($platform['jilo_database']) ?></strong></span>
<br /> <div class="d-flex align-items-center">
jilo database: <strong><?= htmlspecialchars($platform['jilo_database']) ?></strong>, <span class="me-2">Status:</span>
status: <strong><?= $jilo_database_status ?></strong> <span class="badge <?= $jilo_database_status === 'OK' ? 'bg-success' : 'bg-danger' ?>"><?= htmlspecialchars($jilo_database_status) ?></span>
</p> </div>
</div> </div>
</div> </div>

View File

@ -1,19 +1,26 @@
<!-- jilo status -->
<div class="container-fluid mt-2">
<div class="row mb-5">
<div class="col">
<h2>Jilo status</h2>
<!-- jilo status --> <!-- jilo status -->
<div class="card text-center w-75 mx-lef"> <div class="card mt-3">
<p class="h4 card-header">Jilo platform status</p> <div class="card-header">
<h4>Jilo server</h4>
<small class="text-muted">Responsible for periodic checks of remote agents and storing received data.</small>
</div>
<div class="card-body"> <div class="card-body">
<p class="card-text text-left" style="text-align: left;"> <div class="d-flex align-items-center flex-wrap">
Jilo Server: <div class="d-flex align-items-center me-4">
<?php if ($server_status) { ?> <span class="me-2">Jilo server:</span>
<strong><span class="text-success">running</span></strong> <span class="badge <?= $server_status ? 'bg-success' : 'bg-danger' ?>">
<?php } else { ?> <?= $server_status ? 'Running' : 'Not running' ?>
<strong><span class="text-danger">not running</span></strong> </span>
<?php } ?> </div>
<br /> <span class="me-4">Host: <strong><?= htmlspecialchars($server_host) ?></strong></span>
host: <strong><?= htmlspecialchars($server_host) ?></strong>, <span class="me-4">Port: <strong><?= htmlspecialchars($server_port) ?></strong></span>
port: <strong><?= htmlspecialchars($server_port) ?></strong>, <span>Endpoint: <strong><?= htmlspecialchars($server_endpoint) ?></strong></span>
endpoint: <strong><?= htmlspecialchars($server_endpoint) ?></strong> </div>
</p>
</div> </div>
</div> </div>