From 7cd70468c5f1aabd97da7a28d94b3c6af09e60f4 Mon Sep 17 00:00:00 2001 From: divocat Date: Thu, 23 Oct 2025 20:00:55 +0300 Subject: [PATCH] feat: add wiki disclaimer to diagnostics --- fe-app-podkop/locales/calls.json | 83 +++++++---- fe-app-podkop/locales/podkop.pot | 66 +++++---- fe-app-podkop/locales/podkop.ru.po | 27 ++-- fe-app-podkop/src/icons/index.ts | 1 + .../src/icons/renderBookOpenTextIcon24.ts | 28 ++++ .../tabs/diagnostic/diagnostic.store.ts | 8 +- .../podkop/tabs/diagnostic/helpers/getMeta.ts | 2 +- .../podkop/tabs/diagnostic/initController.ts | 29 ++++ .../partials/renderWikiDisclaimer.ts | 40 ++++++ .../tabs/diagnostic/renderDiagnostic.ts | 1 + .../src/podkop/tabs/diagnostic/styles.ts | 25 ++++ .../src/validators/validateProxyUrl.ts | 18 +-- .../luci-static/resources/view/podkop/main.js | 135 ++++++++++++++++-- luci-app-podkop/po/ru/podkop.po | 27 ++-- luci-app-podkop/po/templates/podkop.pot | 66 +++++---- 15 files changed, 427 insertions(+), 129 deletions(-) create mode 100644 fe-app-podkop/src/icons/renderBookOpenTextIcon24.ts create mode 100644 fe-app-podkop/src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts diff --git a/fe-app-podkop/locales/calls.json b/fe-app-podkop/locales/calls.json index b4e1ca0..15a92ea 100644 --- a/fe-app-podkop/locales/calls.json +++ b/fe-app-podkop/locales/calls.json @@ -144,13 +144,6 @@ "src/podkop/tabs/diagnostic/helpers/getMeta.ts:26" ] }, - { - "call": "Checks partially passed", - "key": "Checks partially passed", - "places": [ - "src/podkop/tabs/diagnostic/helpers/getMeta.ts:20" - ] - }, { "call": "Checks passed", "key": "Checks passed", @@ -352,6 +345,13 @@ "src/validators/validateDns.ts:7" ] }, + { + "call": "Do not panic, everything can be fixed, just...", + "key": "Do not panic, everything can be fixed, just...", + "places": [ + "src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:26" + ] + }, { "call": "Domain Resolver", "key": "Domain Resolver", @@ -512,12 +512,12 @@ "call": "Failed to execute!", "key": "Failed to execute!", "places": [ - "src/podkop/tabs/diagnostic/initController.ts:225", - "src/podkop/tabs/diagnostic/initController.ts:229", - "src/podkop/tabs/diagnostic/initController.ts:259", - "src/podkop/tabs/diagnostic/initController.ts:263", - "src/podkop/tabs/diagnostic/initController.ts:297", - "src/podkop/tabs/diagnostic/initController.ts:301" + "src/podkop/tabs/diagnostic/initController.ts:226", + "src/podkop/tabs/diagnostic/initController.ts:230", + "src/podkop/tabs/diagnostic/initController.ts:260", + "src/podkop/tabs/diagnostic/initController.ts:264", + "src/podkop/tabs/diagnostic/initController.ts:298", + "src/podkop/tabs/diagnostic/initController.ts:302" ] }, { @@ -545,7 +545,7 @@ "call": "Global check", "key": "Global check", "places": [ - "src/podkop/tabs/diagnostic/initController.ts:220" + "src/podkop/tabs/diagnostic/initController.ts:221" ] }, { @@ -794,11 +794,18 @@ "src/validators/validateSubnet.ts:18" ] }, + { + "call": "Issues detected", + "key": "Issues detected", + "places": [ + "src/podkop/tabs/diagnostic/helpers/getMeta.ts:20" + ] + }, { "call": "Latest", "key": "Latest", "places": [ - "src/podkop/tabs/diagnostic/initController.ts:427" + "src/podkop/tabs/diagnostic/initController.ts:452" ] }, { @@ -913,7 +920,7 @@ "call": "Outdated", "key": "Outdated", "places": [ - "src/podkop/tabs/diagnostic/initController.ts:417" + "src/podkop/tabs/diagnostic/initController.ts:442" ] }, { @@ -951,6 +958,16 @@ "../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:351" ] }, + { + "call": "Pending", + "key": "Pending", + "places": [ + "src/podkop/tabs/diagnostic/diagnostic.store.ts:95", + "src/podkop/tabs/diagnostic/diagnostic.store.ts:103", + "src/podkop/tabs/diagnostic/diagnostic.store.ts:111", + "src/podkop/tabs/diagnostic/diagnostic.store.ts:119" + ] + }, { "call": "Podkop", "key": "Podkop", @@ -993,16 +1010,6 @@ "src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts:65" ] }, - { - "call": "Queued", - "key": "Queued", - "places": [ - "src/podkop/tabs/diagnostic/diagnostic.store.ts:95", - "src/podkop/tabs/diagnostic/diagnostic.store.ts:103", - "src/podkop/tabs/diagnostic/diagnostic.store.ts:111", - "src/podkop/tabs/diagnostic/diagnostic.store.ts:119" - ] - }, { "call": "Regional options cannot be used together", "key": "Regional options cannot be used together", @@ -1239,7 +1246,7 @@ "call": "Show sing-box config", "key": "Show sing-box config", "places": [ - "src/podkop/tabs/diagnostic/initController.ts:288", + "src/podkop/tabs/diagnostic/initController.ts:289", "src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116" ] }, @@ -1426,6 +1433,13 @@ "src/podkop/tabs/dashboard/initController.ts:265" ] }, + { + "call": "Troubleshooting", + "key": "Troubleshooting", + "places": [ + "src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:25" + ] + }, { "call": "TTL must be a positive number", "key": "TTL must be a positive number", @@ -1459,13 +1473,13 @@ "call": "unknown", "key": "unknown", "places": [ - "src/podkop/tabs/diagnostic/initController.ts:36", "src/podkop/tabs/diagnostic/initController.ts:37", "src/podkop/tabs/diagnostic/initController.ts:38", "src/podkop/tabs/diagnostic/initController.ts:39", "src/podkop/tabs/diagnostic/initController.ts:40", "src/podkop/tabs/diagnostic/initController.ts:41", - "src/podkop/tabs/diagnostic/initController.ts:391" + "src/podkop/tabs/diagnostic/initController.ts:42", + "src/podkop/tabs/diagnostic/initController.ts:416" ] }, { @@ -1487,7 +1501,7 @@ "call": "URL must start with vless://, ss://, trojan://, or socks4/5://", "key": "URL must start with vless://, ss://, trojan://, or socks4/5://", "places": [ - "src/validators/validateProxyUrl.ts:27" + "src/validators/validateProxyUrl.ts:29" ] }, { @@ -1584,10 +1598,17 @@ "call": "View logs", "key": "View logs", "places": [ - "src/podkop/tabs/diagnostic/initController.ts:254", + "src/podkop/tabs/diagnostic/initController.ts:255", "src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107" ] }, + { + "call": "Visit Wiki", + "key": "Visit Wiki", + "places": [ + "src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:31" + ] + }, { "call": "Warning: %s cannot be used together with %s. Previous selections have been removed.", "key": "Warning: %s cannot be used together with %s. Previous selections have been removed.", diff --git a/fe-app-podkop/locales/podkop.pot b/fe-app-podkop/locales/podkop.pot index 2b6b460..e72e2a9 100644 --- a/fe-app-podkop/locales/podkop.pot +++ b/fe-app-podkop/locales/podkop.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PODKOP\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-23 16:08+0300\n" -"PO-Revision-Date: 2025-10-23 16:08+0300\n" +"POT-Creation-Date: 2025-10-23 17:00+0300\n" +"PO-Revision-Date: 2025-10-23 17:00+0300\n" "Last-Translator: divocat \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -101,10 +101,6 @@ msgstr "" msgid "Checks failed" msgstr "" -#: src/podkop/tabs/diagnostic/helpers/getMeta.ts:20 -msgid "Checks partially passed" -msgstr "" - #: src/podkop/tabs/diagnostic/helpers/getMeta.ts:13 msgid "Checks passed" msgstr "" @@ -222,6 +218,10 @@ msgstr "" msgid "DNS server address cannot be empty" msgstr "" +#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:26 +msgid "Do not panic, everything can be fixed, just..." +msgstr "" + #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:166 msgid "Domain Resolver" msgstr "" @@ -312,12 +312,12 @@ msgstr "" msgid "Failed to copy!" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:225 -#: src/podkop/tabs/diagnostic/initController.ts:229 -#: src/podkop/tabs/diagnostic/initController.ts:259 -#: src/podkop/tabs/diagnostic/initController.ts:263 -#: src/podkop/tabs/diagnostic/initController.ts:297 -#: src/podkop/tabs/diagnostic/initController.ts:301 +#: src/podkop/tabs/diagnostic/initController.ts:226 +#: src/podkop/tabs/diagnostic/initController.ts:230 +#: src/podkop/tabs/diagnostic/initController.ts:260 +#: src/podkop/tabs/diagnostic/initController.ts:264 +#: src/podkop/tabs/diagnostic/initController.ts:298 +#: src/podkop/tabs/diagnostic/initController.ts:302 msgid "Failed to execute!" msgstr "" @@ -333,7 +333,7 @@ msgstr "" msgid "Get global check" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:220 +#: src/podkop/tabs/diagnostic/initController.ts:221 msgid "Global check" msgstr "" @@ -478,7 +478,11 @@ msgstr "" msgid "IP address 0.0.0.0 is not allowed" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:427 +#: src/podkop/tabs/diagnostic/helpers/getMeta.ts:20 +msgid "Issues detected" +msgstr "" + +#: src/podkop/tabs/diagnostic/initController.ts:452 msgid "Latest" msgstr "" @@ -545,7 +549,7 @@ msgstr "" msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:417 +#: src/podkop/tabs/diagnostic/initController.ts:442 msgid "Outdated" msgstr "" @@ -569,6 +573,13 @@ msgstr "" msgid "Path must end with cache.db" msgstr "" +#: src/podkop/tabs/diagnostic/diagnostic.store.ts:95 +#: src/podkop/tabs/diagnostic/diagnostic.store.ts:103 +#: src/podkop/tabs/diagnostic/diagnostic.store.ts:111 +#: src/podkop/tabs/diagnostic/diagnostic.store.ts:119 +msgid "Pending" +msgstr "" + #: src/podkop/tabs/dashboard/initController.ts:340 msgid "Podkop" msgstr "" @@ -593,13 +604,6 @@ msgstr "" msgid "Proxy traffic is routed via FakeIP" msgstr "" -#: src/podkop/tabs/diagnostic/diagnostic.store.ts:95 -#: src/podkop/tabs/diagnostic/diagnostic.store.ts:103 -#: src/podkop/tabs/diagnostic/diagnostic.store.ts:111 -#: src/podkop/tabs/diagnostic/diagnostic.store.ts:119 -msgid "Queued" -msgstr "" - #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:245 msgid "Regional options cannot be used together" msgstr "" @@ -733,7 +737,7 @@ msgstr "" msgid "Settings" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:288 +#: src/podkop/tabs/diagnostic/initController.ts:289 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116 msgid "Show sing-box config" msgstr "" @@ -843,6 +847,10 @@ msgstr "" msgid "Traffic Total" msgstr "" +#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:25 +msgid "Troubleshooting" +msgstr "" + #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:80 msgid "TTL must be a positive number" msgstr "" @@ -860,13 +868,13 @@ msgstr "" msgid "UDP over TCP" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:36 #: src/podkop/tabs/diagnostic/initController.ts:37 #: src/podkop/tabs/diagnostic/initController.ts:38 #: src/podkop/tabs/diagnostic/initController.ts:39 #: src/podkop/tabs/diagnostic/initController.ts:40 #: src/podkop/tabs/diagnostic/initController.ts:41 -#: src/podkop/tabs/diagnostic/initController.ts:391 +#: src/podkop/tabs/diagnostic/initController.ts:42 +#: src/podkop/tabs/diagnostic/initController.ts:416 msgid "unknown" msgstr "" @@ -879,7 +887,7 @@ msgstr "" msgid "Uplink" msgstr "" -#: src/validators/validateProxyUrl.ts:27 +#: src/validators/validateProxyUrl.ts:29 msgid "URL must start with vless://, ss://, trojan://, or socks4/5://" msgstr "" @@ -940,11 +948,15 @@ msgstr "" msgid "Validation errors:" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:254 +#: src/podkop/tabs/diagnostic/initController.ts:255 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107 msgid "View logs" msgstr "" +#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:31 +msgid "Visit Wiki" +msgstr "" + #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:247 msgid "Warning: %s cannot be used together with %s. Previous selections have been removed." msgstr "" diff --git a/fe-app-podkop/locales/podkop.ru.po b/fe-app-podkop/locales/podkop.ru.po index 56cff1e..4c9f731 100644 --- a/fe-app-podkop/locales/podkop.ru.po +++ b/fe-app-podkop/locales/podkop.ru.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PODKOP\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-23 19:08+0300\n" -"PO-Revision-Date: 2025-10-23 19:08+0300\n" +"POT-Creation-Date: 2025-10-23 20:00+0300\n" +"PO-Revision-Date: 2025-10-23 20:00+0300\n" "Last-Translator: divocat\n" "Language-Team: none\n" "Language: ru\n" @@ -75,10 +75,7 @@ msgid "checks" msgstr "проверки" msgid "Checks failed" -msgstr "Проверки не пройдены" - -msgid "Checks partially passed" -msgstr "Проверки пройдены частично" +msgstr "Проверки не выполнены" msgid "Checks passed" msgstr "Проверки пройдены" @@ -164,6 +161,9 @@ msgstr "DNS-сервер" msgid "DNS server address cannot be empty" msgstr "Адрес DNS-сервера не может быть пустым" +msgid "Do not panic, everything can be fixed, just..." +msgstr "Не паникуйте, всё можно исправить, просто..." + msgid "Domain Resolver" msgstr "Резолвер доменов" @@ -350,6 +350,9 @@ msgstr "Неверный URL VLESS: ошибка разбора" msgid "IP address 0.0.0.0 is not allowed" msgstr "IP-адрес 0.0.0.0 не допускается" +msgid "Issues detected" +msgstr "Обнаружены проблемы" + msgid "Latest" msgstr "Последняя" @@ -416,6 +419,9 @@ msgstr "Путь должен содержать хотя бы одну дире msgid "Path must end with cache.db" msgstr "Путь должен заканчиваться на cache.db" +msgid "Pending" +msgstr "Ожидает запуска" + msgid "Podkop" msgstr "Podkop" @@ -434,9 +440,6 @@ msgstr "Прокси-трафик не маршрутизируется чере msgid "Proxy traffic is routed via FakeIP" msgstr "Прокси-трафик направляется через FakeIP" -msgid "Queued" -msgstr "В очереди" - msgid "Regional options cannot be used together" msgstr "Нельзя использовать несколько региональных опций одновременно" @@ -617,6 +620,9 @@ msgstr "Трафик" msgid "Traffic Total" msgstr "Всего трафика" +msgid "Troubleshooting" +msgstr "Устранение неполадок" + msgid "TTL must be a positive number" msgstr "TTL должно быть положительным числом" @@ -677,6 +683,9 @@ msgstr "Ошибки валидации:" msgid "View logs" msgstr "Посмотреть логи" +msgid "Visit Wiki" +msgstr "Перейти в wiki" + msgid "Warning: %s cannot be used together with %s. Previous selections have been removed." msgstr "Предупреждение: %s нельзя использовать вместе с %s. Предыдущие варианты были удалены." diff --git a/fe-app-podkop/src/icons/index.ts b/fe-app-podkop/src/icons/index.ts index 71d9625..419b490 100644 --- a/fe-app-podkop/src/icons/index.ts +++ b/fe-app-podkop/src/icons/index.ts @@ -15,3 +15,4 @@ export * from './renderCircleCheckBigIcon24'; export * from './renderSquareChartGanttIcon24'; export * from './renderCogIcon24'; export * from './renderSearchIcon24'; +export * from './renderBookOpenTextIcon24'; diff --git a/fe-app-podkop/src/icons/renderBookOpenTextIcon24.ts b/fe-app-podkop/src/icons/renderBookOpenTextIcon24.ts new file mode 100644 index 0000000..552f8ff --- /dev/null +++ b/fe-app-podkop/src/icons/renderBookOpenTextIcon24.ts @@ -0,0 +1,28 @@ +import { svgEl } from '../helpers'; + +export function renderBookOpenTextIcon24() { + const NS = 'http://www.w3.org/2000/svg'; + return svgEl( + 'svg', + { + xmlns: NS, + viewBox: '0 0 24 24', + fill: 'none', + stroke: 'currentColor', + 'stroke-width': '2', + 'stroke-linecap': 'round', + 'stroke-linejoin': 'round', + class: 'lucide lucide-book-open-text-icon lucide-book-open-text', + }, + [ + svgEl('path', { d: 'M12 7v14' }), + svgEl('path', { d: 'M16 12h2' }), + svgEl('path', { d: 'M16 8h2' }), + svgEl('path', { + d: 'M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z', + }), + svgEl('path', { d: 'M6 12h2' }), + svgEl('path', { d: 'M6 8h2' }), + ], + ); +} diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/diagnostic.store.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/diagnostic.store.ts index 4e91415..8da0b3e 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/diagnostic.store.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/diagnostic.store.ts @@ -92,7 +92,7 @@ export const loadingDiagnosticsChecksStore: Pick< code: DIAGNOSTICS_CHECKS.DNS, title: DIAGNOSTICS_CHECKS_MAP.DNS.title, order: DIAGNOSTICS_CHECKS_MAP.DNS.order, - description: _('Queued'), + description: _('Pending'), items: [], state: 'skipped', }, @@ -100,7 +100,7 @@ export const loadingDiagnosticsChecksStore: Pick< code: DIAGNOSTICS_CHECKS.SINGBOX, title: DIAGNOSTICS_CHECKS_MAP.SINGBOX.title, order: DIAGNOSTICS_CHECKS_MAP.SINGBOX.order, - description: _('Queued'), + description: _('Pending'), items: [], state: 'skipped', }, @@ -108,7 +108,7 @@ export const loadingDiagnosticsChecksStore: Pick< code: DIAGNOSTICS_CHECKS.NFT, title: DIAGNOSTICS_CHECKS_MAP.NFT.title, order: DIAGNOSTICS_CHECKS_MAP.NFT.order, - description: _('Queued'), + description: _('Pending'), items: [], state: 'skipped', }, @@ -116,7 +116,7 @@ export const loadingDiagnosticsChecksStore: Pick< code: DIAGNOSTICS_CHECKS.FAKEIP, title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title, order: DIAGNOSTICS_CHECKS_MAP.FAKEIP.order, - description: _('Queued'), + description: _('Pending'), items: [], state: 'skipped', }, diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/helpers/getMeta.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/helpers/getMeta.ts index c8a4f9b..4a571d2 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/helpers/getMeta.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/helpers/getMeta.ts @@ -17,7 +17,7 @@ export function getMeta({ allGood, atLeastOneGood }: IGetMetaProps): { if (atLeastOneGood) { return { state: 'warning', - description: _('Checks partially passed'), + description: _('Issues detected'), }; } diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/initController.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/initController.ts index 75e0977..06d4cae 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/initController.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/initController.ts @@ -18,6 +18,7 @@ import { normalizeCompiledVersion } from '../../../helpers/normalizeCompiledVers import { renderModal } from '../../../partials'; import { PODKOP_LUCI_APP_VERSION } from '../../../constants'; import { showToast } from '../../../helpers/showToast'; +import { renderWikiDisclaimer } from './partials/renderWikiDisclaimer'; async function fetchSystemInfo() { const systemInfo = await PodkopShellMethods.getSystemInfo(); @@ -309,6 +310,30 @@ async function handleShowSingBoxConfig() { } } +function renderWikiDisclaimerWidget() { + const diagnosticsChecks = store.get().diagnosticsChecks; + + function getWikiKind() { + const allResults = diagnosticsChecks.map((check) => check.state); + + if (allResults.includes('error')) { + return 'error'; + } + + if (allResults.includes('warning')) { + return 'warning'; + } + + return 'default'; + } + + const container = document.getElementById('pdk_diagnostic-page-wiki'); + + return preserveScrollForPage(() => { + container!.replaceChildren(renderWikiDisclaimer(getWikiKind())); + }); +} + function renderDiagnosticAvailableActionsWidget() { const diagnosticsActions = store.get().diagnosticsActions; const servicesInfoWidget = store.get().servicesInfoWidget; @@ -464,6 +489,7 @@ async function onStoreUpdate( ) { if (diff.diagnosticsChecks) { renderDiagnosticsChecks(); + renderWikiDisclaimerWidget(); } if (diff.diagnosticsRunAction) { @@ -519,6 +545,9 @@ function onPageMount() { // Initial system info render renderDiagnosticSystemInfoWidget(); + // Initial Wiki disclaimer render + renderWikiDisclaimerWidget(); + // Initial services info fetch fetchServicesInfo(); diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts new file mode 100644 index 0000000..61e34d2 --- /dev/null +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts @@ -0,0 +1,40 @@ +import { renderBookOpenTextIcon24 } from '../../../../icons'; +import { renderButton } from '../../../../partials'; +import { insertIf } from '../../../../helpers'; + +export function renderWikiDisclaimer(kind: 'default' | 'error' | 'warning') { + const iconWrap = E('span', { + class: 'pdk_diagnostic-page__right-bar__wiki__icon', + }); + iconWrap.appendChild(renderBookOpenTextIcon24()); + + const className = [ + 'pdk_diagnostic-page__right-bar__wiki', + ...insertIf(kind === 'error', [ + 'pdk_diagnostic-page__right-bar__wiki--error', + ]), + ...insertIf(kind === 'warning', [ + 'pdk_diagnostic-page__right-bar__wiki--warning', + ]), + ].join(' '); + + return E('div', { class: className }, [ + E('div', { class: 'pdk_diagnostic-page__right-bar__wiki__content' }, [ + iconWrap, + E('div', { class: 'pdk_diagnostic-page__right-bar__wiki__texts' }, [ + E('b', {}, _('Troubleshooting')), + E('div', {}, _('Do not panic, everything can be fixed, just...')), + ]), + ]), + renderButton({ + classNames: ['cbi-button-save'], + text: _('Visit Wiki'), + onClick: () => + window.open( + 'https://podkop.net/docs/troubleshooting/', + '_blank', + 'noopener,noreferrer', + ), + }), + ]); +} diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/renderDiagnostic.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/renderDiagnostic.ts index 2b98d67..391e67f 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/renderDiagnostic.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/renderDiagnostic.ts @@ -8,6 +8,7 @@ export function render() { }), ]), E('div', { class: 'pdk_diagnostic-page__right-bar' }, [ + E('div', { id: 'pdk_diagnostic-page-wiki' }), E('div', { id: 'pdk_diagnostic-page-actions' }), E('div', { id: 'pdk_diagnostic-page-system-info' }), ]), diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/styles.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/styles.ts index 75a9042..def1d78 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/styles.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/styles.ts @@ -28,6 +28,31 @@ export const styles = ` grid-row-gap: 10px; } +.pdk_diagnostic-page__right-bar__wiki { + border: 2px var(--background-color-low, lightgray) solid; + border-radius: 4px; + padding: 10px; + + display: grid; + grid-template-columns: auto; + grid-row-gap: 10px; +} + +.pdk_diagnostic-page__right-bar__wiki--warning { + border: 2px var(--warn-color-medium, orange) solid; +} +.pdk_diagnostic-page__right-bar__wiki--error { + border: 2px var(--error-color-medium, red) solid; +} + +.pdk_diagnostic-page__right-bar__wiki__content { + display: grid; + grid-template-columns: 1fr 5fr; + grid-column-gap: 10px; +} + +.pdk_diagnostic-page__right-bar__wiki__texts {} + .pdk_diagnostic-page__right-bar__actions { border: 2px var(--background-color-low, lightgray) solid; border-radius: 4px; diff --git a/fe-app-podkop/src/validators/validateProxyUrl.ts b/fe-app-podkop/src/validators/validateProxyUrl.ts index 15a3003..912bbca 100644 --- a/fe-app-podkop/src/validators/validateProxyUrl.ts +++ b/fe-app-podkop/src/validators/validateProxyUrl.ts @@ -6,20 +6,22 @@ import { validateSocksUrl } from './validateSocksUrl'; // TODO refactor current validation and add tests export function validateProxyUrl(url: string): ValidationResult { - if (url.startsWith('ss://')) { - return validateShadowsocksUrl(url); + const trimmedUrl = url.trim(); + + if (trimmedUrl.startsWith('ss://')) { + return validateShadowsocksUrl(trimmedUrl); } - if (url.startsWith('vless://')) { - return validateVlessUrl(url); + if (trimmedUrl.startsWith('vless://')) { + return validateVlessUrl(trimmedUrl); } - if (url.startsWith('trojan://')) { - return validateTrojanUrl(url); + if (trimmedUrl.startsWith('trojan://')) { + return validateTrojanUrl(trimmedUrl); } - if (/^socks(4|4a|5):\/\//.test(url)) { - return validateSocksUrl(url); + if (/^socks(4|4a|5):\/\//.test(trimmedUrl)) { + return validateSocksUrl(trimmedUrl); } return { diff --git a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js index 0439e17..88812a8 100644 --- a/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js +++ b/luci-app-podkop/htdocs/luci-static/resources/view/podkop/main.js @@ -452,17 +452,18 @@ function validateSocksUrl(url) { // src/validators/validateProxyUrl.ts function validateProxyUrl(url) { - if (url.startsWith("ss://")) { - return validateShadowsocksUrl(url); + const trimmedUrl = url.trim(); + if (trimmedUrl.startsWith("ss://")) { + return validateShadowsocksUrl(trimmedUrl); } - if (url.startsWith("vless://")) { - return validateVlessUrl(url); + if (trimmedUrl.startsWith("vless://")) { + return validateVlessUrl(trimmedUrl); } - if (url.startsWith("trojan://")) { - return validateTrojanUrl(url); + if (trimmedUrl.startsWith("trojan://")) { + return validateTrojanUrl(trimmedUrl); } - if (/^socks(4|4a|5):\/\//.test(url)) { - return validateSocksUrl(url); + if (/^socks(4|4a|5):\/\//.test(trimmedUrl)) { + return validateSocksUrl(trimmedUrl); } return { valid: false, @@ -1087,7 +1088,7 @@ var loadingDiagnosticsChecksStore = { code: "DNS" /* DNS */, title: DIAGNOSTICS_CHECKS_MAP.DNS.title, order: DIAGNOSTICS_CHECKS_MAP.DNS.order, - description: _("Queued"), + description: _("Pending"), items: [], state: "skipped" }, @@ -1095,7 +1096,7 @@ var loadingDiagnosticsChecksStore = { code: "SINGBOX" /* SINGBOX */, title: DIAGNOSTICS_CHECKS_MAP.SINGBOX.title, order: DIAGNOSTICS_CHECKS_MAP.SINGBOX.order, - description: _("Queued"), + description: _("Pending"), items: [], state: "skipped" }, @@ -1103,7 +1104,7 @@ var loadingDiagnosticsChecksStore = { code: "NFT" /* NFT */, title: DIAGNOSTICS_CHECKS_MAP.NFT.title, order: DIAGNOSTICS_CHECKS_MAP.NFT.order, - description: _("Queued"), + description: _("Pending"), items: [], state: "skipped" }, @@ -1111,7 +1112,7 @@ var loadingDiagnosticsChecksStore = { code: "FAKEIP" /* FAKEIP */, title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title, order: DIAGNOSTICS_CHECKS_MAP.FAKEIP.order, - description: _("Queued"), + description: _("Pending"), items: [], state: "skipped" } @@ -2341,6 +2342,7 @@ function render2() { }) ]), E("div", { class: "pdk_diagnostic-page__right-bar" }, [ + E("div", { id: "pdk_diagnostic-page-wiki" }), E("div", { id: "pdk_diagnostic-page-actions" }), E("div", { id: "pdk_diagnostic-page-system-info" }) ]) @@ -2372,7 +2374,7 @@ function getMeta({ allGood, atLeastOneGood }) { if (atLeastOneGood) { return { state: "warning", - description: _("Checks partially passed") + description: _("Issues detected") }; } return { @@ -3195,6 +3197,34 @@ function renderSearchIcon24() { ); } +// src/icons/renderBookOpenTextIcon24.ts +function renderBookOpenTextIcon24() { + const NS = "http://www.w3.org/2000/svg"; + return svgEl( + "svg", + { + xmlns: NS, + viewBox: "0 0 24 24", + fill: "none", + stroke: "currentColor", + "stroke-width": "2", + "stroke-linecap": "round", + "stroke-linejoin": "round", + class: "lucide lucide-book-open-text-icon lucide-book-open-text" + }, + [ + svgEl("path", { d: "M12 7v14" }), + svgEl("path", { d: "M16 12h2" }), + svgEl("path", { d: "M16 8h2" }), + svgEl("path", { + d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z" + }), + svgEl("path", { d: "M6 12h2" }), + svgEl("path", { d: "M6 8h2" }) + ] + ); +} + // src/partials/button/renderButton.ts function renderButton({ classNames = [], @@ -3618,6 +3648,41 @@ function normalizeCompiledVersion(version) { return version; } +// src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts +function renderWikiDisclaimer(kind) { + const iconWrap = E("span", { + class: "pdk_diagnostic-page__right-bar__wiki__icon" + }); + iconWrap.appendChild(renderBookOpenTextIcon24()); + const className = [ + "pdk_diagnostic-page__right-bar__wiki", + ...insertIf(kind === "error", [ + "pdk_diagnostic-page__right-bar__wiki--error" + ]), + ...insertIf(kind === "warning", [ + "pdk_diagnostic-page__right-bar__wiki--warning" + ]) + ].join(" "); + return E("div", { class: className }, [ + E("div", { class: "pdk_diagnostic-page__right-bar__wiki__content" }, [ + iconWrap, + E("div", { class: "pdk_diagnostic-page__right-bar__wiki__texts" }, [ + E("b", {}, _("Troubleshooting")), + E("div", {}, _("Do not panic, everything can be fixed, just...")) + ]) + ]), + renderButton({ + classNames: ["cbi-button-save"], + text: _("Visit Wiki"), + onClick: () => window.open( + "https://podkop.net/docs/troubleshooting/", + "_blank", + "noopener,noreferrer" + ) + }) + ]); +} + // src/podkop/tabs/diagnostic/initController.ts async function fetchSystemInfo() { const systemInfo = await PodkopShellMethods.getSystemInfo(); @@ -3879,6 +3944,23 @@ async function handleShowSingBoxConfig() { }); } } +function renderWikiDisclaimerWidget() { + const diagnosticsChecks = store.get().diagnosticsChecks; + function getWikiKind() { + const allResults = diagnosticsChecks.map((check) => check.state); + if (allResults.includes("error")) { + return "error"; + } + if (allResults.includes("warning")) { + return "warning"; + } + return "default"; + } + const container = document.getElementById("pdk_diagnostic-page-wiki"); + return preserveScrollForPage(() => { + container.replaceChildren(renderWikiDisclaimer(getWikiKind())); + }); +} function renderDiagnosticAvailableActionsWidget() { const diagnosticsActions = store.get().diagnosticsActions; const servicesInfoWidget = store.get().servicesInfoWidget; @@ -4013,6 +4095,7 @@ function renderDiagnosticSystemInfoWidget() { async function onStoreUpdate2(next, prev, diff) { if (diff.diagnosticsChecks) { renderDiagnosticsChecks(); + renderWikiDisclaimerWidget(); } if (diff.diagnosticsRunAction) { renderDiagnosticRunActionWidget(); @@ -4047,6 +4130,7 @@ function onPageMount2() { renderDiagnosticRunActionWidget(); renderDiagnosticAvailableActionsWidget(); renderDiagnosticSystemInfoWidget(); + renderWikiDisclaimerWidget(); fetchServicesInfo(); fetchSystemInfo(); } @@ -4125,6 +4209,31 @@ var styles4 = ` grid-row-gap: 10px; } +.pdk_diagnostic-page__right-bar__wiki { + border: 2px var(--background-color-low, lightgray) solid; + border-radius: 4px; + padding: 10px; + + display: grid; + grid-template-columns: auto; + grid-row-gap: 10px; +} + +.pdk_diagnostic-page__right-bar__wiki--warning { + border: 2px var(--warn-color-medium, orange) solid; +} +.pdk_diagnostic-page__right-bar__wiki--error { + border: 2px var(--error-color-medium, red) solid; +} + +.pdk_diagnostic-page__right-bar__wiki__content { + display: grid; + grid-template-columns: 1fr 5fr; + grid-column-gap: 10px; +} + +.pdk_diagnostic-page__right-bar__wiki__texts {} + .pdk_diagnostic-page__right-bar__actions { border: 2px var(--background-color-low, lightgray) solid; border-radius: 4px; diff --git a/luci-app-podkop/po/ru/podkop.po b/luci-app-podkop/po/ru/podkop.po index 56cff1e..4c9f731 100644 --- a/luci-app-podkop/po/ru/podkop.po +++ b/luci-app-podkop/po/ru/podkop.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PODKOP\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-23 19:08+0300\n" -"PO-Revision-Date: 2025-10-23 19:08+0300\n" +"POT-Creation-Date: 2025-10-23 20:00+0300\n" +"PO-Revision-Date: 2025-10-23 20:00+0300\n" "Last-Translator: divocat\n" "Language-Team: none\n" "Language: ru\n" @@ -75,10 +75,7 @@ msgid "checks" msgstr "проверки" msgid "Checks failed" -msgstr "Проверки не пройдены" - -msgid "Checks partially passed" -msgstr "Проверки пройдены частично" +msgstr "Проверки не выполнены" msgid "Checks passed" msgstr "Проверки пройдены" @@ -164,6 +161,9 @@ msgstr "DNS-сервер" msgid "DNS server address cannot be empty" msgstr "Адрес DNS-сервера не может быть пустым" +msgid "Do not panic, everything can be fixed, just..." +msgstr "Не паникуйте, всё можно исправить, просто..." + msgid "Domain Resolver" msgstr "Резолвер доменов" @@ -350,6 +350,9 @@ msgstr "Неверный URL VLESS: ошибка разбора" msgid "IP address 0.0.0.0 is not allowed" msgstr "IP-адрес 0.0.0.0 не допускается" +msgid "Issues detected" +msgstr "Обнаружены проблемы" + msgid "Latest" msgstr "Последняя" @@ -416,6 +419,9 @@ msgstr "Путь должен содержать хотя бы одну дире msgid "Path must end with cache.db" msgstr "Путь должен заканчиваться на cache.db" +msgid "Pending" +msgstr "Ожидает запуска" + msgid "Podkop" msgstr "Podkop" @@ -434,9 +440,6 @@ msgstr "Прокси-трафик не маршрутизируется чере msgid "Proxy traffic is routed via FakeIP" msgstr "Прокси-трафик направляется через FakeIP" -msgid "Queued" -msgstr "В очереди" - msgid "Regional options cannot be used together" msgstr "Нельзя использовать несколько региональных опций одновременно" @@ -617,6 +620,9 @@ msgstr "Трафик" msgid "Traffic Total" msgstr "Всего трафика" +msgid "Troubleshooting" +msgstr "Устранение неполадок" + msgid "TTL must be a positive number" msgstr "TTL должно быть положительным числом" @@ -677,6 +683,9 @@ msgstr "Ошибки валидации:" msgid "View logs" msgstr "Посмотреть логи" +msgid "Visit Wiki" +msgstr "Перейти в wiki" + msgid "Warning: %s cannot be used together with %s. Previous selections have been removed." msgstr "Предупреждение: %s нельзя использовать вместе с %s. Предыдущие варианты были удалены." diff --git a/luci-app-podkop/po/templates/podkop.pot b/luci-app-podkop/po/templates/podkop.pot index 2b6b460..e72e2a9 100644 --- a/luci-app-podkop/po/templates/podkop.pot +++ b/luci-app-podkop/po/templates/podkop.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PODKOP\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-10-23 16:08+0300\n" -"PO-Revision-Date: 2025-10-23 16:08+0300\n" +"POT-Creation-Date: 2025-10-23 17:00+0300\n" +"PO-Revision-Date: 2025-10-23 17:00+0300\n" "Last-Translator: divocat \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -101,10 +101,6 @@ msgstr "" msgid "Checks failed" msgstr "" -#: src/podkop/tabs/diagnostic/helpers/getMeta.ts:20 -msgid "Checks partially passed" -msgstr "" - #: src/podkop/tabs/diagnostic/helpers/getMeta.ts:13 msgid "Checks passed" msgstr "" @@ -222,6 +218,10 @@ msgstr "" msgid "DNS server address cannot be empty" msgstr "" +#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:26 +msgid "Do not panic, everything can be fixed, just..." +msgstr "" + #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:166 msgid "Domain Resolver" msgstr "" @@ -312,12 +312,12 @@ msgstr "" msgid "Failed to copy!" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:225 -#: src/podkop/tabs/diagnostic/initController.ts:229 -#: src/podkop/tabs/diagnostic/initController.ts:259 -#: src/podkop/tabs/diagnostic/initController.ts:263 -#: src/podkop/tabs/diagnostic/initController.ts:297 -#: src/podkop/tabs/diagnostic/initController.ts:301 +#: src/podkop/tabs/diagnostic/initController.ts:226 +#: src/podkop/tabs/diagnostic/initController.ts:230 +#: src/podkop/tabs/diagnostic/initController.ts:260 +#: src/podkop/tabs/diagnostic/initController.ts:264 +#: src/podkop/tabs/diagnostic/initController.ts:298 +#: src/podkop/tabs/diagnostic/initController.ts:302 msgid "Failed to execute!" msgstr "" @@ -333,7 +333,7 @@ msgstr "" msgid "Get global check" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:220 +#: src/podkop/tabs/diagnostic/initController.ts:221 msgid "Global check" msgstr "" @@ -478,7 +478,11 @@ msgstr "" msgid "IP address 0.0.0.0 is not allowed" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:427 +#: src/podkop/tabs/diagnostic/helpers/getMeta.ts:20 +msgid "Issues detected" +msgstr "" + +#: src/podkop/tabs/diagnostic/initController.ts:452 msgid "Latest" msgstr "" @@ -545,7 +549,7 @@ msgstr "" msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:417 +#: src/podkop/tabs/diagnostic/initController.ts:442 msgid "Outdated" msgstr "" @@ -569,6 +573,13 @@ msgstr "" msgid "Path must end with cache.db" msgstr "" +#: src/podkop/tabs/diagnostic/diagnostic.store.ts:95 +#: src/podkop/tabs/diagnostic/diagnostic.store.ts:103 +#: src/podkop/tabs/diagnostic/diagnostic.store.ts:111 +#: src/podkop/tabs/diagnostic/diagnostic.store.ts:119 +msgid "Pending" +msgstr "" + #: src/podkop/tabs/dashboard/initController.ts:340 msgid "Podkop" msgstr "" @@ -593,13 +604,6 @@ msgstr "" msgid "Proxy traffic is routed via FakeIP" msgstr "" -#: src/podkop/tabs/diagnostic/diagnostic.store.ts:95 -#: src/podkop/tabs/diagnostic/diagnostic.store.ts:103 -#: src/podkop/tabs/diagnostic/diagnostic.store.ts:111 -#: src/podkop/tabs/diagnostic/diagnostic.store.ts:119 -msgid "Queued" -msgstr "" - #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:245 msgid "Regional options cannot be used together" msgstr "" @@ -733,7 +737,7 @@ msgstr "" msgid "Settings" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:288 +#: src/podkop/tabs/diagnostic/initController.ts:289 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116 msgid "Show sing-box config" msgstr "" @@ -843,6 +847,10 @@ msgstr "" msgid "Traffic Total" msgstr "" +#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:25 +msgid "Troubleshooting" +msgstr "" + #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/settings.js:80 msgid "TTL must be a positive number" msgstr "" @@ -860,13 +868,13 @@ msgstr "" msgid "UDP over TCP" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:36 #: src/podkop/tabs/diagnostic/initController.ts:37 #: src/podkop/tabs/diagnostic/initController.ts:38 #: src/podkop/tabs/diagnostic/initController.ts:39 #: src/podkop/tabs/diagnostic/initController.ts:40 #: src/podkop/tabs/diagnostic/initController.ts:41 -#: src/podkop/tabs/diagnostic/initController.ts:391 +#: src/podkop/tabs/diagnostic/initController.ts:42 +#: src/podkop/tabs/diagnostic/initController.ts:416 msgid "unknown" msgstr "" @@ -879,7 +887,7 @@ msgstr "" msgid "Uplink" msgstr "" -#: src/validators/validateProxyUrl.ts:27 +#: src/validators/validateProxyUrl.ts:29 msgid "URL must start with vless://, ss://, trojan://, or socks4/5://" msgstr "" @@ -940,11 +948,15 @@ msgstr "" msgid "Validation errors:" msgstr "" -#: src/podkop/tabs/diagnostic/initController.ts:254 +#: src/podkop/tabs/diagnostic/initController.ts:255 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107 msgid "View logs" msgstr "" +#: src/podkop/tabs/diagnostic/partials/renderWikiDisclaimer.ts:31 +msgid "Visit Wiki" +msgstr "" + #: ../luci-app-podkop/htdocs/luci-static/resources/view/podkop/section.js:247 msgid "Warning: %s cannot be used together with %s. Previous selections have been removed." msgstr ""