Merge pull request #230 from itdoginfo/feat/diagnostic-outbound-check

Add outbound check to diagnostic
This commit is contained in:
Kirill Sobakin
2025-10-26 09:27:09 +03:00
committed by GitHub
12 changed files with 390 additions and 70 deletions

View File

@@ -117,6 +117,7 @@
"places": [ "places": [
"src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:27", "src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:27",
"src/podkop/tabs/diagnostic/checks/runNftCheck.ts:28", "src/podkop/tabs/diagnostic/checks/runNftCheck.ts:28",
"src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:27",
"src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:25" "src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:25"
] ]
}, },
@@ -127,6 +128,7 @@
"src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:15", "src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:15",
"src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts:15", "src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts:15",
"src/podkop/tabs/diagnostic/checks/runNftCheck.ts:13", "src/podkop/tabs/diagnostic/checks/runNftCheck.ts:13",
"src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:15",
"src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:13" "src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:13"
] ]
}, },
@@ -512,12 +514,12 @@
"call": "Failed to execute!", "call": "Failed to execute!",
"key": "Failed to execute!", "key": "Failed to execute!",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:226", "src/podkop/tabs/diagnostic/initController.ts:227",
"src/podkop/tabs/diagnostic/initController.ts:230", "src/podkop/tabs/diagnostic/initController.ts:231",
"src/podkop/tabs/diagnostic/initController.ts:260", "src/podkop/tabs/diagnostic/initController.ts:261",
"src/podkop/tabs/diagnostic/initController.ts:264", "src/podkop/tabs/diagnostic/initController.ts:265",
"src/podkop/tabs/diagnostic/initController.ts:298", "src/podkop/tabs/diagnostic/initController.ts:299",
"src/podkop/tabs/diagnostic/initController.ts:302" "src/podkop/tabs/diagnostic/initController.ts:303"
] ]
}, },
{ {
@@ -545,7 +547,7 @@
"call": "Global check", "call": "Global check",
"key": "Global check", "key": "Global check",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:221" "src/podkop/tabs/diagnostic/initController.ts:222"
] ]
}, },
{ {
@@ -805,7 +807,7 @@
"call": "Latest", "call": "Latest",
"key": "Latest", "key": "Latest",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:452" "src/podkop/tabs/diagnostic/initController.ts:453"
] ]
}, },
{ {
@@ -878,6 +880,14 @@
"src/podkop/tabs/diagnostic/partials/renderCheckSection.ts:189" "src/podkop/tabs/diagnostic/partials/renderCheckSection.ts:189"
] ]
}, },
{
"call": "Not responding",
"key": "Not responding",
"places": [
"src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:59",
"src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:79"
]
},
{ {
"call": "Not running", "call": "Not running",
"key": "Not running", "key": "Not running",
@@ -885,7 +895,8 @@
"src/podkop/tabs/diagnostic/diagnostic.store.ts:55", "src/podkop/tabs/diagnostic/diagnostic.store.ts:55",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:63", "src/podkop/tabs/diagnostic/diagnostic.store.ts:63",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:71", "src/podkop/tabs/diagnostic/diagnostic.store.ts:71",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:79" "src/podkop/tabs/diagnostic/diagnostic.store.ts:79",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:87"
] ]
}, },
{ {
@@ -920,7 +931,7 @@
"call": "Outdated", "call": "Outdated",
"key": "Outdated", "key": "Outdated",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:442" "src/podkop/tabs/diagnostic/initController.ts:443"
] ]
}, },
{ {
@@ -962,10 +973,11 @@
"call": "Pending", "call": "Pending",
"key": "Pending", "key": "Pending",
"places": [ "places": [
"src/podkop/tabs/diagnostic/diagnostic.store.ts:95",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:103", "src/podkop/tabs/diagnostic/diagnostic.store.ts:103",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:111", "src/podkop/tabs/diagnostic/diagnostic.store.ts:111",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:119" "src/podkop/tabs/diagnostic/diagnostic.store.ts:119",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:127",
"src/podkop/tabs/diagnostic/diagnostic.store.ts:135"
] ]
}, },
{ {
@@ -1246,7 +1258,7 @@
"call": "Show sing-box config", "call": "Show sing-box config",
"key": "Show sing-box config", "key": "Show sing-box config",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:289", "src/podkop/tabs/diagnostic/initController.ts:290",
"src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116" "src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116"
] ]
}, },
@@ -1473,13 +1485,13 @@
"call": "unknown", "call": "unknown",
"key": "unknown", "key": "unknown",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:37",
"src/podkop/tabs/diagnostic/initController.ts:38", "src/podkop/tabs/diagnostic/initController.ts:38",
"src/podkop/tabs/diagnostic/initController.ts:39", "src/podkop/tabs/diagnostic/initController.ts:39",
"src/podkop/tabs/diagnostic/initController.ts:40", "src/podkop/tabs/diagnostic/initController.ts:40",
"src/podkop/tabs/diagnostic/initController.ts:41", "src/podkop/tabs/diagnostic/initController.ts:41",
"src/podkop/tabs/diagnostic/initController.ts:42", "src/podkop/tabs/diagnostic/initController.ts:42",
"src/podkop/tabs/diagnostic/initController.ts:416" "src/podkop/tabs/diagnostic/initController.ts:43",
"src/podkop/tabs/diagnostic/initController.ts:417"
] ]
}, },
{ {
@@ -1598,7 +1610,7 @@
"call": "View logs", "call": "View logs",
"key": "View logs", "key": "View logs",
"places": [ "places": [
"src/podkop/tabs/diagnostic/initController.ts:255", "src/podkop/tabs/diagnostic/initController.ts:256",
"src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107" "src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107"
] ]
}, },

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PODKOP\n" "Project-Id-Version: PODKOP\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-23 17:43+0300\n" "POT-Creation-Date: 2025-10-25 22:08+0300\n"
"PO-Revision-Date: 2025-10-23 17:43+0300\n" "PO-Revision-Date: 2025-10-25 22:08+0300\n"
"Last-Translator: divocat <divocatt@gmail.com>\n" "Last-Translator: divocat <divocatt@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
@@ -82,6 +82,7 @@ msgstr ""
#: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:27 #: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:27
#: src/podkop/tabs/diagnostic/checks/runNftCheck.ts:28 #: src/podkop/tabs/diagnostic/checks/runNftCheck.ts:28
#: src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:27
#: src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:25 #: src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:25
msgid "Cannot receive checks result" msgid "Cannot receive checks result"
msgstr "" msgstr ""
@@ -89,6 +90,7 @@ msgstr ""
#: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:15 #: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:15
#: src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts:15 #: src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts:15
#: src/podkop/tabs/diagnostic/checks/runNftCheck.ts:13 #: src/podkop/tabs/diagnostic/checks/runNftCheck.ts:13
#: src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:15
#: src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:13 #: src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:13
msgid "Checking, please wait" msgid "Checking, please wait"
msgstr "" msgstr ""
@@ -312,12 +314,12 @@ msgstr ""
msgid "Failed to copy!" msgid "Failed to copy!"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:226 #: src/podkop/tabs/diagnostic/initController.ts:227
#: src/podkop/tabs/diagnostic/initController.ts:230 #: src/podkop/tabs/diagnostic/initController.ts:231
#: src/podkop/tabs/diagnostic/initController.ts:260 #: src/podkop/tabs/diagnostic/initController.ts:261
#: src/podkop/tabs/diagnostic/initController.ts:264 #: src/podkop/tabs/diagnostic/initController.ts:265
#: src/podkop/tabs/diagnostic/initController.ts:298 #: src/podkop/tabs/diagnostic/initController.ts:299
#: src/podkop/tabs/diagnostic/initController.ts:302 #: src/podkop/tabs/diagnostic/initController.ts:303
msgid "Failed to execute!" msgid "Failed to execute!"
msgstr "" msgstr ""
@@ -333,7 +335,7 @@ msgstr ""
msgid "Get global check" msgid "Get global check"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:221 #: src/podkop/tabs/diagnostic/initController.ts:222
msgid "Global check" msgid "Global check"
msgstr "" msgstr ""
@@ -482,7 +484,7 @@ msgstr ""
msgid "Issues detected" msgid "Issues detected"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:452 #: src/podkop/tabs/diagnostic/initController.ts:453
msgid "Latest" msgid "Latest"
msgstr "" msgstr ""
@@ -526,10 +528,16 @@ msgstr ""
msgid "Not implement yet" msgid "Not implement yet"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:59
#: src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:79
msgid "Not responding"
msgstr ""
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:55 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:55
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:63 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:63
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:71 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:71
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:79 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:79
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:87
msgid "Not running" msgid "Not running"
msgstr "" msgstr ""
@@ -549,7 +557,7 @@ msgstr ""
msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields" msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:442 #: src/podkop/tabs/diagnostic/initController.ts:443
msgid "Outdated" msgid "Outdated"
msgstr "" msgstr ""
@@ -573,10 +581,11 @@ msgstr ""
msgid "Path must end with cache.db" msgid "Path must end with cache.db"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:95
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:103 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:103
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:111 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:111
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:119 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:119
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:127
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:135
msgid "Pending" msgid "Pending"
msgstr "" msgstr ""
@@ -737,7 +746,7 @@ msgstr ""
msgid "Settings" msgid "Settings"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:289 #: src/podkop/tabs/diagnostic/initController.ts:290
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116
msgid "Show sing-box config" msgid "Show sing-box config"
msgstr "" msgstr ""
@@ -868,13 +877,13 @@ msgstr ""
msgid "UDP over TCP" msgid "UDP over TCP"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:37
#: src/podkop/tabs/diagnostic/initController.ts:38 #: src/podkop/tabs/diagnostic/initController.ts:38
#: src/podkop/tabs/diagnostic/initController.ts:39 #: src/podkop/tabs/diagnostic/initController.ts:39
#: src/podkop/tabs/diagnostic/initController.ts:40 #: src/podkop/tabs/diagnostic/initController.ts:40
#: src/podkop/tabs/diagnostic/initController.ts:41 #: src/podkop/tabs/diagnostic/initController.ts:41
#: src/podkop/tabs/diagnostic/initController.ts:42 #: src/podkop/tabs/diagnostic/initController.ts:42
#: src/podkop/tabs/diagnostic/initController.ts:416 #: src/podkop/tabs/diagnostic/initController.ts:43
#: src/podkop/tabs/diagnostic/initController.ts:417
msgid "unknown" msgid "unknown"
msgstr "" msgstr ""
@@ -948,7 +957,7 @@ msgstr ""
msgid "Validation errors:" msgid "Validation errors:"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:255 #: src/podkop/tabs/diagnostic/initController.ts:256
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107
msgid "View logs" msgid "View logs"
msgstr "" msgstr ""

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PODKOP\n" "Project-Id-Version: PODKOP\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-23 20:43+0300\n" "POT-Creation-Date: 2025-10-25 01:08+0300\n"
"PO-Revision-Date: 2025-10-23 20:43+0300\n" "PO-Revision-Date: 2025-10-25 01:08+0300\n"
"Last-Translator: divocat\n" "Last-Translator: divocat\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: ru\n" "Language: ru\n"
@@ -386,6 +386,9 @@ msgstr "Другие правила маркировки не найдены"
msgid "Not implement yet" msgid "Not implement yet"
msgstr "Ещё не реализовано" msgstr "Ещё не реализовано"
msgid "Not responding"
msgstr "Не отвечает"
msgid "Not running" msgid "Not running"
msgstr "Не запущено" msgstr "Не запущено"

