From c5b61fea0b3410c94ba8ad65c975f1b75158a3e9 Mon Sep 17 00:00:00 2001 From: Varakh Date: Sun, 22 Mar 2020 13:41:45 +0100 Subject: [PATCH] Prepare 2.2.2 release --- CHANGELOG.md | 6 ++++++ README.md | 15 +++++++++++---- config/Constants.php | 4 ++-- docker/Dockerfile | 8 ++++---- public/index.php | 5 +++++ public/theme/bootstrap4/js/custom.js | 3 ++- src/Util/FileHelper.php | 13 +++++++++++++ src/Util/TSInstance.php | 2 +- src/View/bootstrap4/online_info.twig | 6 ++++++ src/View/bootstrap4/server_info.twig | 2 ++ 10 files changed, 52 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07e7a10..31e9a99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## UNRELEASED +## 2.2.2 - 2020/03/22 +* Stop auto-sorting tables +* Add bandwidth formatter +* Check PHP 7.4 compatibility +* Increase docker image base to PHP 7.4 + ## 2.2.1 - 2019/11/10 * Use separate JavaScript file to initialize DataTables diff --git a/README.md b/README.md index f86f916..c19fd81 100755 --- a/README.md +++ b/README.md @@ -7,10 +7,12 @@ The minimalistic approach of this application is intentional. * Sources are hosted on [https://github.com/v4rakh/ts3web](https://github.com/v4rakh/ts3web) ## Limitations -Features which are currently not supported: -* upload files (only viewing and deleting) -* modify permissions (only viewing) +TeamSpeak has a detailed interface for permissions and uploading files, therefore the following features are not +supported: + +* uploading files (only viewing and deleting, use the official client for uploading) +* editing permissions (only viewing, use the client for editing) ## F.A.Q @@ -169,7 +171,12 @@ To upgrade: ### Release * Set a date in the `CHANGELOG.md` file * Remove `SNAPSHOT` from the version in `Constants.php` -* Build the docker image from the project home with `docker build -t varakh/ts3web:latest -t varakh/ts3web: -f docker/Dockerfile .` and publish it +* Build the docker image from the project + * if necessary, add GitHub access token to let composer pull dependencies within the image correctly: + add `&& composer config --global --auth github-oauth.github.com \` before the `composer install` command, + where `` can be retrieved from [GitHub settings](https://github.com/settings/tokens) + * execute `docker build -t varakh/ts3web:latest -t varakh/ts3web: -f docker/Dockerfile .` to build + * publish it * Tag the release git commit and create a new release in the VCS web interface ### Prepare next development cycle diff --git a/config/Constants.php b/config/Constants.php index 9135407..87360e1 100644 --- a/config/Constants.php +++ b/config/Constants.php @@ -8,12 +8,12 @@ class Constants /** * Years tag */ - const YEARS = '2019'; + const YEARS = '2020'; /** * Version tag */ - const VERSION = '2.2.2-SNAPSHOT'; + const VERSION = '2.2.2'; /** * Return constant by it's class name diff --git a/docker/Dockerfile b/docker/Dockerfile index 98c3c6d..5bb46f8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM phpearth/php:7.3-nginx +FROM phpearth/php:7.4-nginx # install deps RUN apk add --no-cache git \ @@ -7,9 +7,9 @@ RUN apk add --no-cache git \ # adjust nginx COPY docker/default.conf /etc/nginx/conf.d/default.conf COPY docker/nginx.conf /etc/nginx/nginx.conf -RUN sed -i "s|upload_max_filesize = 2M|upload_max_filesize = 1024M|g" /etc/php/7.3/php.ini \ - && sed -i "s|post_max_size = 8M|post_max_size = 1024M|g" /etc/php/7.3/php.ini \ - && sed -i "s|max_execution_time = 30|max_execution_time = 86400|g" /etc/php/7.3/php.ini +RUN sed -i "s|upload_max_filesize = 2M|upload_max_filesize = 1024M|g" /etc/php/7.4/php.ini \ + && sed -i "s|post_max_size = 8M|post_max_size = 1024M|g" /etc/php/7.4/php.ini \ + && sed -i "s|max_execution_time = 30|max_execution_time = 86400|g" /etc/php/7.4/php.ini # copy application and set permissions COPY config/ /var/www/html/application/config/ diff --git a/public/index.php b/public/index.php index d15212c..dcd1417 100644 --- a/public/index.php +++ b/public/index.php @@ -159,6 +159,11 @@ $container['view'] = function ($container) use ($app) { }); $view->getEnvironment()->addFilter($fileSizeFilter); + $bandWidthFilter = new TwigFilter('bandwidth', function($bytes, $decimals = 2) { + return FileHelper::humanBandwidth($bytes, $decimals); + }); + $view->getEnvironment()->addFilter($bandWidthFilter); + // ts specific: time in seconds to human readable $timeInSecondsFilter = new TwigFilter('timeInSeconds', function($seconds) use ($container) { return $container['ts']->getInstance()->convertSecondsToStrTime($seconds); diff --git a/public/theme/bootstrap4/js/custom.js b/public/theme/bootstrap4/js/custom.js index 20e5e95..9e60774 100644 --- a/public/theme/bootstrap4/js/custom.js +++ b/public/theme/bootstrap4/js/custom.js @@ -3,6 +3,7 @@ $(document).ready(function () { "language": { "url": "/theme/bootstrap4/DataTables/en_dataTable.json" }, - "paging": false + "paging": false, + "aaSorting": [] }); }); \ No newline at end of file diff --git a/src/Util/FileHelper.php b/src/Util/FileHelper.php index 2e9b4e0..50dc824 100644 --- a/src/Util/FileHelper.php +++ b/src/Util/FileHelper.php @@ -49,4 +49,17 @@ class FileHelper $factor = floor((strlen($bytes) - 1) / 3); return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor]; } + + /** + * Output human readable bandwidth size + * + * @param $bytes + * @param int $decimals + * @return string + */ + public static function humanBandwidth($bytes, $decimals = 2) { + $sz = 'BKMGTP'; + $factor = floor((strlen($bytes) - 1) / 3); + return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor] . '/s'; + } } \ No newline at end of file diff --git a/src/Util/TSInstance.php b/src/Util/TSInstance.php index 3f706e1..3f8ef7e 100644 --- a/src/Util/TSInstance.php +++ b/src/Util/TSInstance.php @@ -46,7 +46,7 @@ class TSInstance $this->ts = $ts; $this->logger->debug(sprintf('Connected to %s:%s', $this->host, $this->queryPort)); } catch (TSException $e) { - $this->logger->error(sprintf('Could not connect to %s:%s', $this->host, $this->queryPort, $e->getMessage())); + $this->logger->error(sprintf('Could not connect to %s:%s. Reason: %s', $this->host, $this->queryPort, $e->getMessage())); die($e); } } diff --git a/src/View/bootstrap4/online_info.twig b/src/View/bootstrap4/online_info.twig index 516f762..c175aaf 100644 --- a/src/View/bootstrap4/online_info.twig +++ b/src/View/bootstrap4/online_info.twig @@ -63,6 +63,12 @@ {'key': 'connection_connected_time', 'apply': 'timeInSeconds'}, {'key': 'client_created', 'apply': 'timestamp'}, {'key': 'client_lastconnected', 'apply': 'timestamp'}, + {'key': 'connection_bandwidth_received_last_minute_total', 'apply': 'bandwidth'}, + {'key': 'connection_bandwidth_received_last_second_total', 'apply': 'bandwidth'}, + {'key': 'connection_bandwidth_sent_last_minute_total', 'apply': 'bandwidth'}, + {'key': 'connection_bandwidth_sent_last_second_total', 'apply': 'bandwidth'}, + {'key': 'connection_filetransfer Bandwidth Received', 'apply': 'bandwidth'}, + {'key': 'connection_filetransfer Bandwidth Sent', 'apply': 'bandwidth'}, {'key': 'client_month_bytes_uploaded', 'apply': 'file'}, {'key': 'client_month_bytes_downloaded', 'apply': 'file'}, {'key': 'client_total_bytes_uploaded', 'apply': 'file'}, diff --git a/src/View/bootstrap4/server_info.twig b/src/View/bootstrap4/server_info.twig index 67c5b52..9602422 100644 --- a/src/View/bootstrap4/server_info.twig +++ b/src/View/bootstrap4/server_info.twig @@ -31,6 +31,8 @@ {'key': 'virtualserver_month_bytes_uploaded', 'apply': 'file'}, {'key': 'virtualserver_total_bytes_downloaded', 'apply': 'file'}, {'key': 'virtualserver_total_bytes_uploaded', 'apply': 'file'}, + {'key': 'connection_filetransfer_bandwidth_received', 'apply': 'bandwidth'}, + {'key': 'connection_filetransfer_bandwidth_sent', 'apply': 'bandwidth'}, {'key': 'connection_filetransfer_bytes_sent_total', 'apply': 'file'}, {'key': 'connection_filetransfer_bytes_received_total', 'apply': 'file'}, {'key': 'connection_bytes_sent_speech', 'apply': 'file'},