Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
geraked committed Apr 22, 2021
0 parents commit 3ee6cae
Show file tree
Hide file tree
Showing 65 changed files with 12,212 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Geraked

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
107 changes: 107 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
![catalog](docs/catalog.jpg)

# BAMS

![GitHub release (latest by date)](https://img.shields.io/github/v/release/geraked/bams)

BigBlueButton & AdobeConnect Monitoring Software

It shows in progress meetings of both BigBlueButton and AdobeConnect with current usage of server resources in an integrated view.

## Installation

It can be installed on web hosting control panels or servers that support PHP v7.0 or above.

Upload the contents of `src` folder to your host and open `config.php` file with a text editor.

Set the correct `URL` of the program started with `http(s)://` and followed by a trailing slash.
For example:
```php
define('URL', 'http://localhost/bams/');
```

Determine the `SERVERS` parameter. Suppose we have one BigBlueButton server and one AdobeConnect server, the parameter would look like this:
```php
const SERVERS = [
[
'id' => '1',
'type' => BIGBLUEBUTTON,
'domain' => 'vc1.example.com',
'secret' => 'xxxxxxxxxx',
'title' => 'Server 1',
],
[
'id' => '2',
'type' => ADOBE_CONNECT,
'domain' => 'vc2.example.com',
'login' => 'xxxxxxxxxx',
'password' => 'xxxxxxxxxx',
'title' => 'Server 2',
],
];
```

Determine the `USERS` parameter. In the following example, we have `usr1` which can access all of the servers and `usr2` that can only access the server with the id `2`. (If the `acl` property would be empty or not set, the user can access all the servers.)
```php
const USERS = [
[
'username' => 'usr1',
'password' => 'usr1',
'name' => 'User 1',
],
[
'username' => 'usr2',
'password' => 'usr2',
'name' => 'User 2',
'acl' => ['2',],
],
];
```

### Servers Configuration

These steps are optional. If you'd like to see the usage of server resources in the Dashboard, follow them.

#### BigBlueButton Server

Upload `bams.php` file located in `tools` folder to the server, in the following directory:
```
/var/www/bigbluebutton-default/
```

Run this command to open the editor:
```
sudo nano /etc/nginx/sites-available/bigbluebutton
```

Copy the following code after `location` block, then save and exit the editor.
```nginx
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/bigbluebutton-default/$fastcgi_script_name;
}
```

Make sure PHP package is installed on the server.

Finally execute this command:
```
sudo apt install sysstat
```

#### AdobeConnect Server

Upload `bams.war` file located in `tools` folder to the server, in the following directory:
```
C:\Connect\10.8.0\appserv\webapps\
```
According to the installed version of AdobeConnect and the path, it may be a little different.

## Author

**Rabist** - view on [LinkedIn](https://www.linkedin.com/in/rabist)

## License

Licensed under [MIT](LICENSE).
Binary file added docs/catalog.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Options -Indexes
IndexIgnore *
5 changes: 5 additions & 0 deletions src/api/initial.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php
session_start();
require_once('../config.php');
require_once('../lib/util.php');
login_require();
39 changes: 39 additions & 0 deletions src/api/join.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
include 'initial.php';

$dom = new DOMDocument('1.0', 'utf-8');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;

$response = $dom->createElement('response');
$returncode = $dom->createElement('returncode');
$response->appendChild($returncode);

try {
$serverId = test_input($_GET['serverId'] ?? null);
$meetingId = test_input($_GET['meetingId'] ?? null);
$password = test_input($_GET['password'] ?? null);
$name = urlencode(test_input($_GET['name'] ?? null));
$server = null;

foreach (SERVERS as $s) {
if ($s['id'] == $serverId) {
$server = $s;
break;
}
}

if (!$serverId || !$meetingId || !$password || !$name || !$server)
throw new Exception("Error Processing Request", 1);

$qs = 'fullName=' . $name . '&meetingID=' . $meetingId . '&password=' . $password;
$url = completeUrl($server, 'join', $qs);
$join = $dom->createElement('join', $url);
$response->appendChild($join);
$returncode->nodeValue = 'SUCCESS';
} catch (Exception $e) {
$returncode->nodeValue = 'FAILED';
}

$dom->appendChild($response);
echo $dom->saveXML();
41 changes: 41 additions & 0 deletions src/api/login.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
session_start();
require_once('../config.php');
require_once('../lib/util.php');

$dom = new DOMDocument('1.0', 'utf-8');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;

$response = $dom->createElement('response');
$returncode = $dom->createElement('returncode');
$response->appendChild($returncode);

try {
$username = test_input($_POST['username'] ?? null);
$password = test_input($_POST['password'] ?? null);

if (!$username || !$password)
throw new Exception("Error Processing Request", 1);

$match = false;
foreach (USERS as $u) {
if ($u['username'] == $username) {
if ($u['password'] == $password) {
$_SESSION['user'] = $u['username'];
$match = true;
}
break;
}
}

if (!$match)
throw new Exception("Wrong username or password", 2);

$returncode->nodeValue = 'SUCCESS';
} catch (Exception $e) {
$returncode->nodeValue = 'FAILED';
}

$dom->appendChild($response);
echo $dom->saveXML();
34 changes: 34 additions & 0 deletions src/api/resource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
require_once('initial.php');

$dom = new DOMDocument('1.0', 'utf-8');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;

$response = $dom->createElement('response');
$returncode = $dom->createElement('returncode');
$response->appendChild($returncode);

try {
$serverId = test_input($_GET['id'] ?? null);

foreach (SERVERS as $s) {
if ($s['id'] == $serverId) {
$server = $s;
break;
}
}

if (!$serverId)
throw new Exception("Error Processing Request", 1);

$ext = ($s['type'] == BIGBLUEBUTTON) ? '.php' : '';
$data = $dom->createElement('data', file_get_contents('http://' . $s['domain'] . '/bams' . $ext));
$response->appendChild($data);
$returncode->nodeValue = 'SUCCESS';
} catch (Exception $e) {
$returncode->nodeValue = 'FAILED';
}

$dom->appendChild($response);
echo $dom->saveXML();
82 changes: 82 additions & 0 deletions src/api/server-item.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php
require_once('initial.php');
require_once('../lib/adobeconnect.php');

$user = getUser($_SESSION['user']);
$acl = $user['acl'] ?? null;

try {
$id = test_input($_GET['id'] ?? null);
$server = null;

if (!$acl || in_array($id, $acl)) {
foreach (SERVERS as $s) {
if ($s['id'] == $id) {
$server = $s;
break;
}
}
}

if (!$id || !$server)
throw new Exception("Error Processing Request", 1);

$dom = new DOMDocument('1.0', 'utf-8');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;

if ($server['type'] == BIGBLUEBUTTON) {
$url = completeUrl($server, 'getMeetings');
$dom->load($url);
$meetings = $dom->getElementsByTagName('meeting');
foreach ($meetings as $m) {
$childs = $m->childNodes;
$id = getChildNodeValue($childs, 'meetingid');
$pass = getChildNodeValue($childs, 'moderatorpw');
$qs = 'fullName=' . urlencode($user['name']) . '&meetingID=' . $id . '&password=' . $pass;
$joinLink = $dom->createElement('join', completeUrl($server, 'join', $qs));
$m->appendChild($joinLink);
}
} else if ($server['type'] == ADOBE_CONNECT) {
$ac = new AdobeConnectClient($server['domain'], $server['login'], $server['password']);
$ac = $ac->makeAuth();

$response = $dom->createElement('response');
$returncode = $dom->createElement('returncode', 'SUCCESS');
$response->appendChild($returncode);

foreach ($ac->getActiveMeetings()['report-active-meetings'] as $am) {
$meeting = [
'sco-id' => $am['@attributes']['sco-id'],
'active-participants' => $am['@attributes']['active-participants'],
'length-minutes' => $am['@attributes']['length-minutes'],
'name' => $am['name'],
'url-path' => 'http://' . $server['domain'] . $am['url-path'],
'date-begin' => substr($am['date-begin'], 0, 19),
];

$row = $dom->createElement('meeting');
foreach ($meeting as $key => $value) {
$prop = $dom->createElement($key, $value);
$row->appendChild($prop);
}
$response->appendChild($row);
}

$dom->appendChild($response);
} else {
throw new Exception("Undefined server type", 2);
}

echo $dom->saveXML();
} catch (Exception $e) {
$dom = new DOMDocument('1.0', 'utf-8');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;

$response = $dom->createElement('response');
$returncode = $dom->createElement('returncode', 'FAILED');
$response->appendChild($returncode);
$dom->appendChild($response);
echo $dom->saveXML();
}
33 changes: 33 additions & 0 deletions src/api/server-list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
require_once('initial.php');

$user = getUser($_SESSION['user']);
$acl = $user['acl'] ?? null;

$dom = new DOMDocument('1.0', 'utf-8');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;

$response = $dom->createElement('response');
$returncode = $dom->createElement('returncode', 'SUCCESS');
$response->appendChild($returncode);

foreach (SERVERS as $s) {
if ($acl && !in_array($s['id'], $acl))
continue;

$server = $dom->createElement('server');
$id = $dom->createElement('id', $s['id']);
$type = $dom->createElement('type', $s['type']);
$domain = $dom->createElement('domain', $s['domain']);
$title = $dom->createElement('serverTitle', $s['title'] ?? '');

$server->appendChild($id);
$server->appendChild($type);
$server->appendChild($domain);
$server->appendChild($title);
$response->appendChild($server);
}

$dom->appendChild($response);
echo $dom->saveXML();
Loading

0 comments on commit 3ee6cae

Please sign in to comment.