From e025271a14610270a66c9c118bac7925b162a696 Mon Sep 17 00:00:00 2001 From: itdoginfo Date: Fri, 2 May 2025 14:50:06 +0300 Subject: [PATCH] Added to global check: DNS check and proxy check. From VizzleTF --- .../resources/view/podkop/podkop.js | 29 +++++++++++++++++++ podkop/files/usr/bin/podkop | 8 +++++ 2 files changed, 37 insertions(+) diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js index d7329c6..dab092b 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/podkop.js @@ -621,6 +621,14 @@ const createModalContent = (title, content) => { ]; }; +// Add IP masking function before showConfigModal +const maskIP = (ip) => { + if (!ip) return ''; + const parts = ip.split('.'); + if (parts.length !== 4) return ip; + return ['XX', 'XX', 'XX', parts[3]].join('.'); +}; + const showConfigModal = async (command, title) => { const res = await safeExec('/usr/bin/podkop', [command]); let formattedOutput = formatDiagnosticOutput(res.stdout || _('No output')); @@ -642,6 +650,27 @@ const showConfigModal = async (command, title) => { formattedOutput += _('Check DNS server on current device (PC, phone)') + '\n'; formattedOutput += _('Its must be router!') + '\n'; } + + // Bypass check + const bypassResponse = await fetch('https://fakeip.tech-domain.club/check', { signal: controller.signal }); + const bypassData = await bypassResponse.json(); + const bypassResponse2 = await fetch('https://ip.tech-domain.club/check', { signal: controller.signal }); + const bypassData2 = await bypassResponse2.json(); + + formattedOutput += '━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'; + + if (bypassData.IP && bypassData2.IP && bypassData.IP !== bypassData2.IP) { + formattedOutput += '✅ ' + _('Proxy working correctly') + '\n'; + formattedOutput += _('Direct IP: ') + maskIP(bypassData.IP) + '\n'; + formattedOutput += _('Proxy IP: ') + maskIP(bypassData2.IP) + '\n'; + } else if (bypassData.IP === bypassData2.IP) { + formattedOutput += '❌ ' + _('Proxy is not working - same IP for both domains') + '\n'; + formattedOutput += _('IP: ') + maskIP(bypassData.IP) + '\n'; + } else { + formattedOutput += '❌ ' + _('Proxy check failed') + '\n'; + } + + } catch (error) { formattedOutput += '\n❌ ' + _('Check failed: ') + (error.name === 'AbortError' ? _('timeout') : error.message) + '\n'; } diff --git a/podkop/files/usr/bin/podkop b/podkop/files/usr/bin/podkop index 4092df7..4a0f73a 100755 --- a/podkop/files/usr/bin/podkop +++ b/podkop/files/usr/bin/podkop @@ -2250,6 +2250,14 @@ global_check() { done fi + print_global "━━━━━━━━━━━━━━━━━━━━━━━━━━━" + print_global "➡️ DNS status" + dns_info=$(check_dns_available) + dns_type=$(echo "$dns_info" | jq -r '.dns_type') + dns_server=$(echo "$dns_info" | jq -r '.dns_server') + status=$(echo "$dns_info" | jq -r '.status') + print_global "$dns_type ($dns_server) is $status" + print_global "━━━━━━━━━━━━━━━━━━━━━━━━━━━" print_global "🔁 FakeIP"