diff --git a/hetzner/proxmox-setup b/hetzner/proxmox-setup index e3cad15..8106a51 100755 --- a/hetzner/proxmox-setup +++ b/hetzner/proxmox-setup @@ -419,11 +419,17 @@ if grep -rq 'pve-no-subscription' /etc/apt/sources.list.d/ 2>/dev/null; then fi echo "$nosub" echo '---NAG_PATCHED---' -# Check if the subscription nag popup has been patched -# PVE 8: void({ replaces Ext.Msg.show -# PVE 9: same pattern or similar -if grep -q 'void({' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js 2>/dev/null; then - echo 'yes' +# Check if the subscription nag popup needs patching. +# PVE 9.x changed the JS logic so the nag never triggers even without +# patching (the condition checks for 'NoMoreNagging' which never matches). +# PVE 8.x needs the void({ patch to suppress it. +pve_major=$(pvesh get /version --output-format json 2>/dev/null \ + | python3 -c 'import sys,json; print(json.load(sys.stdin)["version"].split(".")[0])' 2>/dev/null \ + || echo '8') +if [ "$pve_major" -ge 9 ] 2>/dev/null; then + echo 'yes' # PVE 9+ nag is effectively disabled +elif grep -q 'void({' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js 2>/dev/null; then + echo 'yes' # PVE 8 with JS patch applied elif ! grep -q "No valid subscription" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js 2>/dev/null; then echo 'yes' # nag text removed entirely else