Skip to content

Commit 88e41b8

Browse files
fix: Node.js versions updated (v24 Active LTS default, v22 Maintenance, v26 Current); remove EOL v18/v20; fix switch_version removes old nodesource repo before installing new version
1 parent 071d8c9 commit 88e41b8

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

panel/routes/modules.py

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -555,13 +555,13 @@ def is_installed(check_cmd):
555555
'desc':'JavaScript runtime built on Chrome V8 engine',
556556
'check':'which node 2>/dev/null || which nodejs 2>/dev/null',
557557
'versions':[
558-
{'label':'v22 LTS (Jod)', 'value':'22'},
559-
{'label':'v24 LTS (Krypton)', 'value':'24'},
560-
{'label':'v26 Current', 'value':'26'},
558+
{'label':'v24 LTS — Active (Krypton)', 'value':'24'},
559+
{'label':'v22 LTS — Maintenance (Jod)', 'value':'22'},
560+
{'label':'v26 Current (non-LTS)', 'value':'26'},
561561
],
562-
'install_tpl':'curl -fsSL https://deb.nodesource.com/setup_{ver}.x | bash - && apt-get install -y nodejs',
563-
'install':'curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs',
564-
'uninstall':'apt-get remove -y --purge nodejs && apt-get autoremove -y',
562+
'install_tpl':'curl -fsSL https://deb.nodesource.com/setup_{ver}.x | bash - && DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs',
563+
'install':'curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs',
564+
'uninstall':'apt-get remove -y --purge nodejs && apt-get autoremove -y && rm -f /etc/apt/sources.list.d/nodesource.list',
565565
'manage':False,
566566
},
567567
{
@@ -1555,7 +1555,11 @@ def cget(key):
15551555
npm_path = sh('which npm 2>/dev/null') or ''
15561556
info = f'Node.js {version}\nnpm {npm_ver}\nnode: {node_path}\nnpm: {npm_path}'
15571557
return jsonify({'ok':True,'status':'active' if node_path else 'inactive',
1558-
'version':version,'info':info, 'versions': [{'label': 'v24 LTS (Jod)', 'value': '24'}, {'label': 'v22 LTS (Jod)', 'value': '22'}, {'label': 'v20 LTS (Iron)', 'value': '20'}, {'label': 'v18 LTS (Hydrogen)', 'value': '18'}]})
1558+
'version':version,'info':info, 'versions': [
1559+
{'label': 'v24 LTS — Active (Krypton)', 'value': '24'},
1560+
{'label': 'v22 LTS — Maintenance (Jod)', 'value': '22'},
1561+
{'label': 'v26 Current (non-LTS)', 'value': '26'},
1562+
]})
15591563

15601564
elif mod_id == 'bind9':
15611565
status = sh('systemctl is-active named 2>/dev/null || systemctl is-active bind9 2>/dev/null') or 'inactive'
@@ -1855,8 +1859,9 @@ def sh(cmd, t=30):
18551859
'systemctl stop mariadb 2>/dev/null && '
18561860
f'curl -fsSL --max-time 30 https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --mariadb-server-version={ver} && '
18571861
'apt-get update -qq -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 && '
1858-
'apt-get install -y -o Dpkg::Options::="--force-confnew" mariadb-server && '
1859-
'systemctl start mariadb'
1862+
'apt-get install -y --allow-downgrades --allow-change-held-packages '
1863+
'-o Dpkg::Options::="--force-confnew" mariadb-server && '
1864+
'systemctl start mariadb && systemctl enable mariadb'
18601865
)
18611866
ver_check_cmd = "mariadb --version 2>/dev/null | grep -oP '[0-9]+[.][0-9]+[.][0-9]+' | head -1"
18621867

@@ -1909,10 +1914,15 @@ def sh(cmd, t=30):
19091914
elif mod_id == 'nodejs':
19101915
script = (
19111916
'export DEBIAN_FRONTEND=noninteractive && '
1912-
f'curl -fsSL https://deb.nodesource.com/setup_{ver}.x | bash - && '
1913-
'apt-get install -y nodejs'
1917+
# Remove old nodesource repo so the new one takes precedence
1918+
'rm -f /etc/apt/sources.list.d/nodesource.list '
1919+
'/etc/apt/sources.list.d/nodejs.list '
1920+
'/usr/share/keyrings/nodesource.gpg '
1921+
'/usr/share/keyrings/nodesource-repo.gpg && '
1922+
f'curl -fsSL --max-time 30 https://deb.nodesource.com/setup_{ver}.x | bash - && '
1923+
'apt-get install -y --allow-downgrades nodejs'
19141924
)
1915-
ver_check_cmd = "node --version 2>/dev/null"
1925+
ver_check_cmd = f"node --version 2>/dev/null | tr -d 'v'"
19161926

19171927
elif mod_id == 'bind9':
19181928
script = (

0 commit comments

Comments
 (0)