Added http only site new tab redirect.

This commit is contained in:
dwebmm 2025-01-21 02:12:09 -06:00
parent 4cd41100fd
commit 652aac0e0e
2 changed files with 91 additions and 10 deletions

View file

@ -256,22 +256,55 @@
// Wait for the page to load then focus
frame.onload = () => {
// Check if we landed on a blocked/error page
try {
// Check if it's an HTTP URL
if (frame.src.startsWith('http:')) {
const httpModal = document.createElement('div');
httpModal.className = 'modal http-modal show';
httpModal.innerHTML = `
<div class="modal-content">
<h2>⚠️ HTTP Content</h2>
<p>This website uses HTTP and cannot be displayed in the frame for security reasons.</p>
<div class="http-modal-buttons">
<button class="http-open-btn">Open in New Tab</button>
<button class="http-skip-btn">Skip This Site</button>
</div>
</div>
`;
document.body.appendChild(httpModal);
// Handle button clicks
httpModal.querySelector('.http-open-btn').addEventListener('click', () => {
window.open(frame.src, '_blank');
httpModal.remove();
fumble(); // Load next site
});
httpModal.querySelector('.http-skip-btn').addEventListener('click', () => {
httpModal.remove();
fumble(); // Skip to next site
});
return;
}
// Rest of existing onload code...
const title = frame.contentWindow.document.title.toLowerCase();
if (
title.includes("blocked") ||
title.includes("error") ||
title.includes("refused") ||
title.includes("cannot") ||
title.includes("denied")
title.includes("blocked") ||
title.includes("error") ||
title.includes("refused") ||
title.includes("cannot") ||
title.includes("denied")
) {
// Try again if we hit an error page
fumble();
return;
fumble();
return;
}
} catch (e) {
// Can't access title due to CORS - assume page is OK
// Can't access title due to CORS - check if it's HTTP
if (frame.src.startsWith('http:')) {
fumble(); // Skip HTTP sites that we can't access
return;
}
}
frame.focus();

View file

@ -909,4 +909,52 @@ main:hover .floating-button {
.full-license a:hover {
text-decoration: underline;
}
.http-modal .modal-content {
max-width: 400px;
}
.http-modal-buttons {
display: flex;
gap: 10px;
margin-top: 20px;
}
.http-open-btn, .http-skip-btn {
flex: 1;
padding: 12px;
border: none;
border-radius: 8px;
font-size: 16px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.3s ease;
}
.http-open-btn {
background-color: #ff4500;
color: white;
}
.dark-mode .http-open-btn {
background-color: #ff6b4a;
}
.http-open-btn:hover {
background-color: #ff5722;
}
.http-skip-btn {
background-color: #f0f0f0;
color: #333;
}
.dark-mode .http-skip-btn {
background-color: #2a2a2a;
color: #fff;
}
.http-skip-btn:hover {
background-color: #e0e0e0;
}