From fbade7315108b5beb6740263dc5e07e12fb5d897 Mon Sep 17 00:00:00 2001 From: malle-pietje Date: Tue, 14 Apr 2020 15:21:08 +0200 Subject: [PATCH] UniFi API browser 2.0.9 - executed composer update to update packages - upgraded PHP API client to version 1.1.52 - minor changes - added max. tx/rx-rates attributes to fetch for the gateway stats --- README.md | 10 +- ajax/fetch_about_modal_metrics.php | 2 +- ajax/fetch_collection.php | 6 +- ajax/fetch_sites.php | 2 +- ajax/show_api_debug.php | 2 +- ajax/update_controller.php | 2 +- ajax/update_theme.php | 2 +- collections.php | 2 +- common.php | 2 +- composer.lock | 36 +- config/config-template.php | 2 +- config/users-template.php | 2 +- js/custom.js | 4 +- templates/components/about_modal.html.twig | 2 +- vendor/art-of-wifi/unifi-api-client/README.md | 27 +- .../unifi-api-client/examples/block_list.php | 2 +- .../unifi-api-client/src/Client.php | 356 +++++++++++------- vendor/composer/installed.json | 42 +-- vendor/symfony/polyfill-ctype/composer.json | 2 +- vendor/twig/twig/CHANGELOG | 4 + vendor/twig/twig/LICENSE | 4 +- vendor/twig/twig/composer.json | 4 +- vendor/twig/twig/doc/advanced.rst | 7 +- vendor/twig/twig/doc/advanced_legacy.rst | 5 - vendor/twig/twig/doc/api.rst | 15 +- vendor/twig/twig/doc/filters/filter.rst | 2 +- vendor/twig/twig/doc/filters/reduce.rst | 2 +- vendor/twig/twig/doc/functions/block.rst | 4 +- vendor/twig/twig/doc/functions/constant.rst | 4 +- vendor/twig/twig/doc/templates.rst | 8 +- vendor/twig/twig/doc/tests/constant.rst | 2 +- vendor/twig/twig/doc/tests/sameas.rst | 2 +- vendor/twig/twig/drupal_test.sh | 3 +- vendor/twig/twig/ext/twig/php_twig.h | 2 +- vendor/twig/twig/src/Environment.php | 6 +- vendor/twig/twig/src/ExpressionParser.php | 2 +- .../twig/twig/src/Extension/CoreExtension.php | 2 +- vendor/twig/twig/src/Parser.php | 4 +- .../twig/twig/src/Sandbox/SecurityPolicy.php | 4 +- vendor/twig/twig/src/Template.php | 6 +- 40 files changed, 327 insertions(+), 270 deletions(-) diff --git a/README.md b/README.md index 7634639..c88d2b1 100755 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ You will find examples and detailed instructions there. Please keep the following in mind: - the API browser tool doesn't support all available data collections/API endpoints, see the list below of those that are currently supported -- currently, versions 4.x.x and 5.x.x of the UniFi Controller software are supported (version 5.12.35 has been confirmed to work) as well as UniFi OS-based controllers (version 5.12.59 has been confirmed to work) -- when accessing UniFi OS-based controllers (e.g. UDM PRO) through this tool, please read the remarks below regarding UniFi OS support +- currently, versions 4.x.x and 5.x.x of the UniFi Controller software are supported (version 5.12.66 has been confirmed to work) as well as UbiOS-based controllers (version 5.12.59 has been confirmed to work) +- when accessing UbiOS-based controllers (e.g. UDM PRO) through this tool, please read the remarks below regarding UbiOS support - there is still work to be done to add/improve functionality and usability of this tool so suggestions/comments are welcome. Please use the GitHub [issue](https://github.com/Art-of-WiFi/UniFi-API-browser/issues) list or the Ubiquiti Community forums (https://community.ubnt.com/t5/UniFi-Wireless/UniFi-API-browser-tool-released/m-p/1392651) to share your ideas/questions. - please read the Security Notice below before installing this tool! @@ -130,9 +130,9 @@ Alternatively you may choose to download the zip file and unzip it in your direc - after following these steps, you can open the tool in your browser (assuming you installed it in the root folder of your web server as suggested above) by going to this url: `http(s):///UniFi-API-browser/` -### UniFi OS support +### UbiOS support -Support for UniFi OS-based controllers (UniFi Dream Machine Pro) has been added with version 2.0.7. When adding the details for a UniFi OS device to the `config/config.php` file, please make sure not to add a port suffix or trailing slashes to the URL. +Support for UbiOS-based controllers (UniFi Dream Machine Pro) has been added with version 2.0.7. When adding the details for a UbiOS device to the `config/config.php` file, please make sure not to add a port suffix or trailing slashes to the URL. ### Extending the dropdown menu @@ -148,7 +148,7 @@ $collections = array_merge($collections, [ 'options' => [ [ 'type' => 'collection', // either collection or divider - 'label' => 'hourly site stats past 24 hours', // string that is dosplayed in the dropdown menu + 'label' => 'hourly site stats past 24 hours', // string that is displayed in the dropdown menu 'method' => 'stat_hourly_site', // the method/function in the API client class that is called 'params' => [(time() - (24 * 60 *60)) * 1000, time() * 1000], // an array containing the parameters that are passed to the method/function 'key' => 'custom_0' // unique key for this menu option, may be required for future versions diff --git a/ajax/fetch_about_modal_metrics.php b/ajax/fetch_about_modal_metrics.php index c1e9815..c51e490 100755 --- a/ajax/fetch_about_modal_metrics.php +++ b/ajax/fetch_about_modal_metrics.php @@ -54,4 +54,4 @@ * output the results with correct JSON formatting */ header('Content-Type: application/json; charset=utf-8'); -echo (json_encode($results)); +echo (json_encode($results)); \ No newline at end of file diff --git a/ajax/fetch_collection.php b/ajax/fetch_collection.php index 1da0a5e..d343bec 100755 --- a/ajax/fetch_collection.php +++ b/ajax/fetch_collection.php @@ -49,6 +49,8 @@ 'lan-tx_dropped', 'wan-tx_bytes', 'wan-rx_bytes', + 'max_rx_bytes-r', + 'max_tx_bytes-r', 'wan2-tx_bytes', 'wan2-rx_bytes', 'latency_min', @@ -196,8 +198,8 @@ $load_perc = (($time_after_load - $time_after_login) / $time_total) * 100; $remain_perc = 100 - $login_perc - $load_perc; - $results['timings']['login'] = $time_after_login; - $results['timings']['load'] = $time_after_load; + $results['timings']['login'] = $time_after_login; + $results['timings']['load'] = $time_after_load; $results['timings']['login_perc'] = $login_perc; $results['timings']['load_perc'] = $load_perc; } diff --git a/ajax/fetch_sites.php b/ajax/fetch_sites.php index d95ebad..06b75d5 100755 --- a/ajax/fetch_sites.php +++ b/ajax/fetch_sites.php @@ -141,4 +141,4 @@ header('Content-Type: application/json; charset=utf-8'); echo (json_encode($results)); -$_SESSION['memory_used'] = round(memory_get_peak_usage(false) / 1024 / 1024, 2) . 'M'; +$_SESSION['memory_used'] = round(memory_get_peak_usage(false) / 1024 / 1024, 2) . 'M'; \ No newline at end of file diff --git a/ajax/show_api_debug.php b/ajax/show_api_debug.php index 0b1e537..65cbf2a 100755 --- a/ajax/show_api_debug.php +++ b/ajax/show_api_debug.php @@ -77,4 +77,4 @@ } } else { echo 'ignore'; -} +} \ No newline at end of file diff --git a/ajax/update_controller.php b/ajax/update_controller.php index 138d5ea..38bd861 100755 --- a/ajax/update_controller.php +++ b/ajax/update_controller.php @@ -56,4 +56,4 @@ * output the results with correct JSON formatting */ header('Content-Type: application/json; charset=utf-8'); -echo (json_encode($results)); +echo (json_encode($results)); \ No newline at end of file diff --git a/ajax/update_theme.php b/ajax/update_theme.php index 84bb072..d281515 100755 --- a/ajax/update_theme.php +++ b/ajax/update_theme.php @@ -53,4 +53,4 @@ * output the results with correct JSON formatting */ header('Content-Type: application/json; charset=utf-8'); -echo (json_encode($results)); +echo (json_encode($results)); \ No newline at end of file diff --git a/collections.php b/collections.php index 9fd5552..cc87e09 100755 --- a/collections.php +++ b/collections.php @@ -469,4 +469,4 @@ ], ], ], -]; +]; \ No newline at end of file diff --git a/common.php b/common.php index 69c7671..094e770 100755 --- a/common.php +++ b/common.php @@ -7,7 +7,7 @@ * with this package in the file LICENSE.md * */ -define('TOOL_VERSION', '2.0.8'); +define('TOOL_VERSION', '2.0.9'); /** * gather some basic information for the About modal diff --git a/composer.lock b/composer.lock index eeaa4d4..ca43dd4 100755 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "art-of-wifi/unifi-api-client", - "version": "v1.1.49", + "version": "v1.1.52", "source": { "type": "git", "url": "https://github.com/Art-of-WiFi/UniFi-API-client.git", - "reference": "903d3e47d56f3d17a33e716051d947890a64966a" + "reference": "badb615627ce6b7f10872825aa2c8ab2bc8b98f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Art-of-WiFi/UniFi-API-client/zipball/903d3e47d56f3d17a33e716051d947890a64966a", - "reference": "903d3e47d56f3d17a33e716051d947890a64966a", + "url": "https://api.github.com/repos/Art-of-WiFi/UniFi-API-client/zipball/badb615627ce6b7f10872825aa2c8ab2bc8b98f3", + "reference": "badb615627ce6b7f10872825aa2c8ab2bc8b98f3", "shasum": "" }, "require": { @@ -51,7 +51,7 @@ "ubiquiti", "unifi" ], - "time": "2020-02-07T07:27:39+00:00" + "time": "2020-04-14T12:59:00+00:00" }, { "name": "kint-php/kint", @@ -113,16 +113,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", "shasum": "" }, "require": { @@ -134,7 +134,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.15-dev" } }, "autoload": { @@ -167,20 +167,20 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-02-27T09:26:54+00:00" }, { "name": "twig/twig", - "version": "v1.42.4", + "version": "v1.42.5", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152" + "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/e587180584c3d2d6cb864a0454e777bb6dcb6152", - "reference": "e587180584c3d2d6cb864a0454e777bb6dcb6152", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", + "reference": "87b2ea9d8f6fd014d0621ca089bb1b3769ea3f8e", "shasum": "" }, "require": { @@ -189,8 +189,7 @@ }, "require-dev": { "psr/container": "^1.0", - "symfony/debug": "^3.4|^4.2", - "symfony/phpunit-bridge": "^4.4@dev|^5.0" + "symfony/phpunit-bridge": "^4.4|^5.0" }, "type": "library", "extra": { @@ -219,7 +218,6 @@ }, { "name": "Twig Team", - "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" }, { @@ -233,7 +231,7 @@ "keywords": [ "templating" ], - "time": "2019-11-11T16:49:32+00:00" + "time": "2020-02-11T05:59:23+00:00" } ], "packages-dev": [], diff --git a/config/config-template.php b/config/config-template.php index 31ae919..a35fd99 100755 --- a/config/config-template.php +++ b/config/config-template.php @@ -50,4 +50,4 @@ // primary, secondary, success, danger, warning, info, light, dark, white, transparent $debug = false; // set to true (without quotes) to enable debug output to the browser and the PHP error log - // when fetching the sites collection after selecting a controller + // when fetching the sites collection after selecting a controller \ No newline at end of file diff --git a/config/users-template.php b/config/users-template.php index 25e1dd8..ec33048 100755 --- a/config/users-template.php +++ b/config/users-template.php @@ -35,4 +35,4 @@ 'user_name' => '', // string, the user name 'password' => '', // string, the SHA512 hash of the password ], -]; +]; \ No newline at end of file diff --git a/js/custom.js b/js/custom.js index 47115ad..2a69286 100755 --- a/js/custom.js +++ b/js/custom.js @@ -392,9 +392,9 @@ function fetchCollection() { 'Total time: ' + (json.timings.load + json.timings.login) + ' seconds' + '
' + '
API login time
' + + '%" aria-valuenow="' + json.timings.login_perc + ' aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip" data-placement="top" title="API login and connect took ' + json.timings.login + ' seconds">API login
' + '
data load time
' + + '%" aria-valuenow="' + json.timings.load_perc + '" aria-valuemin="0" aria-valuemax="100" data-toggle="tooltip" data-placement="top" title="Data transfer took ' + json.timings.load + ' seconds">data transfer' + '' ) diff --git a/templates/components/about_modal.html.twig b/templates/components/about_modal.html.twig index bad6f83..1ce00f5 100755 --- a/templates/components/about_modal.html.twig +++ b/templates/components/about_modal.html.twig @@ -12,7 +12,7 @@