Skip to content

Commit b15d7be

Browse files
authored
Improve subscription element removal in post-install script (#7814)
1 parent e208bc1 commit b15d7be

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

tools/pve/post-pve-install.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -532,20 +532,28 @@ if [ -f "$MOBILE_TPL" ] && ! grep -q "$MARKER" "$MOBILE_TPL"; then
532532
"$MARKER" \
533533
"<script>" \
534534
" function removeSubscriptionElements() {" \
535+
" // --- Remove subscription dialogs ---" \
535536
" const dialogs = document.querySelectorAll('dialog.pwt-outer-dialog');" \
536537
" dialogs.forEach(dialog => {" \
537-
" const closeButton = dialog.querySelector('.fa-close');" \
538-
" const exclamationIcon = dialog.querySelector('.fa-exclamation-triangle');" \
539-
" const continueButton = dialog.querySelector('button');" \
540-
" if (closeButton && exclamationIcon && continueButton) { dialog.remove(); console.log('Removed subscription dialog'); }" \
538+
" const text = (dialog.textContent || '').toLowerCase();" \
539+
" if (text.includes('subscription')) {" \
540+
" dialog.remove();" \
541+
" console.log('Removed subscription dialog');" \
542+
" }" \
541543
" });" \
544+
"" \
545+
" // --- Remove subscription cards, but keep Reboot/Shutdown/Console ---" \
542546
" const cards = document.querySelectorAll('.pwt-card.pwt-p-2.pwt-d-flex.pwt-interactive.pwt-justify-content-center');" \
543547
" cards.forEach(card => {" \
544-
" const hasInteractiveElements = card.querySelector('button, input, a');" \
545-
" const hasComplexStructure = card.querySelector('.pwt-grid, .pwt-flex, .pwt-button');" \
546-
" if (!hasInteractiveElements && !hasComplexStructure) { card.remove(); console.log('Removed subscription card'); }" \
548+
" const text = (card.textContent || '').toLowerCase();" \
549+
" const hasButton = card.querySelector('button');" \
550+
" if (!hasButton && text.includes('subscription')) {" \
551+
" card.remove();" \
552+
" console.log('Removed subscription card');" \
553+
" }" \
547554
" });" \
548555
" }" \
556+
"" \
549557
" const observer = new MutationObserver(removeSubscriptionElements);" \
550558
" observer.observe(document.body, { childList: true, subtree: true });" \
551559
" removeSubscriptionElements();" \
@@ -555,9 +563,8 @@ if [ -f "$MOBILE_TPL" ] && ! grep -q "$MARKER" "$MOBILE_TPL"; then
555563
"" >> "$MOBILE_TPL"
556564
fi
557565
EOF
558-
559566
chmod 755 /usr/local/bin/pve-remove-nag.sh
560-
567+
561568
cat >/etc/apt/apt.conf.d/no-nag-script <<'EOF'
562569
DPkg::Post-Invoke { "/usr/local/bin/pve-remove-nag.sh"; };
563570
EOF

0 commit comments

Comments
 (0)