Skip to content

Commit c24a5b1

Browse files
authored
feat: upgrade Node.js to v22 LTS (#241)
* chore: php lint issue * chore: upgrade deps * feat: improve vnstat parser * test: add unit tests * fix: improve speed calculation * feat: update node.js to v22 * fix: add key for each child in a list
1 parent a6e142c commit c24a5b1

31 files changed

+1166
-535
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
'single_quote' => true,
7575
// Whitespace
7676
'array_indentation' => true,
77+
'no_useless_else' => false,
7778
];
7879

7980
$excludes = [

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"require-dev": {
3-
"friendsofphp/php-cs-fixer": "^3.65.0",
4-
"phpstan/phpstan": "^2.0.3",
5-
"phpstan/phpstan-strict-rules": "^2.0.0",
3+
"friendsofphp/php-cs-fixer": "^3.93.1",
4+
"phpstan/phpstan": "^2.1.38",
5+
"phpstan/phpstan-strict-rules": "^2.0.8",
66
"phpstan/extension-installer": "^1.4.3"
77
},
88
"scripts": {

composer.lock

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

packages/package/install/installpackage-flood

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function _installApp() {
176176
mkdir -p /tmp/quickbox
177177
cd /tmp/quickbox || exit 1
178178
if [[ ! $(which npm) ]] || [[ $(node --version) =~ "v6" ]]; then
179-
_execute "curl -sL --retry 3 --retry-max-time 60 https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh"
179+
_execute "curl -sL --retry 3 --retry-max-time 60 https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh"
180180
_execute "sudo bash nodesource_setup.sh"
181181
_execute "apt-get install -y --force-reinstall true nodejs"
182182
fi

packages/system/update/qbUpdateService

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function _updateservice() {
6363
if [[ ! $(which npm) ]] || [[ $(node --version) =~ "v6" ]]; then
6464
_info "Installing Node.js..."
6565
cd /tmp || exit 1
66-
_execute "curl -sL --retry 3 --retry-max-time 60 https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh"
66+
_execute "curl -sL --retry 3 --retry-max-time 60 https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh"
6767
bash nodesource_setup.sh >>"${OUTTO}" 2>&1
6868
exitstatus=$?
6969
counter=0
@@ -95,12 +95,12 @@ function _updateservice() {
9595
touch /install/.quickbox-ws.lock
9696
_success "QuickBox service updated"
9797
else
98-
# upgrade to v18
99-
_info "Upgrade nodejs to v18"
100-
if [[ ! $(which npm) ]] || [[ ! $(node --version) =~ "v18" ]]; then
98+
# upgrade to v22
99+
_info "Upgrade nodejs to v22"
100+
if [[ ! $(which npm) ]] || [[ ! $(node --version) =~ "v22" ]]; then
101101
_info "Upgrading Node.js..."
102102
cd /tmp || exit 1
103-
_execute "curl -sL --retry 3 --retry-max-time 60 https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh"
103+
_execute "curl -sL --retry 3 --retry-max-time 60 https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh"
104104
bash nodesource_setup.sh >>"${OUTTO}" 2>&1
105105
exitstatus=$?
106106
counter=0

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ function _insngx() {
829829
function _insnodejs() {
830830
# install Nodejs for background service
831831
cd /tmp || exit 1
832-
curl -sL --retry 3 --retry-max-time 60 https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
832+
curl -sL --retry 3 --retry-max-time 60 https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh
833833
bash nodesource_setup.sh >>"${OUTTO}" 2>&1
834834
exitstatus=$?
835835
counter=0

setup/dashboard/inc/panel.app_status.ws.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,17 @@
167167
id: undefined,
168168
override: function (dataJSON) {
169169
function formatsize (length) {
170-
const value = isNaN(length) ? 0 : length;
171170
const suffixList = ["B/s", "KB/s", "MB/s", "GB/s", "TB/s"];
172-
const idx = Math.min(Math.max(Math.floor(Math.log2(value) / 10), 0), suffixList.length - 1);
173-
return (value / Math.pow(2, idx * 10)).toFixed(idx > 0 ? 2 : 0).toString() + " " + suffixList[idx];
171+
let numeric = Number(length);
172+
if (!isFinite(numeric) || numeric <= 0) {
173+
return "0 B/s";
174+
}
175+
let idx = 0;
176+
while (numeric >= 1024 && idx < suffixList.length - 1) {
177+
numeric /= 1024;
178+
++idx;
179+
}
180+
return numeric.toFixed(idx > 0 ? 2 : 0) + " " + suffixList[idx];
174181
}
175182

176183
if (window.ts === undefined || window.net === undefined) {

setup/dashboard/lib/socket.io/socket.io.min.js

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

0 commit comments

Comments
 (0)