View File

@@ -29,15 +29,15 @@ export const PodkopShellMethods = {
Podkop.AvailableClashAPIMethods.GET_PROXIES, Podkop.AvailableClashAPIMethods.GET_PROXIES,
]), ]),
getClashApiProxyLatency: async (tag: string) => getClashApiProxyLatency: async (tag: string) =>
callBaseMethod<unknown>(Podkop.AvailableMethods.CLASH_API, [ callBaseMethod<Podkop.GetClashApiProxyLatency>(
Podkop.AvailableClashAPIMethods.GET_PROXY_LATENCY, Podkop.AvailableMethods.CLASH_API,
tag, [Podkop.AvailableClashAPIMethods.GET_PROXY_LATENCY, tag],
]), ),
getClashApiGroupLatency: async (tag: string) => getClashApiGroupLatency: async (tag: string) =>
callBaseMethod<unknown>(Podkop.AvailableMethods.CLASH_API, [ callBaseMethod<Podkop.GetClashApiGroupLatency>(
Podkop.AvailableClashAPIMethods.GET_GROUP_LATENCY, Podkop.AvailableMethods.CLASH_API,
tag, [Podkop.AvailableClashAPIMethods.GET_GROUP_LATENCY, tag],
]), ),
setClashApiGroupProxy: async (group: string, proxy: string) => setClashApiGroupProxy: async (group: string, proxy: string) =>
callBaseMethod<unknown>(Podkop.AvailableMethods.CLASH_API, [ callBaseMethod<unknown>(Podkop.AvailableMethods.CLASH_API, [
Podkop.AvailableClashAPIMethods.SET_GROUP_PROXY, Podkop.AvailableClashAPIMethods.SET_GROUP_PROXY,

View File

@@ -5,6 +5,7 @@ export enum DIAGNOSTICS_CHECKS {
SINGBOX = 'SINGBOX', SINGBOX = 'SINGBOX',
NFT = 'NFT', NFT = 'NFT',
FAKEIP = 'FAKEIP', FAKEIP = 'FAKEIP',
OUTBOUNDS = 'OUTBOUNDS',
} }
export const DIAGNOSTICS_CHECKS_MAP: Record< export const DIAGNOSTICS_CHECKS_MAP: Record<
@@ -26,8 +27,13 @@ export const DIAGNOSTICS_CHECKS_MAP: Record<
title: getCheckTitle('Nftables'), title: getCheckTitle('Nftables'),
code: DIAGNOSTICS_CHECKS.NFT, code: DIAGNOSTICS_CHECKS.NFT,
}, },
[DIAGNOSTICS_CHECKS.FAKEIP]: { [DIAGNOSTICS_CHECKS.OUTBOUNDS]: {
order: 4, order: 4,
title: getCheckTitle('Outbounds'),
code: DIAGNOSTICS_CHECKS.OUTBOUNDS,
},
[DIAGNOSTICS_CHECKS.FAKEIP]: {
order: 5,
title: getCheckTitle('FakeIP'), title: getCheckTitle('FakeIP'),
code: DIAGNOSTICS_CHECKS.FAKEIP, code: DIAGNOSTICS_CHECKS.FAKEIP,
}, },

View File

@@ -0,0 +1,131 @@
import { DIAGNOSTICS_CHECKS_MAP } from './contstants';
import { PodkopShellMethods } from '../../../methods';
import { updateCheckStore } from './updateCheckStore';
import { getMeta } from '../helpers/getMeta';
import { getDashboardSections } from '../../../methods/custom/getDashboardSections';
import { IDiagnosticsChecksItem } from '../../../services';
export async function runSectionsCheck() {
const { order, title, code } = DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS;
updateCheckStore({
order,
code,
title,
description: _('Checking, please wait'),
state: 'loading',
items: [],
});
const sections = await getDashboardSections();
if (!sections.success) {
updateCheckStore({
order,
code,
title,
description: _('Cannot receive checks result'),
state: 'error',
items: [],
});
throw new Error('Sections checks failed');
}
const items = (await Promise.all(
sections.data.map(async (section) => {
async function getLatency() {
if (section.withTagSelect) {
const latencyGroup = await PodkopShellMethods.getClashApiGroupLatency(
section.code,
);
const selectedOutbound = section.outbounds.find(
(item) => item.selected,
);
const isUrlTest = selectedOutbound?.type === 'URLTest';
const success = latencyGroup.success && !latencyGroup.data.message;
if (success) {
if (isUrlTest) {
const latency = Object.values(latencyGroup.data)
.map((item) => (item ? `${item}ms` : 'n/a'))
.join(' / ');
return {
success: true,
latency: `[${_('Fastest')}] ${latency}`,
};
}
const selectedProxyDelay =
latencyGroup.data?.[selectedOutbound?.code ?? ''];
if (selectedProxyDelay) {
return {
success: true,
latency: `[${selectedOutbound?.code ?? ''}] ${selectedProxyDelay}ms`,
};
}
return {
success: false,
latency: `[${selectedOutbound?.code ?? ''}] ${_('Not responding')}`,
};
}
return {
success: false,
latency: _('Not responding'),
};
}
const latencyProxy = await PodkopShellMethods.getClashApiProxyLatency(
section.code,
);
const success = latencyProxy.success && !latencyProxy.data.message;
if (success) {
return {
success: true,
latency: `${latencyProxy.data.delay} ms`,
};
}
return {
success: false,
latency: _('Not responding'),
};
}
const { latency, success } = await getLatency();
return {
state: success ? 'success' : 'error',
key: section.displayName,
value: latency,
};
}),
)) as Array<IDiagnosticsChecksItem>;
const allGood = items.every((item) => item.state === 'success');
const atLeastOneGood = items.some((item) => item.state === 'success');
const { state, description } = getMeta({ atLeastOneGood, allGood });
updateCheckStore({
order,
code,
title,
description,
state,
items,
});
if (!atLeastOneGood) {
throw new Error('Sections checks failed');
}
}

View File

@@ -72,6 +72,14 @@ export const initialDiagnosticStore: Pick<
items: [], items: [],
state: 'skipped', state: 'skipped',
}, },
{
code: DIAGNOSTICS_CHECKS.OUTBOUNDS,
title: DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS.title,
order: DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS.order,
description: _('Not running'),
items: [],
state: 'skipped',
},
{ {
code: DIAGNOSTICS_CHECKS.FAKEIP, code: DIAGNOSTICS_CHECKS.FAKEIP,
title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title, title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title,
@@ -112,6 +120,14 @@ export const loadingDiagnosticsChecksStore: Pick<
items: [], items: [],
state: 'skipped', state: 'skipped',
}, },
{
code: DIAGNOSTICS_CHECKS.OUTBOUNDS,
title: DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS.title,
order: DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS.order,
description: _('Pending'),
items: [],
state: 'skipped',
},
{ {
code: DIAGNOSTICS_CHECKS.FAKEIP, code: DIAGNOSTICS_CHECKS.FAKEIP,
title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title, title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title,

View File

@@ -19,6 +19,7 @@ import { renderModal } from '../../../partials';
import { PODKOP_LUCI_APP_VERSION } from '../../../constants'; import { PODKOP_LUCI_APP_VERSION } from '../../../constants';
import { showToast } from '../../../helpers/showToast'; import { showToast } from '../../../helpers/showToast';
import { renderWikiDisclaimer } from './partials/renderWikiDisclaimer'; import { renderWikiDisclaimer } from './partials/renderWikiDisclaimer';
import { runSectionsCheck } from './checks/runSectionsCheck';
async function fetchSystemInfo() { async function fetchSystemInfo() {
const systemInfo = await PodkopShellMethods.getSystemInfo(); const systemInfo = await PodkopShellMethods.getSystemInfo();
@@ -518,6 +519,8 @@ async function runChecks() {
await runNftCheck(); await runNftCheck();
await runSectionsCheck();
await runFakeIPCheck(); await runFakeIPCheck();
} catch (e) { } catch (e) {
logger.error('[DIAGNOSTIC]', 'runChecks - e', e); logger.error('[DIAGNOSTIC]', 'runChecks - e', e);

View File

@@ -196,4 +196,11 @@ export namespace Podkop {
openwrt_version: string; openwrt_version: string;
device_model: string; device_model: string;
} }
export interface GetClashApiProxyLatency {
delay: number;
message?: string;
}
export type GetClashApiGroupLatency = Record<string, number>;
} }

View File

@@ -563,14 +563,14 @@ var PodkopShellMethods = {
getClashApiProxies: async () => callBaseMethod(Podkop.AvailableMethods.CLASH_API, [ getClashApiProxies: async () => callBaseMethod(Podkop.AvailableMethods.CLASH_API, [
Podkop.AvailableClashAPIMethods.GET_PROXIES Podkop.AvailableClashAPIMethods.GET_PROXIES
]), ]),
getClashApiProxyLatency: async (tag) => callBaseMethod(Podkop.AvailableMethods.CLASH_API, [ getClashApiProxyLatency: async (tag) => callBaseMethod(
Podkop.AvailableClashAPIMethods.GET_PROXY_LATENCY, Podkop.AvailableMethods.CLASH_API,
tag [Podkop.AvailableClashAPIMethods.GET_PROXY_LATENCY, tag]
]), ),
getClashApiGroupLatency: async (tag) => callBaseMethod(Podkop.AvailableMethods.CLASH_API, [ getClashApiGroupLatency: async (tag) => callBaseMethod(
Podkop.AvailableClashAPIMethods.GET_GROUP_LATENCY, Podkop.AvailableMethods.CLASH_API,
tag [Podkop.AvailableClashAPIMethods.GET_GROUP_LATENCY, tag]
]), ),
setClashApiGroupProxy: async (group, proxy) => callBaseMethod(Podkop.AvailableMethods.CLASH_API, [ setClashApiGroupProxy: async (group, proxy) => callBaseMethod(Podkop.AvailableMethods.CLASH_API, [
Podkop.AvailableClashAPIMethods.SET_GROUP_PROXY, Podkop.AvailableClashAPIMethods.SET_GROUP_PROXY,
group, group,
@@ -1004,8 +1004,13 @@ var DIAGNOSTICS_CHECKS_MAP = {
title: getCheckTitle("Nftables"), title: getCheckTitle("Nftables"),
code: "NFT" /* NFT */ code: "NFT" /* NFT */
}, },
["FAKEIP" /* FAKEIP */]: { ["OUTBOUNDS" /* OUTBOUNDS */]: {
order: 4, order: 4,
title: getCheckTitle("Outbounds"),
code: "OUTBOUNDS" /* OUTBOUNDS */
},
["FAKEIP" /* FAKEIP */]: {
order: 5,
title: getCheckTitle("FakeIP"), title: getCheckTitle("FakeIP"),
code: "FAKEIP" /* FAKEIP */ code: "FAKEIP" /* FAKEIP */
} }
@@ -1074,6 +1079,14 @@ var initialDiagnosticStore = {
items: [], items: [],
state: "skipped" state: "skipped"
}, },
{
code: "OUTBOUNDS" /* OUTBOUNDS */,
title: DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS.title,
order: DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS.order,
description: _("Not running"),
items: [],
state: "skipped"
},
{ {
code: "FAKEIP" /* FAKEIP */, code: "FAKEIP" /* FAKEIP */,
title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title, title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title,
@@ -1110,6 +1123,14 @@ var loadingDiagnosticsChecksStore = {
items: [], items: [],
state: "skipped" state: "skipped"
}, },
{
code: "OUTBOUNDS" /* OUTBOUNDS */,
title: DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS.title,
order: DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS.order,
description: _("Pending"),
items: [],
state: "skipped"
},
{ {
code: "FAKEIP" /* FAKEIP */, code: "FAKEIP" /* FAKEIP */,
title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title, title: DIAGNOSTICS_CHECKS_MAP.FAKEIP.title,
@@ -3685,6 +3706,105 @@ function renderWikiDisclaimer(kind) {
]); ]);
} }
// src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts
async function runSectionsCheck() {
const { order, title, code } = DIAGNOSTICS_CHECKS_MAP.OUTBOUNDS;
updateCheckStore({
order,
code,
title,
description: _("Checking, please wait"),
state: "loading",
items: []
});
const sections = await getDashboardSections();
if (!sections.success) {
updateCheckStore({
order,
code,
title,
description: _("Cannot receive checks result"),
state: "error",
items: []
});
throw new Error("Sections checks failed");
}
const items = await Promise.all(
sections.data.map(async (section) => {
async function getLatency() {
if (section.withTagSelect) {
const latencyGroup = await PodkopShellMethods.getClashApiGroupLatency(
section.code
);
const selectedOutbound = section.outbounds.find(
(item) => item.selected
);
const isUrlTest = selectedOutbound?.type === "URLTest";
const success3 = latencyGroup.success && !latencyGroup.data.message;
if (success3) {
if (isUrlTest) {
const latency2 = Object.values(latencyGroup.data).map((item) => item ? `${item}ms` : "n/a").join(" / ");
return {
success: true,
latency: `[${_("Fastest")}] ${latency2}`
};
}
const selectedProxyDelay = latencyGroup.data?.[selectedOutbound?.code ?? ""];
if (selectedProxyDelay) {
return {
success: true,
latency: `[${selectedOutbound?.code ?? ""}] ${selectedProxyDelay}ms`
};
}
return {
success: false,
latency: `[${selectedOutbound?.code ?? ""}] ${_("Not responding")}`
};
}
return {
success: false,
latency: _("Not responding")
};
}
const latencyProxy = await PodkopShellMethods.getClashApiProxyLatency(
section.code
);
const success2 = latencyProxy.success && !latencyProxy.data.message;
if (success2) {
return {
success: true,
latency: `${latencyProxy.data.delay} ms`
};
}
return {
success: false,
latency: _("Not responding")
};
}
const { latency, success } = await getLatency();
return {
state: success ? "success" : "error",
key: section.displayName,
value: latency
};
})
);
const allGood = items.every((item) => item.state === "success");
const atLeastOneGood = items.some((item) => item.state === "success");
const { state, description } = getMeta({ atLeastOneGood, allGood });
updateCheckStore({
order,
code,
title,
description,
state,
items
});
if (!atLeastOneGood) {
throw new Error("Sections checks failed");
}
}
// src/podkop/tabs/diagnostic/initController.ts // src/podkop/tabs/diagnostic/initController.ts
async function fetchSystemInfo() { async function fetchSystemInfo() {
const systemInfo = await PodkopShellMethods.getSystemInfo(); const systemInfo = await PodkopShellMethods.getSystemInfo();
@@ -4118,6 +4238,7 @@ async function runChecks() {
await runDnsCheck(); await runDnsCheck();
await runSingBoxCheck(); await runSingBoxCheck();
await runNftCheck(); await runNftCheck();
await runSectionsCheck();
await runFakeIPCheck(); await runFakeIPCheck();
} catch (e) { } catch (e) {
logger.error("[DIAGNOSTIC]", "runChecks - e", e); logger.error("[DIAGNOSTIC]", "runChecks - e", e);

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PODKOP\n" "Project-Id-Version: PODKOP\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-23 20:43+0300\n" "POT-Creation-Date: 2025-10-25 01:08+0300\n"
"PO-Revision-Date: 2025-10-23 20:43+0300\n" "PO-Revision-Date: 2025-10-25 01:08+0300\n"
"Last-Translator: divocat\n" "Last-Translator: divocat\n"
"Language-Team: none\n" "Language-Team: none\n"
"Language: ru\n" "Language: ru\n"
@@ -386,6 +386,9 @@ msgstr "Другие правила маркировки не найдены"
msgid "Not implement yet" msgid "Not implement yet"
msgstr "Ещё не реализовано" msgstr "Ещё не реализовано"
msgid "Not responding"
msgstr "Не отвечает"
msgid "Not running" msgid "Not running"
msgstr "Не запущено" msgstr "Не запущено"

View File

@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PODKOP\n" "Project-Id-Version: PODKOP\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-23 17:43+0300\n" "POT-Creation-Date: 2025-10-25 22:08+0300\n"
"PO-Revision-Date: 2025-10-23 17:43+0300\n" "PO-Revision-Date: 2025-10-25 22:08+0300\n"
"Last-Translator: divocat <divocatt@gmail.com>\n" "Last-Translator: divocat <divocatt@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n" "Language: \n"
@@ -82,6 +82,7 @@ msgstr ""
#: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:27 #: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:27
#: src/podkop/tabs/diagnostic/checks/runNftCheck.ts:28 #: src/podkop/tabs/diagnostic/checks/runNftCheck.ts:28
#: src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:27
#: src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:25 #: src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:25
msgid "Cannot receive checks result" msgid "Cannot receive checks result"
msgstr "" msgstr ""
@@ -89,6 +90,7 @@ msgstr ""
#: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:15 #: src/podkop/tabs/diagnostic/checks/runDnsCheck.ts:15
#: src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts:15 #: src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts:15
#: src/podkop/tabs/diagnostic/checks/runNftCheck.ts:13 #: src/podkop/tabs/diagnostic/checks/runNftCheck.ts:13
#: src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:15
#: src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:13 #: src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts:13
msgid "Checking, please wait" msgid "Checking, please wait"
msgstr "" msgstr ""
@@ -312,12 +314,12 @@ msgstr ""
msgid "Failed to copy!" msgid "Failed to copy!"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:226 #: src/podkop/tabs/diagnostic/initController.ts:227
#: src/podkop/tabs/diagnostic/initController.ts:230 #: src/podkop/tabs/diagnostic/initController.ts:231
#: src/podkop/tabs/diagnostic/initController.ts:260 #: src/podkop/tabs/diagnostic/initController.ts:261
#: src/podkop/tabs/diagnostic/initController.ts:264 #: src/podkop/tabs/diagnostic/initController.ts:265
#: src/podkop/tabs/diagnostic/initController.ts:298 #: src/podkop/tabs/diagnostic/initController.ts:299
#: src/podkop/tabs/diagnostic/initController.ts:302 #: src/podkop/tabs/diagnostic/initController.ts:303
msgid "Failed to execute!" msgid "Failed to execute!"
msgstr "" msgstr ""
@@ -333,7 +335,7 @@ msgstr ""
msgid "Get global check" msgid "Get global check"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:221 #: src/podkop/tabs/diagnostic/initController.ts:222
msgid "Global check" msgid "Global check"
msgstr "" msgstr ""
@@ -482,7 +484,7 @@ msgstr ""
msgid "Issues detected" msgid "Issues detected"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:452 #: src/podkop/tabs/diagnostic/initController.ts:453
msgid "Latest" msgid "Latest"
msgstr "" msgstr ""
@@ -526,10 +528,16 @@ msgstr ""
msgid "Not implement yet" msgid "Not implement yet"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:59
#: src/podkop/tabs/diagnostic/checks/runSectionsCheck.ts:79
msgid "Not responding"
msgstr ""
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:55 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:55
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:63 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:63
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:71 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:71
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:79 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:79
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:87
msgid "Not running" msgid "Not running"
msgstr "" msgstr ""
@@ -549,7 +557,7 @@ msgstr ""
msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields" msgid "Outbound JSON must contain at least \"type\", \"server\" and \"server_port\" fields"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:442 #: src/podkop/tabs/diagnostic/initController.ts:443
msgid "Outdated" msgid "Outdated"
msgstr "" msgstr ""
@@ -573,10 +581,11 @@ msgstr ""
msgid "Path must end with cache.db" msgid "Path must end with cache.db"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:95
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:103 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:103
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:111 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:111
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:119 #: src/podkop/tabs/diagnostic/diagnostic.store.ts:119
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:127
#: src/podkop/tabs/diagnostic/diagnostic.store.ts:135
msgid "Pending" msgid "Pending"
msgstr "" msgstr ""
@@ -737,7 +746,7 @@ msgstr ""
msgid "Settings" msgid "Settings"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:289 #: src/podkop/tabs/diagnostic/initController.ts:290
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:116
msgid "Show sing-box config" msgid "Show sing-box config"
msgstr "" msgstr ""
@@ -868,13 +877,13 @@ msgstr ""
msgid "UDP over TCP" msgid "UDP over TCP"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:37
#: src/podkop/tabs/diagnostic/initController.ts:38 #: src/podkop/tabs/diagnostic/initController.ts:38
#: src/podkop/tabs/diagnostic/initController.ts:39 #: src/podkop/tabs/diagnostic/initController.ts:39
#: src/podkop/tabs/diagnostic/initController.ts:40 #: src/podkop/tabs/diagnostic/initController.ts:40
#: src/podkop/tabs/diagnostic/initController.ts:41 #: src/podkop/tabs/diagnostic/initController.ts:41
#: src/podkop/tabs/diagnostic/initController.ts:42 #: src/podkop/tabs/diagnostic/initController.ts:42
#: src/podkop/tabs/diagnostic/initController.ts:416 #: src/podkop/tabs/diagnostic/initController.ts:43
#: src/podkop/tabs/diagnostic/initController.ts:417
msgid "unknown" msgid "unknown"
msgstr "" msgstr ""
@@ -948,7 +957,7 @@ msgstr ""
msgid "Validation errors:" msgid "Validation errors:"
msgstr "" msgstr ""
#: src/podkop/tabs/diagnostic/initController.ts:255 #: src/podkop/tabs/diagnostic/initController.ts:256
#: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107 #: src/podkop/tabs/diagnostic/partials/renderAvailableActions.ts:107
msgid "View logs" msgid "View logs"
msgstr "" msgstr ""