From 5ff832533e5f69c5d0732792b4b26a79d180d425 Mon Sep 17 00:00:00 2001 From: Ivan K Date: Fri, 21 Mar 2025 13:03:29 +0300 Subject: [PATCH] feat: add DNS and bypass status checks to diagnostics --- .../resources/view/podkop/podkop.js | 174 +++++++++++++++--- luci-app-podkop/po/ru/podkop.po | 41 ++++- luci-app-podkop/po/templates/podkop.pot | 39 ++++ podkop/files/usr/bin/podkop | 81 +++++++- 4 files changed, 303 insertions(+), 32 deletions(-) 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 b7cc972..7705dd1 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 @@ -663,7 +663,7 @@ const createStatusPanel = (title, status, buttons) => { }; // Update the status section creation -let createStatusSection = function (podkopStatus, singboxStatus, podkop, luci, singbox, system, fakeipStatus, fakeipCLIStatus) { +let createStatusSection = function (podkopStatus, singboxStatus, podkop, luci, singbox, system, fakeipStatus, fakeipCLIStatus, dnsStatus, bypassStatus) { return E('div', { 'class': 'cbi-section' }, [ E('h3', {}, _('Service Status')), E('div', { 'class': 'table', style: 'display: flex; gap: 20px;' }, [ @@ -696,6 +696,21 @@ let createStatusSection = function (podkopStatus, singboxStatus, podkop, luci, s label: 'View Logs', command: 'check_logs', title: 'Podkop Logs' + }), + ButtonFactory.createModalButton({ + label: _('Update Lists'), + command: 'list_update', + title: _('Lists Update Results') + }), + ButtonFactory.createModalButton({ + label: _('Check NFT Rules'), + command: 'check_nft', + title: _('NFT Rules') + }), + ButtonFactory.createModalButton({ + label: _('Check DNSMasq'), + command: 'check_dnsmasq', + title: _('DNSMasq Configuration') }) ]), @@ -736,26 +751,28 @@ let createStatusSection = function (podkopStatus, singboxStatus, podkop, luci, s ]) ]) ]), - ButtonFactory.createModalButton({ - label: _('Check NFT Rules'), - command: 'check_nft', - title: _('NFT Rules') - }), - ButtonFactory.createModalButton({ - label: _('Check DNSMasq'), - command: 'check_dnsmasq', - title: _('DNSMasq Configuration') - }), - ButtonFactory.createModalButton({ - label: _('Update Lists'), - command: 'list_update', - title: _('Lists Update Results') - }), - ButtonFactory.createModalButton({ - label: _('Check Router FakeIP'), - command: 'check_fakeip', - title: _('FakeIP Router Check') - }) + E('div', { style: 'margin-bottom: 10px;' }, [ + E('div', { style: 'margin-bottom: 5px;' }, [ + E('strong', {}, _('DNS Status')), + E('br'), + E('span', { style: `color: ${dnsStatus.color}` }, [ + dnsStatus.state === 'available' ? '✔' : dnsStatus.state === 'unavailable' ? '✘' : '!', + ' ', + dnsStatus.message + ]) + ]) + ]), + E('div', { style: 'margin-bottom: 10px;' }, [ + E('div', { style: 'margin-bottom: 5px;' }, [ + E('strong', {}, _('Bypass Status')), + E('br'), + E('span', { style: `color: ${bypassStatus.color}` }, [ + bypassStatus.state === 'working' ? '✔' : bypassStatus.state === 'not_working' ? '✘' : '!', + ' ', + bypassStatus.message + ]) + ]) + ]) ]), // Version Information Panel @@ -774,12 +791,6 @@ let createStatusSection = function (podkopStatus, singboxStatus, podkop, luci, s return view.extend({ async render() { - // Always add fresh timestamp to URL to prevent caching - const timestamp = new Date().getTime(); - const url = new URL(window.location.href); - url.searchParams.set('_nocache', timestamp); - window.history.replaceState({}, document.title, url.toString()); - document.head.insertAdjacentHTML('beforeend', `