Skip to content

Commit

Permalink
- bumped version to 2.0.30
Browse files Browse the repository at this point in the history
- updated PHP API client class 1.1.99
- added support for the new `get_system_log()` method provided by the latest PHP API client class
  • Loading branch information
malle-pietje committed Oct 23, 2024
1 parent 2aa4eac commit 1d07848
Show file tree
Hide file tree
Showing 8 changed files with 181 additions and 62 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ There, you will also find examples and detailed instructions on how to use it.
Please keep the following in mind when using the UniFi API browser:

- The tool does not support all available data collections and API endpoints. See the list below for those currently supported.
- Currently, versions 5.X.X, 6.X.X, 7.X.X, and 8.X.X of the UniFi Controller software are supported (version **8.4.60** has been confirmed to work)
- Currently, versions 5.X.X, 6.X.X, 7.X.X, and 8.X.X of the UniFi Controller software are supported (version **8.5.60** has been confirmed to work)
- The Network Application on UniFi OS-based controllers is also supported, same versions as above
- When accessing UniFi OS-based controllers through this tool, please read the remarks regarding UniFi OS support
- Please read the Security Notice before installing this tool.
Expand Down Expand Up @@ -99,6 +99,7 @@ The UniFi API browser tool offers the following features:
- list alarms
- count alarms
- list IDS/IPS events
- list system log entries

Please note that the bundled API client supports many more API endpoints, not all make sense to add to the API browser though.

Expand Down
23 changes: 16 additions & 7 deletions ajax/fetch_collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
require_once '../common.php';
require_once '../collections.php';

use Kint\Renderer\TextRenderer;
use Kint\Renderer\RichRenderer;
use UniFi_API\Client as ApiClient;

/**
Expand Down Expand Up @@ -163,6 +165,13 @@
*/
$results['count'] = count($data_array);

/**
* For results returned from API v2, we need to check for the 'data' property and count that.
*/
if(property_exists($data_array, 'data')) {
$results['count'] = count($data_array->data);
}

if ($debug) {
error_log('DEBUG: ' . $results['count'] . ' objects collected');
}
Expand All @@ -173,18 +182,18 @@
*
* @note using Rich render mode
*/
Kint::$display_called_from = false;
Kint\Renderer\RichRenderer::$folder = false;
$results['data'] = @d($data_array);
Kint::$display_called_from = false;
RichRenderer::$folder = false;
$results['data'] = @d($data_array);
} else {
if ($output_method === 'kint_plain') {
/**
* @note using Plain render mode
*/
Kint::$display_called_from = false;
Kint\Renderer\RichRenderer::$folder = false;
Kint\Renderer\TextRenderer::$decorations = false;
$results['data'] = @s($data_array);
Kint::$display_called_from = false;
RichRenderer::$folder = false;
TextRenderer::$decorations = false;
$results['data'] = @s($data_array);
} else {
$results['data'] = $data_array;
}
Expand Down
53 changes: 52 additions & 1 deletion collections.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* this array defines the menu options for the various collections
*
* NOTES:
* - do not modify this file, instead add a custom sub menu to the config.php file as explained in the README.md file
* - do not modify this file, instead add a custom submenu to the config.php file as explained in the README.md file
* - a valid value for params looks like this:
* [true, true, 'no'] (note the quotes surrounding strings)
*/
Expand Down Expand Up @@ -485,6 +485,57 @@
'method' => 'stat_ips_events',
'params' => [],
],
[
'type' => 'divider', // or collection
],
[
'type' => 'collection', // or divider
'label' => 'system log: device alerts',
'method' => 'get_system_log',
'params' => ['device-alert'],
],
[
'type' => 'collection', // or divider
'label' => 'system log: critical alerts',
'method' => 'get_system_log',
'params' => ['next-ai-alert'],
],
[
'type' => 'collection', // or divider
'label' => 'system log: VPN alerts',
'method' => 'get_system_log',
'params' => ['vpn-alert'],
],
[
'type' => 'collection', // or divider
'label' => 'system log: admin activity',
'method' => 'get_system_log',
'params' => ['admin-activity'],
],
[
'type' => 'collection', // or divider
'label' => 'system log: update alerts',
'method' => 'get_system_log',
'params' => ['update-alert'],
],
[
'type' => 'collection', // or divider
'label' => 'system log: client alerts',
'method' => 'get_system_log',
'params' => ['client-alert'],
],
[
'type' => 'collection', // or divider
'label' => 'system log: threat alerts',
'method' => 'get_system_log',
'params' => ['threat-alert'],
],
[
'type' => 'collection', // or divider
'label' => 'system log: triggers',
'method' => 'get_system_log',
'params' => ['triggers'],
],
],
],
];
2 changes: 1 addition & 1 deletion common.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

use UniFi_API\Client as ApiClient;

const TOOL_VERSION = '2.0.29';
const TOOL_VERSION = '2.0.30';

/**
* Gather some basic information for the About modal.
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1d07848

Please sign in to comment.