Skip to content

Commit

Permalink
incorporated the suggestions from PR #115 to update Twig
Browse files Browse the repository at this point in the history
other minor changes
  • Loading branch information
malle-pietje committed Nov 7, 2024
1 parent 1d07848 commit 90af0f1
Show file tree
Hide file tree
Showing 12 changed files with 219 additions and 67 deletions.
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.30';
const TOOL_VERSION = '2.0.31';

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

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

33 changes: 21 additions & 12 deletions js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ $('.output_radio_button').click(function() {
*/
function switchCSS(new_theme) {
console.log('switching to new Bootswatch theme: ' + new_theme);
if (new_theme == 'bootstrap') {
if (new_theme === 'bootstrap') {
$('#bootswatch_theme_stylesheet').attr('href', '');
} else {
$('#bootswatch_theme_stylesheet').attr('href', 'https://stackpath.bootstrapcdn.com/bootswatch/4.3.1/' + new_theme + '/bootstrap.min.css');
Expand Down Expand Up @@ -317,7 +317,7 @@ function fetchDebugDetails() {
url: 'ajax/show_api_debug.php',
dataType: 'html',
success: function (data) {
if (data != 'ignore') {
if (data !== 'ignore') {
console.log('debug messages as returned by the cURL request to the UniFi controller API:');
console.log(data);
}
Expand Down Expand Up @@ -532,28 +532,37 @@ $(function() {
* upon opening the "About" modal we check latest version of API browser tool using AJAX and inform user when it's
* more recent than the current
*/
let version_update_span = $('#span_api_browser_update');
$('#about_modal').on('shown.bs.modal', function (e) {
$.ajax({
type: 'GET',
url: 'https://api.github.com/repos/Art-of-WiFi/UniFi-API-browser/releases/latest',
dataType: 'json',
success: function (json) {
if (api_browser_version != '' && typeof(json.tag_name) !== 'undefined') {
if (cmpVersion(api_browser_version, json.tag_name.substring(1)) < 0) {
$('#span_api_browser_update').html('an update is available: ' + json.tag_name.substring(1));
if (api_browser_version !== '' && typeof(json.tag_name) !== 'undefined') {
const normalizedTagName = json.tag_name.startsWith('v') ? json.tag_name.substring(1) : json.tag_name;

if (debug) {
console.log('API Browser Version:', api_browser_version);
console.log('Normalized Tag Name:', normalizedTagName);
console.log('Comparison Result:', cmpVersion(api_browser_version, normalizedTagName));
}

if (cmpVersion(api_browser_version, normalizedTagName) < 0) {
version_update_span.html('an update is available: ' + normalizedTagName);
$('#span_api_browser_update').removeClass('badge-success').addClass('badge-warning');
} else if (cmpVersion(api_browser_version, json.tag_name.substring(1)) === 0) {
$('#span_api_browser_update').html('up to date');
$('#span_api_browser_update').removeClass('badge-danger').addClass('badge-success');
} else if (cmpVersion(api_browser_version, normalizedTagName) === 0) {
version_update_span.html('up to date');
version_update_span.removeClass('badge-danger').addClass('badge-success');
} else {
$('#span_api_browser_update').html('bleeding edge!');
$('#span_api_browser_update').removeClass('badge-success').addClass('badge-danger');
version_update_span.html('bleeding edge!');
version_update_span.removeClass('badge-success').addClass('badge-danger');
}
}
},
error: function(jqXHR, textStatus, errorThrown) {
$('#span_api_browser_update').html('error checking updates');
$('#span_api_browser_update').removeClass('badge-success').addClass('badge-danger');
version_update_span.html('error checking updates');
version_update_span.removeClass('badge-success').addClass('badge-danger');
console.log(jqXHR);
}
});
Expand Down
7 changes: 4 additions & 3 deletions vendor/art-of-wifi/unifi-api-client/src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class Client
{
/** Constants. */
const CLASS_VERSION = '1.1.99';
const CLASS_VERSION = '1.1.100';
const CURL_METHODS_ALLOWED = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'];
const DEFAULT_CURL_METHOD = 'GET';

Expand Down Expand Up @@ -2098,7 +2098,8 @@ public function list_hotspotop()
* @param int|null $up upload speed limit in kbps
* @param int|null $down download speed limit in kbps
* @param int|null $megabytes data transfer limit in MB
* @return array containing a single object which contains the create_time(stamp) of the voucher(s) created
* @return array|bool containing a single object/array which contains the create_time(stamp) of the voucher(s)
* created, false upon failure
*/
public function create_voucher(
int $minutes,
Expand All @@ -2108,7 +2109,7 @@ public function create_voucher(
int $up = null,
int $down = null,
int $megabytes = null
): array
)
{
$payload = [
'cmd' => 'create-voucher',
Expand Down
28 changes: 14 additions & 14 deletions vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
"packages": [
{
"name": "art-of-wifi/unifi-api-client",
"version": "v1.1.99",
"version_normalized": "1.1.99.0",
"version": "v1.1.100",
"version_normalized": "1.1.100.0",
"source": {
"type": "git",
"url": "https://github.com/Art-of-WiFi/UniFi-API-client.git",
"reference": "70f6a374e2c73eb91a9aa20f6c9375b235d55ce1"
"reference": "1522992e495f94b9fa52ff1015fe1e99f9a24fe4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Art-of-WiFi/UniFi-API-client/zipball/70f6a374e2c73eb91a9aa20f6c9375b235d55ce1",
"reference": "70f6a374e2c73eb91a9aa20f6c9375b235d55ce1",
"url": "https://api.github.com/repos/Art-of-WiFi/UniFi-API-client/zipball/1522992e495f94b9fa52ff1015fe1e99f9a24fe4",
"reference": "1522992e495f94b9fa52ff1015fe1e99f9a24fe4",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"php": ">=7.4.0"
},
"time": "2024-10-23T11:30:34+00:00",
"time": "2024-10-29T11:14:00+00:00",
"type": "library",
"installation-source": "source",
"autoload": {
Expand Down Expand Up @@ -51,7 +51,7 @@
],
"support": {
"issues": "https://github.com/Art-of-WiFi/UniFi-API-client/issues",
"source": "https://github.com/Art-of-WiFi/UniFi-API-client/tree/v1.1.99"
"source": "https://github.com/Art-of-WiFi/UniFi-API-client/tree/v1.1.100"
},
"install-path": "../art-of-wifi/unifi-api-client"
},
Expand Down Expand Up @@ -531,17 +531,17 @@
},
{
"name": "twig/twig",
"version": "v3.11.1",
"version_normalized": "3.11.1.0",
"version": "v3.11.3",
"version_normalized": "3.11.3.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "ff063afc691e1cfda6714f1915ed766cb108d188"
"reference": "3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/ff063afc691e1cfda6714f1915ed766cb108d188",
"reference": "ff063afc691e1cfda6714f1915ed766cb108d188",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e",
"reference": "3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e",
"shasum": ""
},
"require": {
Expand All @@ -556,7 +556,7 @@
"psr/container": "^1.0|^2.0",
"symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0"
},
"time": "2024-09-10T10:40:14+00:00",
"time": "2024-11-07T12:34:41+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -598,7 +598,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.11.1"
"source": "https://github.com/twigphp/Twig/tree/v3.11.3"
},
"funding": [
{
Expand Down
16 changes: 8 additions & 8 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '2aa4eacd2a3939191239784be9a1f9a622eb5db1',
'reference' => '1d0784845357ba781472c9ea6b6dd07ba870cae3',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
Expand All @@ -13,16 +13,16 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '2aa4eacd2a3939191239784be9a1f9a622eb5db1',
'reference' => '1d0784845357ba781472c9ea6b6dd07ba870cae3',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'art-of-wifi/unifi-api-client' => array(
'pretty_version' => 'v1.1.99',
'version' => '1.1.99.0',
'reference' => '70f6a374e2c73eb91a9aa20f6c9375b235d55ce1',
'pretty_version' => 'v1.1.100',
'version' => '1.1.100.0',
'reference' => '1522992e495f94b9fa52ff1015fe1e99f9a24fe4',
'type' => 'library',
'install_path' => __DIR__ . '/../art-of-wifi/unifi-api-client',
'aliases' => array(),
Expand Down Expand Up @@ -83,9 +83,9 @@
'dev_requirement' => false,
),
'twig/twig' => array(
'pretty_version' => 'v3.11.1',
'version' => '3.11.1.0',
'reference' => 'ff063afc691e1cfda6714f1915ed766cb108d188',
'pretty_version' => 'v3.11.3',
'version' => '3.11.3.0',
'reference' => '3b06600ff3abefaf8ff55d5c336cd1c4253f8c7e',
'type' => 'library',
'install_path' => __DIR__ . '/../twig/twig',
'aliases' => array(),
Expand Down
11 changes: 11 additions & 0 deletions vendor/twig/twig/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# 3.11.3 (2024-11-07)

* Fix an infinite recursion in the sandbox code

# 3.11.2 (2024-11-06)

* [BC BREAK] Fix a security issue in the sandbox mode allowing an attacker to call attributes on Array-like objects
They are now checked via the property policy
* Fix a security issue in the sandbox mode allowing an attacker to be able to call `toString()`
under some circumstances on an object even if the `__toString()` method is not allowed by the security policy

# 3.11.1 (2024-09-10)

* Fix a security issue when an included sandboxed template has been loaded before without the sandbox context
Expand Down
6 changes: 3 additions & 3 deletions vendor/twig/twig/src/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
*/
class Environment
{
public const VERSION = '3.11.1';
public const VERSION_ID = 301101;
public const VERSION = '3.11.3';
public const VERSION_ID = 301103;
public const MAJOR_VERSION = 4;
public const MINOR_VERSION = 11;
public const RELEASE_VERSION = 1;
public const RELEASE_VERSION = 3;
public const EXTRA_VERSION = '';

private $charset;
Expand Down
Loading

0 comments on commit 90af0f1

Please sign in to comment.