Reverted back to 4cd4110 before changes were made to monitoring. Trying

new implementation for failed pulls.

Added modal for when content is blocked or fails to load
This commit is contained in:
dwebmm 2025-01-21 02:25:46 -06:00
parent 21327c81ea
commit 97f3a78f9d
2 changed files with 105 additions and 1 deletions

View file

@ -191,6 +191,17 @@
</div>
</div>
<div id="blockedModal" class="modal blocked-modal">
<div class="modal-content">
<h2>⚠️ Content Blocked</h2>
<p>This content cannot be displayed due to security restrictions.</p>
<div class="blocked-modal-buttons">
<button id="blockedRetryBtn" class="blocked-retry-btn">Try Another Site</button>
<button id="blockedOpenBtn" class="blocked-open-btn">Open in New Tab</button>
</div>
</div>
</div>
<main>
<iframe
id="contentFrame"
@ -306,6 +317,7 @@
title.includes("cannot") ||
title.includes("denied")
) {
<<<<<<< HEAD
fumble();
return;
}
@ -335,6 +347,47 @@
</div>
`;
document.body.appendChild(httpModal);
=======
// Show blocked content modal
const blockedModal = document.getElementById('blockedModal');
const retryBtn = document.getElementById('blockedRetryBtn');
const openBtn = document.getElementById('blockedOpenBtn');
blockedModal.classList.add('show');
retryBtn.onclick = () => {
blockedModal.classList.remove('show');
fumble();
};
openBtn.onclick = () => {
window.open(frame.src, '_blank');
blockedModal.classList.remove('show');
fumble();
};
return;
}
} catch (e) {
// Show blocked content modal for CORS errors too
const blockedModal = document.getElementById('blockedModal');
const retryBtn = document.getElementById('blockedRetryBtn');
const openBtn = document.getElementById('blockedOpenBtn');
blockedModal.classList.add('show');
retryBtn.onclick = () => {
blockedModal.classList.remove('show');
fumble();
};
openBtn.onclick = () => {
window.open(frame.src, '_blank');
blockedModal.classList.remove('show');
fumble();
};
return;
}
>>>>>>> 495bda9 (Reverted back to 4cd4110 before changes were made to monitoring. Trying)
// Handle button clicks
const openBtn = httpModal.querySelector('.http-open-btn');
@ -358,7 +411,22 @@
// Handle load errors
frame.onerror = () => {
fumble(); // Try again if loading fails
const blockedModal = document.getElementById('blockedModal');
const retryBtn = document.getElementById('blockedRetryBtn');
const openBtn = document.getElementById('blockedOpenBtn');
blockedModal.classList.add('show');
retryBtn.onclick = () => {
blockedModal.classList.remove('show');
fumble();
};
openBtn.onclick = () => {
window.open(frame.src, '_blank');
blockedModal.classList.remove('show');
fumble();
};
};
};

View file

@ -911,17 +911,29 @@ main:hover .floating-button {
text-decoration: underline;
}
<<<<<<< HEAD
.http-modal .modal-content {
max-width: 400px;
}
.http-modal-buttons {
=======
.blocked-modal .modal-content {
max-width: 400px;
}
.blocked-modal-buttons {
>>>>>>> 495bda9 (Reverted back to 4cd4110 before changes were made to monitoring. Trying)
display: flex;
gap: 10px;
margin-top: 20px;
}
<<<<<<< HEAD
.http-open-btn, .http-skip-btn {
=======
.blocked-retry-btn, .blocked-open-btn {
>>>>>>> 495bda9 (Reverted back to 4cd4110 before changes were made to monitoring. Trying)
flex: 1;
padding: 12px;
border: none;
@ -932,11 +944,16 @@ main:hover .floating-button {
transition: background-color 0.3s ease;
}
<<<<<<< HEAD
.http-open-btn {
=======
.blocked-retry-btn {
>>>>>>> 495bda9 (Reverted back to 4cd4110 before changes were made to monitoring. Trying)
background-color: #ff4500;
color: white;
}
<<<<<<< HEAD
.dark-mode .http-open-btn {
background-color: #ff6b4a;
}
@ -946,15 +963,34 @@ main:hover .floating-button {
}
.http-skip-btn {
=======
.dark-mode .blocked-retry-btn {
background-color: #ff6b4a;
}
.blocked-retry-btn:hover {
background-color: #ff5722;
}
.blocked-open-btn {
>>>>>>> 495bda9 (Reverted back to 4cd4110 before changes were made to monitoring. Trying)
background-color: #f0f0f0;
color: #333;
}
<<<<<<< HEAD
.dark-mode .http-skip-btn {
=======
.dark-mode .blocked-open-btn {
>>>>>>> 495bda9 (Reverted back to 4cd4110 before changes were made to monitoring. Trying)
background-color: #2a2a2a;
color: #fff;
}
<<<<<<< HEAD
.http-skip-btn:hover {
=======
.blocked-open-btn:hover {
>>>>>>> 495bda9 (Reverted back to 4cd4110 before changes were made to monitoring. Trying)
background-color: #e0e0e0;
}