mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-09-24 02:48:32 +00:00
Improve subscription element removal in post-install script (#7814)
This commit is contained in:
parent
e208bc110b
commit
b15d7be4c3
@ -532,20 +532,28 @@ if [ -f "$MOBILE_TPL" ] && ! grep -q "$MARKER" "$MOBILE_TPL"; then
|
|||||||
"$MARKER" \
|
"$MARKER" \
|
||||||
"<script>" \
|
"<script>" \
|
||||||
" function removeSubscriptionElements() {" \
|
" function removeSubscriptionElements() {" \
|
||||||
|
" // --- Remove subscription dialogs ---" \
|
||||||
" const dialogs = document.querySelectorAll('dialog.pwt-outer-dialog');" \
|
" const dialogs = document.querySelectorAll('dialog.pwt-outer-dialog');" \
|
||||||
" dialogs.forEach(dialog => {" \
|
" dialogs.forEach(dialog => {" \
|
||||||
" const closeButton = dialog.querySelector('.fa-close');" \
|
" const text = (dialog.textContent || '').toLowerCase();" \
|
||||||
" const exclamationIcon = dialog.querySelector('.fa-exclamation-triangle');" \
|
" if (text.includes('subscription')) {" \
|
||||||
" const continueButton = dialog.querySelector('button');" \
|
" dialog.remove();" \
|
||||||
" if (closeButton && exclamationIcon && continueButton) { dialog.remove(); console.log('Removed subscription dialog'); }" \
|
" console.log('Removed subscription dialog');" \
|
||||||
|
" }" \
|
||||||
" });" \
|
" });" \
|
||||||
|
"" \
|
||||||
|
" // --- Remove subscription cards, but keep Reboot/Shutdown/Console ---" \
|
||||||
" const cards = document.querySelectorAll('.pwt-card.pwt-p-2.pwt-d-flex.pwt-interactive.pwt-justify-content-center');" \
|
" const cards = document.querySelectorAll('.pwt-card.pwt-p-2.pwt-d-flex.pwt-interactive.pwt-justify-content-center');" \
|
||||||
" cards.forEach(card => {" \
|
" cards.forEach(card => {" \
|
||||||
" const hasInteractiveElements = card.querySelector('button, input, a');" \
|
" const text = (card.textContent || '').toLowerCase();" \
|
||||||
" const hasComplexStructure = card.querySelector('.pwt-grid, .pwt-flex, .pwt-button');" \
|
" const hasButton = card.querySelector('button');" \
|
||||||
" if (!hasInteractiveElements && !hasComplexStructure) { card.remove(); console.log('Removed subscription card'); }" \
|
" if (!hasButton && text.includes('subscription')) {" \
|
||||||
|
" card.remove();" \
|
||||||
|
" console.log('Removed subscription card');" \
|
||||||
|
" }" \
|
||||||
" });" \
|
" });" \
|
||||||
" }" \
|
" }" \
|
||||||
|
"" \
|
||||||
" const observer = new MutationObserver(removeSubscriptionElements);" \
|
" const observer = new MutationObserver(removeSubscriptionElements);" \
|
||||||
" observer.observe(document.body, { childList: true, subtree: true });" \
|
" observer.observe(document.body, { childList: true, subtree: true });" \
|
||||||
" removeSubscriptionElements();" \
|
" removeSubscriptionElements();" \
|
||||||
@ -555,7 +563,6 @@ if [ -f "$MOBILE_TPL" ] && ! grep -q "$MARKER" "$MOBILE_TPL"; then
|
|||||||
"" >> "$MOBILE_TPL"
|
"" >> "$MOBILE_TPL"
|
||||||
fi
|
fi
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod 755 /usr/local/bin/pve-remove-nag.sh
|
chmod 755 /usr/local/bin/pve-remove-nag.sh
|
||||||
|
|
||||||
cat >/etc/apt/apt.conf.d/no-nag-script <<'EOF'
|
cat >/etc/apt/apt.conf.d/no-nag-script <<'EOF'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user