247 lines
7.0 KiB
HTML
247 lines
7.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Secure Site Proxy</title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 20px;
|
|
}
|
|
|
|
.container {
|
|
background: white;
|
|
border-radius: 20px;
|
|
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
padding: 40px;
|
|
max-width: 600px;
|
|
width: 100%;
|
|
}
|
|
|
|
h1 {
|
|
text-align: center;
|
|
color: #333;
|
|
margin-bottom: 10px;
|
|
font-size: 28px;
|
|
}
|
|
|
|
.subtitle {
|
|
text-align: center;
|
|
color: #666;
|
|
margin-bottom: 30px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.error-message {
|
|
background: #fee;
|
|
color: #c33;
|
|
padding: 12px;
|
|
border-radius: 10px;
|
|
margin-bottom: 20px;
|
|
text-align: center;
|
|
font-size: 14px;
|
|
border: 1px solid #fcc;
|
|
display: none;
|
|
}
|
|
|
|
.error-message.show {
|
|
display: block;
|
|
animation: shake 0.5s;
|
|
}
|
|
|
|
@keyframes shake {
|
|
0%, 100% { transform: translateX(0); }
|
|
25% { transform: translateX(-10px); }
|
|
75% { transform: translateX(10px); }
|
|
}
|
|
|
|
form {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 15px;
|
|
}
|
|
|
|
input[type="url"] {
|
|
padding: 15px;
|
|
border: 2px solid #e0e0e0;
|
|
border-radius: 10px;
|
|
font-size: 16px;
|
|
transition: border-color 0.3s;
|
|
}
|
|
|
|
input[type="url"]:focus {
|
|
outline: none;
|
|
border-color: #667eea;
|
|
}
|
|
|
|
button {
|
|
padding: 15px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 10px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: transform 0.2s, box-shadow 0.2s;
|
|
}
|
|
|
|
button:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 10px 20px rgba(102, 126, 234, 0.4);
|
|
}
|
|
|
|
button:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.features {
|
|
margin-top: 30px;
|
|
padding-top: 30px;
|
|
border-top: 1px solid #e0e0e0;
|
|
}
|
|
|
|
.features h2 {
|
|
font-size: 18px;
|
|
color: #333;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.features ul {
|
|
list-style: none;
|
|
color: #666;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.features li {
|
|
padding: 8px 0;
|
|
padding-left: 25px;
|
|
position: relative;
|
|
}
|
|
|
|
.features li:before {
|
|
content: "✓";
|
|
position: absolute;
|
|
left: 0;
|
|
color: #667eea;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.nav {
|
|
margin-top: 20px;
|
|
text-align: center;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.nav a {
|
|
color: #667eea;
|
|
text-decoration: none;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.nav a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.stats {
|
|
font-size: 12px;
|
|
color: #999;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>🔒 Secure Site Proxy</h1>
|
|
<p class="subtitle">Access websites securely and privately</p>
|
|
|
|
<div id="errorMessage" class="error-message"></div>
|
|
|
|
<form id="proxyForm" method="POST" action="/" target="_blank">
|
|
<input
|
|
type="url"
|
|
id="targetUrl"
|
|
name="url"
|
|
placeholder="Enter URL (e.g., https://example.com)"
|
|
required
|
|
autofocus
|
|
pattern="https?://.+"
|
|
title="Please enter a valid HTTP or HTTPS URL"
|
|
>
|
|
<button type="submit">🚀 Browse Securely</button>
|
|
</form>
|
|
|
|
<div class="features">
|
|
<h2>Features</h2>
|
|
<ul>
|
|
<li>URL obfuscation for privacy</li>
|
|
<li>Content rewriting and filtering</li>
|
|
<li>Intelligent caching</li>
|
|
<li>Rate limiting protection</li>
|
|
<li>Tracking script removal</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="nav">
|
|
<a href="/logout">🚪 Logout</a>
|
|
<span class="stats" id="stats">Loading stats...</span>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function showError(message) {
|
|
const errorDiv = document.getElementById('errorMessage');
|
|
errorDiv.textContent = message;
|
|
errorDiv.classList.add('show');
|
|
setTimeout(() => errorDiv.classList.remove('show'), 5000);
|
|
}
|
|
|
|
document.getElementById('proxyForm').addEventListener('submit', function(e) {
|
|
const url = document.getElementById('targetUrl').value.trim();
|
|
|
|
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
|
e.preventDefault();
|
|
showError('URL must start with http:// or https://');
|
|
return;
|
|
}
|
|
|
|
const privatePatterns = [
|
|
/^https?:\/\/(localhost|127\.0\.0\.1|0\.0\.0\.0)/i,
|
|
/^https?:\/\/192\.168\./i,
|
|
/^https?:\/\/10\./i,
|
|
/^https?:\/\/172\.(1[6-9]|2[0-9]|3[0-1])\./i,
|
|
];
|
|
|
|
if (privatePatterns.some(p => p.test(url))) {
|
|
e.preventDefault();
|
|
showError('Private network addresses are not allowed');
|
|
}
|
|
});
|
|
|
|
fetch('/stats')
|
|
.then(r => r.json())
|
|
.then(data => {
|
|
const sizeMB = (data.size_bytes / 1024 / 1024).toFixed(2);
|
|
const maxSizeMB = (data.max_size_bytes / 1024 / 1024).toFixed(2);
|
|
document.getElementById('stats').textContent =
|
|
`Cache: ${data.entries} entries, ${sizeMB} MB / ${maxSizeMB} MB`;
|
|
})
|
|
.catch(() => {
|
|
document.getElementById('stats').textContent = 'Stats unavailable';
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |