Skip to content

Commit

Permalink
UniFi API browser 2.0.20
Browse files Browse the repository at this point in the history
- updated links in the About modal now that dereferer.org is no longer available
- updated PHP API client to 1.1.73
  • Loading branch information
malle-pietje committed Oct 27, 2021
1 parent 5bf616d commit 82861c0
Show file tree
Hide file tree
Showing 11 changed files with 114 additions and 89 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ignore personal config file
# Ignore personal config files
config/config.php
config/users.php

Expand All @@ -11,4 +11,5 @@ desktop.ini
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
Thumbs.db
/.idea
5 changes: 3 additions & 2 deletions ajax/fetch_collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
'data' => []
];

$output_method = 'json';
$output_method = 'json';

if (!empty($_SESSION['controller'])) {
$method = '';
Expand Down Expand Up @@ -118,7 +118,8 @@
$params = [null, null, $gateway_stats_attribs];
break;
case 'stat_monthly_gateway':
$params = [null, null, $gateway_stats_attribs]; }
$params = [null, null, $gateway_stats_attribs];
}
}

if (!empty($method) && !empty($site_id)) {
Expand Down
4 changes: 2 additions & 2 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* This file is subject to the MIT license that is bundled with this package in the file LICENSE.md
*/
define('TOOL_VERSION', '2.0.19');
define('TOOL_VERSION', '2.0.20');

/**
* gather some basic information for the About modal
Expand Down Expand Up @@ -48,4 +48,4 @@ function getClientVersion()
}
}
return 'unknown';
}
}
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.

8 changes: 4 additions & 4 deletions templates/components/about_modal.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@
<div class="modal-body">
<div class="row">
<div class="col-sm-8 offset-sm-2">
A tool for browsing the data collections that are exposed through Ubiquiti's UniFi Controller API, created by <a href="http://www.dereferer.org/?https://artofwifi.net/portfolio/unifi-api-browser/" target="_blank">Art of WiFi</a>.
A tool for browsing the data collections that are exposed through Ubiquiti's UniFi Controller API, created by <a href="https://artofwifi.net/portfolio/unifi-api-browser/" target="_blank">Art of WiFi</a>.
</div>
</div>
<br>
<div class="row">
<div class="col-sm-8 offset-sm-2">
<a href="http://www.dereferer.org/?https://github.com/Art-of-WiFi/UniFi-API-browser"target="_blank">UniFi API browser on Github</a>
<a href="https://github.com/Art-of-WiFi/UniFi-API-browser"target="_blank">UniFi API browser on Github</a>
</div>
</div>
<div class="row">
<div class="col-sm-8 offset-sm-2">
<a href="http://www.dereferer.org/?http://community.ubnt.com/t5/UniFi-Wireless/UniFi-API-browser-tool-updates-and-discussion/m-p/1392651#U1392651" target="_blank">UniFi API browser on Ubiquiti Community forum</a>
<a href="https://community.ubnt.com/t5/UniFi-Wireless/UniFi-API-browser-tool-updates-and-discussion/m-p/1392651#U1392651" target="_blank">UniFi API browser on Ubiquiti Community forum</a>
</div>
</div>
<div class="row">
<div class="col-sm-8 offset-sm-2">
<a href="http://www.dereferer.org/?https://github.com/Art-of-WiFi/UniFi-API-client" target="_blank">UniFi API client on Github</a>
<a href="https://github.com/Art-of-WiFi/UniFi-API-client" target="_blank">UniFi API client on Github</a>
</div>
</div>

Expand Down
5 changes: 3 additions & 2 deletions vendor/art-of-wifi/unifi-api-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ require_once 'vendor/autoload.php';
* initialize the UniFi API connection class, log in to the controller and request the alarms collection
* (this example assumes you have already assigned the correct values to the variables used)
*/
$unifi_connection = new UniFi_API\Client($controller_user, $controller_password $controller_url, $site_id, $controller_version, true);
$unifi_connection = new UniFi_API\Client($controller_user, $controller_password, $controller_url, $site_id, $controller_version, true);
$login = $unifi_connection->login();
$results = $unifi_connection->list_alarms(); // returns a PHP array containing alarm objects
```
Expand All @@ -133,7 +133,7 @@ own PHP code.

The class currently supports the following functions/methods to GET/POST/PUT/DELETE data
through the UniFi Controller API. Please refer to the comments in the source code for
more details on the functions/methods and their respective parameters.
more details on each of the functions/methods and their respective parameters.

- login()
- logout()
Expand Down Expand Up @@ -170,6 +170,7 @@ more details on the functions/methods and their respective parameters.
- disable_ap()
- edit_apgroup() (supported with controller versions 6.0.X and higher)
- edit_client_fixedip()
- edit_client_name()
- edit_firewallgroup()
- edit_usergroup()
- extend_guest_validity()
Expand Down
27 changes: 14 additions & 13 deletions vendor/art-of-wifi/unifi-api-client/examples/test_connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,25 @@
if (is_resource($ch) || is_object($ch)) {
/**
* If we have a resource or object (for PHP > 8.0), we proceed and set the required cURL options
*/
curl_setopt($ch, CURLOPT_URL, $controllerurl);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

/**
* This cURL option can have a value of 0-6
*
* NOTES:
* The cURL option CURLOPT_SSLVERSION can have a value of 0-6
* see this URL for more details:
* http://php.net/manual/en/function.curl-setopt.php
* 0 is the default value and is used by the PHP API client class
*/
curl_setopt($ch, CURLOPT_SSLVERSION, 0);
$curl_options = [
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS,
CURLOPT_URL => $controllerurl,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_VERBOSE => true,
CURLOPT_SSLVERSION => 0,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
];

/**
* Be more verbose
*/
curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt_array($ch, $curl_options);

/**
* $results contains the output as returned by the cURL request,
Expand Down
Loading

0 comments on commit 82861c0

Please sign in to comment.