mirror of
https://github.com/Ground-Zerro/DomainMapper.git
synced 2025-12-10 01:47:18 +07:00
188 lines
9.3 KiB
HTML
188 lines
9.3 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>DNS Resolver Settings</title>
|
||
<script>
|
||
function validateForm(event) {
|
||
const services = document.querySelectorAll('input[name="services"]:checked');
|
||
const dnsServers = document.querySelectorAll('input[name="dns_servers"]:checked');
|
||
const format = document.querySelector('input[name="format"]:checked');
|
||
|
||
if (services.length === 0) {
|
||
alert("Выберите хотя бы один сервис.");
|
||
event.preventDefault();
|
||
return false;
|
||
}
|
||
|
||
if (dnsServers.length === 0) {
|
||
alert("Выберите хотя бы один DNS сервер.");
|
||
event.preventDefault();
|
||
return false;
|
||
}
|
||
|
||
if (!format) {
|
||
alert("Выберите формат сохранения.");
|
||
event.preventDefault();
|
||
return false;
|
||
}
|
||
|
||
if ((format.value === 'unix' || format.value === 'win' || format.value === 'keenetic') &&
|
||
!document.getElementById('gateway').value) {
|
||
alert("Укажите IP шлюза.");
|
||
event.preventDefault();
|
||
return false;
|
||
}
|
||
|
||
return true;
|
||
}
|
||
|
||
// Загрузка сервисов из файла и добавление их в форму
|
||
function loadServices() {
|
||
const serviceUrl = 'https://raw.githubusercontent.com/Ground-Zerro/DomainMapper/refs/heads/main/platformdb';
|
||
|
||
fetch(serviceUrl)
|
||
.then(response => response.text())
|
||
.then(data => {
|
||
const lines = data.split('\n');
|
||
const servicesContainer = document.getElementById('servicesContainer');
|
||
|
||
lines.forEach(line => {
|
||
const parts = line.split(':');
|
||
if (parts.length > 1) {
|
||
const serviceName = parts[0].trim();
|
||
const label = document.createElement('label');
|
||
const input = document.createElement('input');
|
||
input.type = 'checkbox';
|
||
input.name = 'services';
|
||
input.value = serviceName;
|
||
label.appendChild(input);
|
||
label.appendChild(document.createTextNode(` ${serviceName}`));
|
||
servicesContainer.appendChild(label);
|
||
servicesContainer.appendChild(document.createElement('br'));
|
||
}
|
||
});
|
||
})
|
||
.catch(error => console.error('Error loading services:', error));
|
||
}
|
||
|
||
// Загрузка DNS серверов из файла и добавление их в форму
|
||
function loadDNSServers() {
|
||
const dnsUrl = 'https://raw.githubusercontent.com/Ground-Zerro/DomainMapper/refs/heads/main/dnsdb';
|
||
|
||
fetch(dnsUrl)
|
||
.then(response => response.text())
|
||
.then(data => {
|
||
const lines = data.split('\n');
|
||
const dnsServersContainer = document.getElementById('dnsServersContainer');
|
||
|
||
lines.forEach(line => {
|
||
const parts = line.split(':');
|
||
if (parts.length > 1) {
|
||
const dnsServerName = parts[0].trim();
|
||
const label = document.createElement('label');
|
||
const input = document.createElement('input');
|
||
input.type = 'checkbox';
|
||
input.name = 'dns_servers';
|
||
input.value = dnsServerName;
|
||
label.appendChild(input);
|
||
label.appendChild(document.createTextNode(` ${dnsServerName}`));
|
||
dnsServersContainer.appendChild(label);
|
||
dnsServersContainer.appendChild(document.createElement('br'));
|
||
}
|
||
});
|
||
})
|
||
.catch(error => console.error('Error loading DNS servers:', error));
|
||
}
|
||
|
||
// Функция для отображения/скрытия поля ввода IP шлюза
|
||
function toggleGatewayField() {
|
||
const format = document.querySelector('input[name="format"]:checked');
|
||
const gatewayField = document.getElementById('gatewayField');
|
||
|
||
// Показываем поле, если выбран формат Unix Route, Windows Route или Keenetic CLI
|
||
if (format && (format.value === 'unix' || format.value === 'win' || format.value === 'keenetic')) {
|
||
gatewayField.style.display = 'block';
|
||
} else {
|
||
gatewayField.style.display = 'none';
|
||
}
|
||
}
|
||
|
||
// Функция для отображения/скрытия поля комментария (для Mikrotik и Keenetic)
|
||
function toggleCommentField() {
|
||
const format = document.querySelector('input[name="format"]:checked');
|
||
const commentField = document.getElementById('commentaryField');
|
||
|
||
// Показываем поле, если выбран формат Mikrotik firewall или Keenetic CLI
|
||
if (format && (format.value === 'mikrotik' || format.value === 'keenetic')) {
|
||
commentField.style.display = 'block';
|
||
} else {
|
||
commentField.style.display = 'none';
|
||
}
|
||
}
|
||
|
||
window.onload = function() {
|
||
loadServices();
|
||
loadDNSServers();
|
||
|
||
// Инициализировать отображение полей для шлюза и комментария при загрузке
|
||
toggleGatewayField();
|
||
toggleCommentField();
|
||
};
|
||
|
||
// Добавляем слушатель событий для изменения выбора формата
|
||
document.addEventListener('change', function(event) {
|
||
if (event.target.name === 'format') {
|
||
toggleGatewayField();
|
||
toggleCommentField();
|
||
}
|
||
});
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<h2>Настройки</h2>
|
||
<form action="/run" method="post" enctype="multipart/form-data" onsubmit="validateForm(event)">
|
||
<label><strong>Список сервисов:</strong></label><br>
|
||
<div id="servicesContainer"></div><br>
|
||
|
||
<label><strong>Список используемых DNS серверов:</strong></label><br>
|
||
<div id="dnsServersContainer"></div><br>
|
||
|
||
<label><strong>Фильтрация Cloudflare:</strong></label><br>
|
||
<input type="checkbox" name="cloudflare" value="yes"> Исключить Cloudflare<br><br>
|
||
|
||
<label><strong>Агрегация подсетей:</strong></label><br>
|
||
<input type="radio" name="aggregation" value="16"> До /16 (255.255.0.0)<br>
|
||
<input type="radio" name="aggregation" value="24"> До /24 (255.255.255.0)<br>
|
||
<input type="radio" name="aggregation" value="mix"> Микс /24 и /32<br>
|
||
<input type="radio" name="aggregation" value="none" checked> Не агрегировать<br><br>
|
||
|
||
<label><strong>Формат сохранения:</strong></label><br>
|
||
<input type="radio" name="format" value="ip"> IP (только IP адреса)<br>
|
||
<input type="radio" name="format" value="cidr"> CIDR (%IP%/32)<br>
|
||
<input type="radio" name="format" value="win"> Windows Route (route add %IP% mask 255.255.255.255 %gateway%)<br>
|
||
<input type="radio" name="format" value="unix"> Unix Route (ip route %IP%/32 %gateway%)<br>
|
||
<input type="radio" name="format" value="wg"> Wireguard/AmneziaWG (%IP%/32, %IP%/32, и т.д...)<br>
|
||
<input type="radio" name="format" value="openvpn"> Open VPN (push "route %IP% 255.255.255.255")<br>
|
||
<input type="radio" name="format" value="keenetic"> Keenetic CLI (ip route %IP%/32 %gateway% auto !%commentary%)<br>
|
||
<input type="radio" name="format" value="mikrotik"> Mikrotik firewall (/ip/firewall/address-list add list=%commentary% address=%IP%/32)<br><br>
|
||
|
||
<!-- Поле для ввода шлюза -->
|
||
<div id="gatewayField" style="display:none;">
|
||
<label><strong>Укажите IP шлюза или имя интерфейса:</strong></label><br>
|
||
<input type="text" id="gateway" name="gateway" placeholder="IP или имя шлюза"><br><br>
|
||
</div>
|
||
|
||
<!-- Поле для ввода комментария -->
|
||
<div id="commentaryField" style="display:none;">
|
||
<label><strong>Укажите комментарий для списка:</strong></label><br>
|
||
<input type="text" id="commentary" name="commentary" placeholder="Комментарий"><br><br>
|
||
</div>
|
||
|
||
<button type="submit">Запустить</button>
|
||
</form>
|
||
|
||
<div id="progress" style="margin-top: 20px; font-weight: bold;">Прогресс выполнения будет отображаться здесь...</div>
|
||
</body>
|
||
</html> |