71 lines
2.5 KiB
HTML
71 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Hosts Converter</title>
|
|
<style>
|
|
body { font-family: Arial, sans-serif; max-width: 800px; margin: 20px auto; padding: 20px; }
|
|
form { background: #f5f5f5; padding: 20px; border-radius: 5px; }
|
|
input[type="text"] { width: 100%; padding: 8px; margin: 5px 0; }
|
|
.result-box { margin: 20px 0; padding: 15px; border: 1px solid #ddd; background: #fff; }
|
|
.recent-links { margin-top: 30px; border-top: 1px solid #eee; padding-top: 20px; }
|
|
.link-item { margin: 10px 0; padding: 10px; background: #f8f9fa; border-radius: 3px; }
|
|
.timestamp { color: #666; font-size: 0.9em; }
|
|
button { padding: 8px 15px; background: #007bff; color: white; border: none; border-radius: 3px; cursor: pointer; }
|
|
button:hover { background: #0056b3; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Hosts File Converter</h1>
|
|
|
|
<form method="GET" action="/">
|
|
<p>
|
|
<label>URL to hosts file:<br>
|
|
<input type="text" name="url" required
|
|
placeholder="np. paulgb.github.io/BarbBlock/blacklists/hosts-file.txt">
|
|
</label>
|
|
</p>
|
|
<p>
|
|
<label>Target IP:
|
|
<input type="text" name="ip" pattern="\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"
|
|
value="195.187.6.34" required>
|
|
</label>
|
|
</p>
|
|
<button type="submit">Generate convert link</button>
|
|
</form>
|
|
|
|
{% if generated_link %}
|
|
<div class="result-box">
|
|
<h3>Link to MikroTik/Adguard:</h3>
|
|
<input type="text" value="{{ generated_link }}" readonly
|
|
style="width: 100%; padding: 8px; margin: 5px 0;">
|
|
<button onclick="copyToClipboard()">Copy link</button>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="recent-links">
|
|
<h3>Last converts:</h3>
|
|
{% if recent_links %}
|
|
{% for link_data in recent_links %}
|
|
<div class="link-item">
|
|
<div class="timestamp">{{ link_data[0]|datetimeformat }}</div>
|
|
<a href="/convert?url={{ link_data[1]|urlencode }}&ip={{ link_data[2] }}" target="_blank">
|
|
{{ link_data[1] }} → {{ link_data[2] }}
|
|
</a>
|
|
</div>
|
|
{% endfor %}
|
|
{% else %}
|
|
<p>Empty..</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<script>
|
|
function copyToClipboard() {
|
|
const copyText = document.querySelector("input[readonly]");
|
|
copyText.select();
|
|
document.execCommand("copy");
|
|
alert("OK!");
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|