259 lines
8.5 KiB
HTML
259 lines
8.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>FuckHTTP3 Proxy</title>
|
|
<style>
|
|
/* Improved Dark Mode Styles */
|
|
:root {
|
|
--bg-color: #171717;
|
|
--container-bg: #242424;
|
|
--accent-color: #4d8bff;
|
|
--text-color: #e0e0e0;
|
|
--border-color: #3a3a3a;
|
|
--input-bg: #333;
|
|
--button-hover: #3d75db;
|
|
--element-shadow: 0 4px 12px rgba(0,0,0,0.4);
|
|
}
|
|
|
|
body {
|
|
background-color: var(--bg-color);
|
|
color: var(--text-color);
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
|
|
margin: 0;
|
|
padding: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 100vh;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.container {
|
|
background-color: var(--container-bg);
|
|
border-radius: 10px;
|
|
box-shadow: var(--element-shadow);
|
|
padding: 30px;
|
|
width: 80%;
|
|
max-width: 600px;
|
|
text-align: center;
|
|
}
|
|
|
|
h1, h3, h4 {
|
|
color: var(--accent-color);
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
input[type="text"], textarea {
|
|
background-color: var(--input-bg);
|
|
color: var(--text-color);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 5px;
|
|
padding: 10px;
|
|
width: 100%;
|
|
font-size: 14px;
|
|
transition: border-color 0.2s, box-shadow 0.2s;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
input[type="text"]:focus, textarea:focus {
|
|
outline: none;
|
|
border-color: var(--accent-color);
|
|
box-shadow: 0 0 0 2px rgba(77, 139, 255, 0.2);
|
|
}
|
|
|
|
button {
|
|
background-color: var(--accent-color);
|
|
color: #ffffff;
|
|
border: none;
|
|
border-radius: 5px;
|
|
padding: 10px 16px;
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: background-color 0.2s, transform 0.1s;
|
|
margin: 5px;
|
|
}
|
|
|
|
button:hover {
|
|
background-color: var(--button-hover);
|
|
}
|
|
|
|
button:active {
|
|
transform: translateY(1px);
|
|
}
|
|
|
|
.script-editor-container {
|
|
background-color: var(--container-bg);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.script-controls {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
#customScript {
|
|
min-height: 150px;
|
|
font-family: monospace;
|
|
resize: vertical;
|
|
}
|
|
|
|
.example-script {
|
|
background-color: #333;
|
|
border: 1px solid var(--border-color);
|
|
color: var(--text-color);
|
|
transition: background-color 0.2s;
|
|
}
|
|
|
|
.example-script:hover {
|
|
background-color: #444;
|
|
}
|
|
|
|
footer {
|
|
color: #777;
|
|
margin-top: 20px;
|
|
font-size: 12px;
|
|
}
|
|
|
|
.error {
|
|
color: #ff5555;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.checkbox-container {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
input[type="checkbox"] {
|
|
margin-right: 5px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>FuckHTTP3 Web Proxy</h1>
|
|
<p>Enter a URL below to browse through the HTTP/3 proxy</p>
|
|
|
|
{{if .Error}}
|
|
<div class="error">{{.Error}}</div>
|
|
{{end}}
|
|
|
|
<form action="/proxy" method="post">
|
|
<div class="form-group">
|
|
<input type="text" name="url" placeholder="https://example.com"
|
|
value="{{.URL}}" required autofocus>
|
|
</div>
|
|
<button type="submit">Browse</button>
|
|
</form>
|
|
|
|
<div class="script-editor-container">
|
|
<h3>Custom JavaScript Injection</h3>
|
|
<p>Write JavaScript that will be injected into every proxied page:</p>
|
|
<form id="scriptForm" action="/save-script" method="POST">
|
|
<div class="script-controls">
|
|
<button type="submit" id="saveScript">Save Script</button>
|
|
<div class="checkbox-container">
|
|
<input type="checkbox" id="enableScript" name="enableScript">
|
|
<label for="enableScript">Enable script injection</label>
|
|
</div>
|
|
</div>
|
|
<textarea id="customScript" name="customScript" rows="10" style="width: 100%; font-family: monospace;">{{.CustomScript}}</textarea>
|
|
</form>
|
|
|
|
<div class="script-examples">
|
|
<h4>Example Scripts:</h4>
|
|
<button class="example-script" data-script="// Add a red border to all images
|
|
document.querySelectorAll('img').forEach(img => {
|
|
img.style.border = '2px solid red';
|
|
});">Highlight Images</button>
|
|
|
|
<button class="example-script" data-script="// Dark mode
|
|
document.body.style.backgroundColor = '#222';
|
|
document.body.style.color = '#eee';
|
|
document.querySelectorAll('a').forEach(a => {
|
|
a.style.color = '#5af';
|
|
});">Dark Mode</button>
|
|
|
|
<button class="example-script" data-script="// Remove ads (simplistic example)
|
|
document.querySelectorAll('div[id*="ad"], div[class*="ad"], iframe[src*="ad"]').forEach(el => {
|
|
el.style.display = 'none';
|
|
});">Hide Ads</button>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Handle example script buttons
|
|
document.querySelectorAll('.example-script').forEach(button => {
|
|
button.addEventListener('click', function() {
|
|
document.getElementById('customScript').value = this.dataset.script;
|
|
});
|
|
});
|
|
|
|
// Set initial checkbox state based on server setting
|
|
document.getElementById('enableScript').checked = {{.ScriptEnabled}};
|
|
|
|
// Handle form submission with AJAX
|
|
document.getElementById('scriptForm').addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
|
|
// Get the form values directly
|
|
const scriptText = document.getElementById('customScript').value;
|
|
const isEnabled = document.getElementById('enableScript').checked;
|
|
|
|
console.log('Submitting script, enabled:', isEnabled);
|
|
|
|
// Create form data manually
|
|
const formData = new FormData();
|
|
formData.append('customScript', scriptText);
|
|
|
|
// Only append enableScript if it's checked
|
|
if (isEnabled) {
|
|
formData.append('enableScript', 'on');
|
|
}
|
|
|
|
// Log what we're sending
|
|
for (let pair of formData.entries()) {
|
|
console.log(pair[0] + ': ' + pair[1]);
|
|
}
|
|
|
|
fetch('/save-script', {
|
|
method: 'POST',
|
|
body: formData
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
alert('Script saved successfully! Enabled: ' + data.enabled);
|
|
} else {
|
|
alert('Error saving script: ' + data.error);
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error('Error:', error);
|
|
alert('Error saving script');
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
|
|
<footer>
|
|
Powered by FuckHTTP3 Proxy - Using HTTP/3 with QUIC
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html> |