Skip to content

Commit 1d07848

Browse files
committed
- bumped version to 2.0.30
- 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
1 parent 2aa4eac commit 1d07848

File tree

8 files changed

+181
-62
lines changed

8 files changed

+181
-62
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ There, you will also find examples and detailed instructions on how to use it.
1111
Please keep the following in mind when using the UniFi API browser:
1212

1313
- The tool does not support all available data collections and API endpoints. See the list below for those currently supported.
14-
- 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)
14+
- 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)
1515
- The Network Application on UniFi OS-based controllers is also supported, same versions as above
1616
- When accessing UniFi OS-based controllers through this tool, please read the remarks regarding UniFi OS support
1717
- Please read the Security Notice before installing this tool.
@@ -99,6 +99,7 @@ The UniFi API browser tool offers the following features:
9999
- list alarms
100100
- count alarms
101101
- list IDS/IPS events
102+
- list system log entries
102103

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

ajax/fetch_collection.php

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
require_once '../common.php';
1414
require_once '../collections.php';
1515

16+
use Kint\Renderer\TextRenderer;
17+
use Kint\Renderer\RichRenderer;
1618
use UniFi_API\Client as ApiClient;
1719

1820
/**
@@ -163,6 +165,13 @@
163165
*/
164166
$results['count'] = count($data_array);
165167

168+
/**
169+
* For results returned from API v2, we need to check for the 'data' property and count that.
170+
*/
171+
if(property_exists($data_array, 'data')) {
172+
$results['count'] = count($data_array->data);
173+
}
174+
166175
if ($debug) {
167176
error_log('DEBUG: ' . $results['count'] . ' objects collected');
168177
}
@@ -173,18 +182,18 @@
173182
*
174183
* @note using Rich render mode
175184
*/
176-
Kint::$display_called_from = false;
177-
Kint\Renderer\RichRenderer::$folder = false;
178-
$results['data'] = @d($data_array);
185+
Kint::$display_called_from = false;
186+
RichRenderer::$folder = false;
187+
$results['data'] = @d($data_array);
179188
} else {
180189
if ($output_method === 'kint_plain') {
181190
/**
182191
* @note using Plain render mode
183192
*/
184-
Kint::$display_called_from = false;
185-
Kint\Renderer\RichRenderer::$folder = false;
186-
Kint\Renderer\TextRenderer::$decorations = false;
187-
$results['data'] = @s($data_array);
193+
Kint::$display_called_from = false;
194+
RichRenderer::$folder = false;
195+
TextRenderer::$decorations = false;
196+
$results['data'] = @s($data_array);
188197
} else {
189198
$results['data'] = $data_array;
190199
}

collections.php

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* this array defines the menu options for the various collections
1111
*
1212
* NOTES:
13-
* - do not modify this file, instead add a custom sub menu to the config.php file as explained in the README.md file
13+
* - do not modify this file, instead add a custom submenu to the config.php file as explained in the README.md file
1414
* - a valid value for params looks like this:
1515
* [true, true, 'no'] (note the quotes surrounding strings)
1616
*/
@@ -485,6 +485,57 @@
485485
'method' => 'stat_ips_events',
486486
'params' => [],
487487
],
488+
[
489+
'type' => 'divider', // or collection
490+
],
491+
[
492+
'type' => 'collection', // or divider
493+
'label' => 'system log: device alerts',
494+
'method' => 'get_system_log',
495+
'params' => ['device-alert'],
496+
],
497+
[
498+
'type' => 'collection', // or divider
499+
'label' => 'system log: critical alerts',
500+
'method' => 'get_system_log',
501+
'params' => ['next-ai-alert'],
502+
],
503+
[
504+
'type' => 'collection', // or divider
505+
'label' => 'system log: VPN alerts',
506+
'method' => 'get_system_log',
507+
'params' => ['vpn-alert'],
508+
],
509+
[
510+
'type' => 'collection', // or divider
511+
'label' => 'system log: admin activity',
512+
'method' => 'get_system_log',
513+
'params' => ['admin-activity'],
514+
],
515+
[
516+
'type' => 'collection', // or divider
517+
'label' => 'system log: update alerts',
518+
'method' => 'get_system_log',
519+
'params' => ['update-alert'],
520+
],
521+
[
522+
'type' => 'collection', // or divider
523+
'label' => 'system log: client alerts',
524+
'method' => 'get_system_log',
525+
'params' => ['client-alert'],
526+
],
527+
[
528+
'type' => 'collection', // or divider
529+
'label' => 'system log: threat alerts',
530+
'method' => 'get_system_log',
531+
'params' => ['threat-alert'],
532+
],
533+
[
534+
'type' => 'collection', // or divider
535+
'label' => 'system log: triggers',
536+
'method' => 'get_system_log',
537+
'params' => ['triggers'],
538+
],
488539
],
489540
],
490541
];

common.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use UniFi_API\Client as ApiClient;
1212

13-
const TOOL_VERSION = '2.0.29';
13+
const TOOL_VERSION = '2.0.30';
1414

1515
/**
1616
* Gather some basic information for the About modal.

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)