Adds config.js capability
parent
1780233778
commit
cf7d417193
|
@ -0,0 +1,80 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Config {
|
||||||
|
|
||||||
|
public function getPlatformDetails($config, $platform_id) {
|
||||||
|
$platformDetails = $config['platforms'][$platform_id];
|
||||||
|
return $platformDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
// loading the config.js
|
||||||
|
public function getPlatformConfigjs($platformDetails) {
|
||||||
|
// constructing the URL
|
||||||
|
$configjsFile = $platformDetails['jitsi_url'] . '/config.js';
|
||||||
|
|
||||||
|
// default content, if we can't get the file contents
|
||||||
|
$platformConfigjs = "The file $configjsFile can't be loaded.";
|
||||||
|
|
||||||
|
// ssl options
|
||||||
|
$contextOptions = [
|
||||||
|
'ssl' => [
|
||||||
|
'verify_peer' => true,
|
||||||
|
'verify_peer_name' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$context = stream_context_create($contextOptions);
|
||||||
|
|
||||||
|
// get the file
|
||||||
|
$fileContent = @file_get_contents($configjsFile, false, $context);
|
||||||
|
|
||||||
|
if ($fileContent !== false) {
|
||||||
|
// remove block comments
|
||||||
|
$platformConfigjs = preg_replace('!/\*.*?\*/!s', '', $fileContent);
|
||||||
|
// remove single-line comments
|
||||||
|
$platformConfigjs = preg_replace('/\/\/[^\n]*/', '', $platformConfigjs);
|
||||||
|
// remove empty lines
|
||||||
|
$platformConfigjs = preg_replace('/^\s*[\r\n]/m', '', $platformConfigjs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $platformConfigjs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// loading the interface_config.js
|
||||||
|
public function getPlatformInterfaceConfigjs($platformDetails) {
|
||||||
|
// constructing the URL
|
||||||
|
$interfaceConfigjsFile = $platformDetails['jitsi_url'] . '/interface_config.js';
|
||||||
|
|
||||||
|
// default content, if we can't get the file contents
|
||||||
|
$platformInterfaceConfigjs = "The file $interfaceConfigjsFile can't be loaded.";
|
||||||
|
|
||||||
|
// ssl options
|
||||||
|
$contextOptions = [
|
||||||
|
'ssl' => [
|
||||||
|
'verify_peer' => true,
|
||||||
|
'verify_peer_name' => true,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
$context = stream_context_create($contextOptions);
|
||||||
|
|
||||||
|
// get the file
|
||||||
|
$fileContent = @file_get_contents($interfaceConfigjsFile, false, $context);
|
||||||
|
|
||||||
|
if ($fileContent !== false) {
|
||||||
|
// remove block comments
|
||||||
|
$platformInterfaceConfigjs = preg_replace('!/\*.*?\*/!s', '', $fileContent);
|
||||||
|
// remove single-line comments
|
||||||
|
$platformInterfaceConfigjs = preg_replace('/\/\/[^\n]*/', '', $platformInterfaceConfigjs);
|
||||||
|
// remove empty lines
|
||||||
|
$platformInterfaceConfigjs = preg_replace('/^\s*[\r\n]/m', '', $platformInterfaceConfigjs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $platformInterfaceConfigjs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -38,7 +38,7 @@ return [
|
||||||
'platforms' => [
|
'platforms' => [
|
||||||
'0' => [
|
'0' => [
|
||||||
'name' => 'meet1',
|
'name' => 'meet1',
|
||||||
'jitsi_url' => 'https://meet.example.com',
|
'jitsi_url' => 'https://meet.lindeas.com',
|
||||||
'jilo_database' => '../../jilo/jilo.db',
|
'jilo_database' => '../../jilo/jilo.db',
|
||||||
],
|
],
|
||||||
'1' => [
|
'1' => [
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$action = $_REQUEST['action'] ?? '';
|
$action = $_REQUEST['action'] ?? '';
|
||||||
|
require_once '../app/classes/config.php';
|
||||||
require '../app/helpers/errors.php';
|
require '../app/helpers/errors.php';
|
||||||
require '../app/helpers/config.php';
|
require '../app/helpers/config.php';
|
||||||
|
|
||||||
|
$configure = new Config();
|
||||||
|
|
||||||
// if a form is submitted, it's from the edit page
|
// if a form is submitted, it's from the edit page
|
||||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
|
||||||
|
@ -98,6 +101,19 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
|
||||||
// no form submitted, show the templates
|
// no form submitted, show the templates
|
||||||
} else {
|
} else {
|
||||||
|
switch ($item) {
|
||||||
|
case 'configjs':
|
||||||
|
$platformDetails = $configure->getPlatformDetails($config, $platform_id);
|
||||||
|
$platformConfigjs = $configure->getPlatformConfigjs($platformDetails);
|
||||||
|
include('../app/templates/config-list-configjs.php');
|
||||||
|
break;
|
||||||
|
case 'interfaceconfigjs':
|
||||||
|
$platformDetails = $configure->getPlatformDetails($config, $platform_id);
|
||||||
|
$platformInterfaceConfigjs = $configure->getPlatformInterfaceConfigjs($platformDetails);
|
||||||
|
include('../app/templates/config-list-interfaceconfigjs.php');
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'add':
|
case 'add':
|
||||||
include('../app/templates/config-add-platform.php');
|
include('../app/templates/config-add-platform.php');
|
||||||
|
@ -111,6 +127,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
default:
|
default:
|
||||||
include('../app/templates/config-list.php');
|
include('../app/templates/config-list.php');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
<!-- widget "config" -->
|
||||||
|
<div class="card text-center w-75 mx-lef">
|
||||||
|
<p class="h4 card-header">Configuration of the Jitsi platform <strong><?= htmlspecialchars($platformDetails['name']) ?></strong></p>
|
||||||
|
<div class="card-body">
|
||||||
|
<p class="card-text">URL: <?= htmlspecialchars($platformDetails['jitsi_url']) ?></p>
|
||||||
|
<p class="card-text">config.js</p>
|
||||||
|
<pre style="text-align: left;">
|
||||||
|
<?php
|
||||||
|
echo htmlspecialchars($platformConfigjs);
|
||||||
|
?>
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /widget "config" -->
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
<!-- widget "config" -->
|
||||||
|
<div class="card text-center w-75 mx-lef">
|
||||||
|
<p class="h4 card-header">Jilo web configuration</p>
|
||||||
|
<div class="card-body">
|
||||||
|
<p class="card-text">platform variables</p>
|
||||||
|
<?php
|
||||||
|
include '../app/helpers/render.php';
|
||||||
|
renderConfig($config, '0');
|
||||||
|
echo "\n";
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /widget "config" -->
|
|
@ -5,29 +5,34 @@
|
||||||
<div class="col-4"><button class="btn btn-sm btn-info toggle-sidebar-button" type="button" id="toggleSidebarButton" value=">>"></button></div>
|
<div class="col-4"><button class="btn btn-sm btn-info toggle-sidebar-button" type="button" id="toggleSidebarButton" value=">>"></button></div>
|
||||||
<div class="sidebar-content card ml-3 mt-3">
|
<div class="sidebar-content card ml-3 mt-3">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=front">
|
|
||||||
|
<li class="list-group-item bg-light" style="border: none;"><p class="text-end mb-0"><small>statistics</small></p></li>
|
||||||
|
|
||||||
|
<a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=front">
|
||||||
<li class="list-group-item<?php if ($page === 'front') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
<li class="list-group-item<?php if ($page === 'front') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
||||||
<i class="fas fa-chart-line" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="general jitsi stats"></i>general stats
|
<i class="fas fa-chart-line" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="general jitsi stats"></i>general stats
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
<a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=conferences">
|
<a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=conferences">
|
||||||
<li class="list-group-item<?php if ($page === 'conferences') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
<li class="list-group-item<?php if ($page === 'conferences') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
||||||
<i class="fas fa-video" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="conferences"></i>conferences
|
<i class="fas fa-video" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="conferences"></i>conferences
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
<a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=participants">
|
<a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=participants">
|
||||||
<li class="list-group-item<?php if ($page === 'participants') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
<li class="list-group-item<?php if ($page === 'participants') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
||||||
<i class="fas fa-users" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="participants"></i>participants
|
<i class="fas fa-users" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="participants"></i>participants
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
<a href="<?= $app_root ?>?platform=<?= $platform_id?>&page=components">
|
<a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=components">
|
||||||
<li class="list-group-item<?php if ($page === 'components') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
<li class="list-group-item<?php if ($page === 'components') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
||||||
<i class="fas fa-puzzle-piece" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="components"></i>components
|
<i class="fas fa-puzzle-piece" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="components"></i>components
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
<li class="list-group-item bg-light" style="border-left: none; border-right: none;"></li>
|
|
||||||
|
<li class="list-group-item bg-light" style="border: none;"><p class="text-end mb-0"><small>jilo-web config</small></p></li>
|
||||||
|
|
||||||
<a href="<?= $app_root ?>?page=config">
|
<a href="<?= $app_root ?>?page=config">
|
||||||
<li class="list-group-item<?php if ($page === 'config') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
<li class="list-group-item<?php if ($page === 'config' && $item === '') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
||||||
<i class="fas fa-wrench" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>config
|
<i class="fas fa-wrench" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>config
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
|
@ -36,6 +41,19 @@
|
||||||
<i class="fas fa-list" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="logs"></i>logs
|
<i class="fas fa-list" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="logs"></i>logs
|
||||||
</li>
|
</li>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<li class="list-group-item bg-light" style="border: none;"><p class="text-end mb-0"><small>current Jitsi platform</small></p></li>
|
||||||
|
|
||||||
|
<a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=config&item=configjs">
|
||||||
|
<li class="list-group-item<?php if ($page === 'config' && $item === 'configjs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
||||||
|
<i class="fas fa-tv" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>config.js
|
||||||
|
</li>
|
||||||
|
</a>
|
||||||
|
<a href="<?= $app_root ?>?platform=<?= $platform_id ?>&page=config&item=interfaceconfigjs">
|
||||||
|
<li class="list-group-item<?php if ($page === 'config' && $item === 'interfaceconfigjs') echo ' list-group-item-secondary'; else echo ' list-group-item-action'; ?>">
|
||||||
|
<i class="fas fa-th" data-toggle="tooltip" data-placement="right" data-offset="30.0" title="configuration"></i>interface_config.js
|
||||||
|
</li>
|
||||||
|
</a>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -67,6 +67,12 @@ if (isset($_REQUEST['page'])) {
|
||||||
} else {
|
} else {
|
||||||
$page = 'front';
|
$page = 'front';
|
||||||
}
|
}
|
||||||
|
if (isset($_REQUEST['item'])) {
|
||||||
|
$item = $_REQUEST['item'];
|
||||||
|
} else {
|
||||||
|
$item = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// check if logged in
|
// check if logged in
|
||||||
unset($user);
|
unset($user);
|
||||||
|
|
Loading…
Reference in New Issue