diff --git a/fe-app-podkop/src/api/index.ts b/fe-app-podkop/src/api/index.ts deleted file mode 100644 index 2068b3f..0000000 --- a/fe-app-podkop/src/api/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './types'; -export * from './createBaseApiRequest'; diff --git a/fe-app-podkop/src/api/types.ts b/fe-app-podkop/src/api/types.ts deleted file mode 100644 index 193eb59..0000000 --- a/fe-app-podkop/src/api/types.ts +++ /dev/null @@ -1,9 +0,0 @@ -export type IBaseApiResponse = - | { - success: true; - data: T; - } - | { - success: false; - message: string; - }; diff --git a/fe-app-podkop/src/clash/index.ts b/fe-app-podkop/src/clash/index.ts deleted file mode 100644 index c3b7574..0000000 --- a/fe-app-podkop/src/clash/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './types'; -export * from './methods'; diff --git a/fe-app-podkop/src/clash/methods/getConfig.ts b/fe-app-podkop/src/clash/methods/getConfig.ts deleted file mode 100644 index 03cd5be..0000000 --- a/fe-app-podkop/src/clash/methods/getConfig.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ClashAPI } from '../types'; -import { getClashApiUrl } from '../../helpers'; -import { createBaseApiRequest, IBaseApiResponse } from '../../api'; - -export async function getClashConfig(): Promise< - IBaseApiResponse -> { - return createBaseApiRequest(() => - fetch(`${getClashApiUrl()}/configs`, { - method: 'GET', - headers: { 'Content-Type': 'application/json' }, - }), - ); -} diff --git a/fe-app-podkop/src/clash/methods/getGroupDelay.ts b/fe-app-podkop/src/clash/methods/getGroupDelay.ts deleted file mode 100644 index 5dda283..0000000 --- a/fe-app-podkop/src/clash/methods/getGroupDelay.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { ClashAPI } from '../types'; -import { getClashApiUrl } from '../../helpers'; -import { createBaseApiRequest, IBaseApiResponse } from '../../api'; - -export async function getClashGroupDelay( - group: string, - url = 'https://www.gstatic.com/generate_204', - timeout = 2000, -): Promise> { - const endpoint = `${getClashApiUrl()}/group/${group}/delay?url=${encodeURIComponent( - url, - )}&timeout=${timeout}`; - - return createBaseApiRequest(() => - fetch(endpoint, { - method: 'GET', - headers: { 'Content-Type': 'application/json' }, - }), - ); -} diff --git a/fe-app-podkop/src/clash/methods/getVersion.ts b/fe-app-podkop/src/clash/methods/getVersion.ts deleted file mode 100644 index da2f97d..0000000 --- a/fe-app-podkop/src/clash/methods/getVersion.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ClashAPI } from '../types'; -import { getClashApiUrl } from '../../helpers'; -import { createBaseApiRequest, IBaseApiResponse } from '../../api'; - -export async function getClashVersion(): Promise< - IBaseApiResponse -> { - return createBaseApiRequest(() => - fetch(`${getClashApiUrl()}/version`, { - method: 'GET', - headers: { 'Content-Type': 'application/json' }, - }), - ); -} diff --git a/fe-app-podkop/src/clash/methods/index.ts b/fe-app-podkop/src/clash/methods/index.ts deleted file mode 100644 index 9d04845..0000000 --- a/fe-app-podkop/src/clash/methods/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './getConfig'; -export * from './getGroupDelay'; -export * from './getProxies'; -export * from './getVersion'; -export * from './triggerProxySelector'; -export * from './triggerLatencyTest'; diff --git a/fe-app-podkop/src/clash/methods/triggerLatencyTest.ts b/fe-app-podkop/src/clash/methods/triggerLatencyTest.ts deleted file mode 100644 index fd937f7..0000000 --- a/fe-app-podkop/src/clash/methods/triggerLatencyTest.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { getClashApiUrl } from '../../helpers'; -import { createBaseApiRequest, IBaseApiResponse } from '../../api'; - -export async function triggerLatencyGroupTest( - tag: string, - timeout: number = 5000, - url: string = 'https://www.gstatic.com/generate_204', -): Promise> { - return createBaseApiRequest(() => - fetch( - `${getClashApiUrl()}/group/${tag}/delay?url=${encodeURIComponent(url)}&timeout=${timeout}`, - { - method: 'GET', - headers: { 'Content-Type': 'application/json' }, - }, - ), - ); -} - -export async function triggerLatencyProxyTest( - tag: string, - timeout: number = 2000, - url: string = 'https://www.gstatic.com/generate_204', -): Promise> { - return createBaseApiRequest(() => - fetch( - `${getClashApiUrl()}/proxies/${tag}/delay?url=${encodeURIComponent(url)}&timeout=${timeout}`, - { - method: 'GET', - headers: { 'Content-Type': 'application/json' }, - }, - ), - ); -} diff --git a/fe-app-podkop/src/clash/types.ts b/fe-app-podkop/src/clash/types.ts deleted file mode 100644 index 9f4700c..0000000 --- a/fe-app-podkop/src/clash/types.ts +++ /dev/null @@ -1,43 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-namespace -export namespace ClashAPI { - export interface Version { - meta: boolean; - premium: boolean; - version: string; - } - - export interface Config { - port: number; - 'socks-port': number; - 'redir-port': number; - 'tproxy-port': number; - 'mixed-port': number; - 'allow-lan': boolean; - 'bind-address': string; - mode: 'Rule' | 'Global' | 'Direct'; - 'mode-list': string[]; - 'log-level': 'debug' | 'info' | 'warn' | 'error'; - ipv6: boolean; - tun: null | Record; - } - - export interface ProxyHistoryEntry { - time: string; - delay: number; - } - - export interface ProxyBase { - type: string; - name: string; - udp: boolean; - history: ProxyHistoryEntry[]; - now?: string; - all?: string[]; - } - - export interface Proxies { - proxies: Record; - } - - export type Delays = Record; -} diff --git a/fe-app-podkop/src/fakeip/index.ts b/fe-app-podkop/src/fakeip/index.ts deleted file mode 100644 index 4f1821b..0000000 --- a/fe-app-podkop/src/fakeip/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './methods'; diff --git a/fe-app-podkop/src/fakeip/methods/index.ts b/fe-app-podkop/src/fakeip/methods/index.ts deleted file mode 100644 index aab9ee5..0000000 --- a/fe-app-podkop/src/fakeip/methods/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './getIpCheck'; -export * from './getFakeIpCheck'; diff --git a/fe-app-podkop/src/main.ts b/fe-app-podkop/src/main.ts index 7d7e2b7..79b8260 100644 --- a/fe-app-podkop/src/main.ts +++ b/fe-app-podkop/src/main.ts @@ -5,6 +5,5 @@ export * from './validators'; export * from './helpers'; -export * from './clash'; export * from './podkop'; export * from './constants'; diff --git a/fe-app-podkop/src/api/createBaseApiRequest.ts b/fe-app-podkop/src/podkop/api.ts similarity index 87% rename from fe-app-podkop/src/api/createBaseApiRequest.ts rename to fe-app-podkop/src/podkop/api.ts index c175678..5214c54 100644 --- a/fe-app-podkop/src/api/createBaseApiRequest.ts +++ b/fe-app-podkop/src/podkop/api.ts @@ -1,4 +1,3 @@ -import { IBaseApiResponse } from './types'; import { withTimeout } from '../helpers'; export async function createBaseApiRequest( @@ -42,3 +41,13 @@ export async function createBaseApiRequest( }; } } + +export type IBaseApiResponse = + | { + success: true; + data: T; + } + | { + success: false; + message: string; + }; diff --git a/fe-app-podkop/src/podkop/methods/clash/getGroupLatency.ts b/fe-app-podkop/src/podkop/methods/clash/getGroupLatency.ts new file mode 100644 index 0000000..7b26ac7 --- /dev/null +++ b/fe-app-podkop/src/podkop/methods/clash/getGroupLatency.ts @@ -0,0 +1,18 @@ +import { getClashApiUrl } from '../../../helpers'; +import { createBaseApiRequest, IBaseApiResponse } from '../../api'; + +export async function getGroupLatency( + tag: string, + timeout: number = 5000, + url: string = 'https://www.gstatic.com/generate_204', +): Promise> { + return createBaseApiRequest(() => + fetch( + `${getClashApiUrl()}/group/${tag}/delay?url=${encodeURIComponent(url)}&timeout=${timeout}`, + { + method: 'GET', + headers: { 'Content-Type': 'application/json' }, + }, + ), + ); +} diff --git a/fe-app-podkop/src/clash/methods/getProxies.ts b/fe-app-podkop/src/podkop/methods/clash/getProxies.ts similarity index 68% rename from fe-app-podkop/src/clash/methods/getProxies.ts rename to fe-app-podkop/src/podkop/methods/clash/getProxies.ts index 27ae08a..2c8d90c 100644 --- a/fe-app-podkop/src/clash/methods/getProxies.ts +++ b/fe-app-podkop/src/podkop/methods/clash/getProxies.ts @@ -1,8 +1,8 @@ -import { ClashAPI } from '../types'; -import { getClashApiUrl } from '../../helpers'; +import { ClashAPI } from '../../types'; +import { getClashApiUrl } from '../../../helpers'; import { createBaseApiRequest, IBaseApiResponse } from '../../api'; -export async function getClashProxies(): Promise< +export async function getProxies(): Promise< IBaseApiResponse > { return createBaseApiRequest(() => diff --git a/fe-app-podkop/src/podkop/methods/clash/getProxyLatency.ts b/fe-app-podkop/src/podkop/methods/clash/getProxyLatency.ts new file mode 100644 index 0000000..6714efa --- /dev/null +++ b/fe-app-podkop/src/podkop/methods/clash/getProxyLatency.ts @@ -0,0 +1,18 @@ +import { getClashApiUrl } from '../../../helpers'; +import { createBaseApiRequest, IBaseApiResponse } from '../../api'; + +export async function getProxyLatency( + tag: string, + timeout: number = 2000, + url: string = 'https://www.gstatic.com/generate_204', +): Promise> { + return createBaseApiRequest(() => + fetch( + `${getClashApiUrl()}/proxies/${tag}/delay?url=${encodeURIComponent(url)}&timeout=${timeout}`, + { + method: 'GET', + headers: { 'Content-Type': 'application/json' }, + }, + ), + ); +} diff --git a/fe-app-podkop/src/podkop/methods/clash/index.ts b/fe-app-podkop/src/podkop/methods/clash/index.ts new file mode 100644 index 0000000..d40db47 --- /dev/null +++ b/fe-app-podkop/src/podkop/methods/clash/index.ts @@ -0,0 +1,11 @@ +import { getGroupLatency } from './getGroupLatency'; +import { getProxies } from './getProxies'; +import { getProxyLatency } from './getProxyLatency'; +import { setProxy } from './setProxy'; + +export const ClashMethods = { + getGroupLatency, + getProxies, + getProxyLatency, + setProxy, +}; diff --git a/fe-app-podkop/src/clash/methods/triggerProxySelector.ts b/fe-app-podkop/src/podkop/methods/clash/setProxy.ts similarity index 80% rename from fe-app-podkop/src/clash/methods/triggerProxySelector.ts rename to fe-app-podkop/src/podkop/methods/clash/setProxy.ts index 5b22b0c..4642230 100644 --- a/fe-app-podkop/src/clash/methods/triggerProxySelector.ts +++ b/fe-app-podkop/src/podkop/methods/clash/setProxy.ts @@ -1,7 +1,7 @@ -import { getClashApiUrl } from '../../helpers'; +import { getClashApiUrl } from '../../../helpers'; import { createBaseApiRequest, IBaseApiResponse } from '../../api'; -export async function triggerProxySelector( +export async function setProxy( selector: string, outbound: string, ): Promise> { diff --git a/fe-app-podkop/src/podkop/methods/getConfigSections.ts b/fe-app-podkop/src/podkop/methods/custom/getConfigSections.ts similarity index 79% rename from fe-app-podkop/src/podkop/methods/getConfigSections.ts rename to fe-app-podkop/src/podkop/methods/custom/getConfigSections.ts index d8883d4..bdb13c4 100644 --- a/fe-app-podkop/src/podkop/methods/getConfigSections.ts +++ b/fe-app-podkop/src/podkop/methods/custom/getConfigSections.ts @@ -1,4 +1,4 @@ -import { Podkop } from '../types'; +import { Podkop } from '../../types'; export async function getConfigSections(): Promise { return uci.load('podkop').then(() => uci.sections('podkop')); diff --git a/fe-app-podkop/src/podkop/methods/getDashboardSections.ts b/fe-app-podkop/src/podkop/methods/custom/getDashboardSections.ts similarity index 95% rename from fe-app-podkop/src/podkop/methods/getDashboardSections.ts rename to fe-app-podkop/src/podkop/methods/custom/getDashboardSections.ts index b6619d0..96ff4b1 100644 --- a/fe-app-podkop/src/podkop/methods/getDashboardSections.ts +++ b/fe-app-podkop/src/podkop/methods/custom/getDashboardSections.ts @@ -1,7 +1,7 @@ -import { Podkop } from '../types'; import { getConfigSections } from './getConfigSections'; -import { getClashProxies } from '../../clash'; -import { getProxyUrlName, splitProxyString } from '../../helpers'; +import { Podkop } from '../../types'; +import { ClashMethods } from '../clash'; +import { getProxyUrlName, splitProxyString } from '../../../helpers'; interface IGetDashboardSectionsResponse { success: boolean; @@ -10,7 +10,7 @@ interface IGetDashboardSectionsResponse { export async function getDashboardSections(): Promise { const configSections = await getConfigSections(); - const clashProxies = await getClashProxies(); + const clashProxies = await ClashMethods.getProxies(); if (!clashProxies.success) { return { diff --git a/fe-app-podkop/src/podkop/methods/custom/index.ts b/fe-app-podkop/src/podkop/methods/custom/index.ts new file mode 100644 index 0000000..7ade0fa --- /dev/null +++ b/fe-app-podkop/src/podkop/methods/custom/index.ts @@ -0,0 +1,7 @@ +import { getConfigSections } from './getConfigSections'; +import { getDashboardSections } from './getDashboardSections'; + +export const CustomPodkopMethods = { + getConfigSections, + getDashboardSections, +}; diff --git a/fe-app-podkop/src/fakeip/methods/getFakeIpCheck.ts b/fe-app-podkop/src/podkop/methods/fakeip/getFakeIpCheck.ts similarity index 90% rename from fe-app-podkop/src/fakeip/methods/getFakeIpCheck.ts rename to fe-app-podkop/src/podkop/methods/fakeip/getFakeIpCheck.ts index 44df28c..4044ca0 100644 --- a/fe-app-podkop/src/fakeip/methods/getFakeIpCheck.ts +++ b/fe-app-podkop/src/podkop/methods/fakeip/getFakeIpCheck.ts @@ -1,5 +1,5 @@ +import { FAKEIP_CHECK_DOMAIN } from '../../../constants'; import { createBaseApiRequest, IBaseApiResponse } from '../../api'; -import { FAKEIP_CHECK_DOMAIN } from '../../constants'; interface IGetFakeIpCheckResponse { fakeip: boolean; diff --git a/fe-app-podkop/src/fakeip/methods/getIpCheck.ts b/fe-app-podkop/src/podkop/methods/fakeip/getIpCheck.ts similarity index 90% rename from fe-app-podkop/src/fakeip/methods/getIpCheck.ts rename to fe-app-podkop/src/podkop/methods/fakeip/getIpCheck.ts index f54a054..c25a60e 100644 --- a/fe-app-podkop/src/fakeip/methods/getIpCheck.ts +++ b/fe-app-podkop/src/podkop/methods/fakeip/getIpCheck.ts @@ -1,5 +1,5 @@ +import { IP_CHECK_DOMAIN } from '../../../constants'; import { createBaseApiRequest, IBaseApiResponse } from '../../api'; -import { IP_CHECK_DOMAIN } from '../../constants'; interface IGetIpCheckResponse { fakeip: boolean; diff --git a/fe-app-podkop/src/podkop/methods/fakeip/index.ts b/fe-app-podkop/src/podkop/methods/fakeip/index.ts new file mode 100644 index 0000000..4a95f16 --- /dev/null +++ b/fe-app-podkop/src/podkop/methods/fakeip/index.ts @@ -0,0 +1,7 @@ +import { getFakeIpCheck } from './getFakeIpCheck'; +import { getIpCheck } from './getIpCheck'; + +export const RemoteFakeIPMethods = { + getFakeIpCheck, + getIpCheck, +}; diff --git a/fe-app-podkop/src/podkop/methods/getDNSCheck.ts b/fe-app-podkop/src/podkop/methods/getDNSCheck.ts deleted file mode 100644 index 8744230..0000000 --- a/fe-app-podkop/src/podkop/methods/getDNSCheck.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { executeShellCommand } from '../../helpers'; -import { Podkop } from '../types'; - -export async function getDNSCheck(): Promise< - Podkop.MethodResponse -> { - const response = await executeShellCommand({ - command: '/usr/bin/podkop', - args: ['check_dns_available'], - timeout: 10000, - }); - - if (response.stdout) { - return { - success: true, - data: JSON.parse(response.stdout) as Podkop.DnsCheckResult, - }; - } - - return { - success: false, - error: '', - }; -} diff --git a/fe-app-podkop/src/podkop/methods/getFakeIPCheck.ts b/fe-app-podkop/src/podkop/methods/getFakeIPCheck.ts deleted file mode 100644 index 0e7bbe2..0000000 --- a/fe-app-podkop/src/podkop/methods/getFakeIPCheck.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { executeShellCommand } from '../../helpers'; -import { Podkop } from '../types'; - -export async function getFakeIPCheck(): Promise< - Podkop.MethodResponse -> { - const response = await executeShellCommand({ - command: '/usr/bin/podkop', - args: ['check_fakeip'], - timeout: 10000, - }); - - if (response.stdout) { - return { - success: true, - data: JSON.parse(response.stdout) as Podkop.FakeIPCheckResult, - }; - } - - return { - success: false, - error: '', - }; -} diff --git a/fe-app-podkop/src/podkop/methods/getNftRulesCheck.ts b/fe-app-podkop/src/podkop/methods/getNftRulesCheck.ts deleted file mode 100644 index f5eded4..0000000 --- a/fe-app-podkop/src/podkop/methods/getNftRulesCheck.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { executeShellCommand } from '../../helpers'; -import { Podkop } from '../types'; - -export async function getNftRulesCheck(): Promise< - Podkop.MethodResponse -> { - const response = await executeShellCommand({ - command: '/usr/bin/podkop', - args: ['check_nft_rules'], - timeout: 10000, - }); - - if (response.stdout) { - return { - success: true, - data: JSON.parse(response.stdout) as Podkop.NftRulesCheckResult, - }; - } - - return { - success: false, - error: '', - }; -} diff --git a/fe-app-podkop/src/podkop/methods/getPodkopStatus.ts b/fe-app-podkop/src/podkop/methods/getPodkopStatus.ts deleted file mode 100644 index 666c41e..0000000 --- a/fe-app-podkop/src/podkop/methods/getPodkopStatus.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { executeShellCommand } from '../../helpers'; - -export async function getPodkopStatus(): Promise<{ - enabled: number; - status: string; -}> { - const response = await executeShellCommand({ - command: '/usr/bin/podkop', - args: ['get_status'], - timeout: 10000, - }); - - if (response.stdout) { - return JSON.parse(response.stdout.replace(/\n/g, '')) as { - enabled: number; - status: string; - }; - } - - return { enabled: 0, status: 'unknown' }; -} diff --git a/fe-app-podkop/src/podkop/methods/getSingBoxCheck.ts b/fe-app-podkop/src/podkop/methods/getSingBoxCheck.ts deleted file mode 100644 index 6ad35cc..0000000 --- a/fe-app-podkop/src/podkop/methods/getSingBoxCheck.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { executeShellCommand } from '../../helpers'; -import { Podkop } from '../types'; - -export async function getSingBoxCheck(): Promise< - Podkop.MethodResponse -> { - const response = await executeShellCommand({ - command: '/usr/bin/podkop', - args: ['check_sing_box'], - timeout: 10000, - }); - - if (response.stdout) { - return { - success: true, - data: JSON.parse(response.stdout) as Podkop.SingBoxCheckResult, - }; - } - - return { - success: false, - error: '', - }; -} diff --git a/fe-app-podkop/src/podkop/methods/getSingBoxStatus.ts b/fe-app-podkop/src/podkop/methods/getSingBoxStatus.ts deleted file mode 100644 index 51d2f62..0000000 --- a/fe-app-podkop/src/podkop/methods/getSingBoxStatus.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { executeShellCommand } from '../../helpers'; - -export async function getSingBoxStatus(): Promise<{ - running: number; - enabled: number; - status: string; -}> { - const response = await executeShellCommand({ - command: '/usr/bin/podkop', - args: ['get_sing_box_status'], - timeout: 10000, - }); - - if (response.stdout) { - return JSON.parse(response.stdout.replace(/\n/g, '')) as { - running: number; - enabled: number; - status: string; - }; - } - - return { running: 0, enabled: 0, status: 'unknown' }; -} diff --git a/fe-app-podkop/src/podkop/methods/index.ts b/fe-app-podkop/src/podkop/methods/index.ts index 70d753b..28101c6 100644 --- a/fe-app-podkop/src/podkop/methods/index.ts +++ b/fe-app-podkop/src/podkop/methods/index.ts @@ -1,8 +1,4 @@ -export * from './getConfigSections'; -export * from './getDashboardSections'; -export * from './getPodkopStatus'; -export * from './getSingBoxStatus'; -export * from './getDNSCheck'; -export * from './getNftRulesCheck'; -export * from './getSingBoxCheck'; -export * from './getFakeIPCheck'; +export * from './clash'; +export * from './custom'; +export * from './fakeip'; +export * from './shell'; diff --git a/fe-app-podkop/src/podkop/methods/shell/callBaseMethod.ts b/fe-app-podkop/src/podkop/methods/shell/callBaseMethod.ts new file mode 100644 index 0000000..55da36e --- /dev/null +++ b/fe-app-podkop/src/podkop/methods/shell/callBaseMethod.ts @@ -0,0 +1,24 @@ +import { executeShellCommand } from '../../../helpers'; +import { Podkop } from '../../types'; + +export async function callBaseMethod( + method: Podkop.AvailableMethods, +): Promise> { + const response = await executeShellCommand({ + command: '/usr/bin/podkop', + args: [method], + timeout: 10000, + }); + + if (response.stdout) { + return { + success: true, + data: JSON.parse(response.stdout) as T, + }; + } + + return { + success: false, + error: '', + }; +} diff --git a/fe-app-podkop/src/podkop/methods/shell/index.ts b/fe-app-podkop/src/podkop/methods/shell/index.ts new file mode 100644 index 0000000..9b1cd93 --- /dev/null +++ b/fe-app-podkop/src/podkop/methods/shell/index.ts @@ -0,0 +1,27 @@ +import { callBaseMethod } from './callBaseMethod'; +import { Podkop } from '../../types'; + +export const PodkopShellMethods = { + checkDNSAvailable: async () => + callBaseMethod( + Podkop.AvailableMethods.CHECK_DNS_AVAILABLE, + ), + checkFakeIP: async () => + callBaseMethod( + Podkop.AvailableMethods.CHECK_FAKEIP, + ), + checkNftRules: async () => + callBaseMethod( + Podkop.AvailableMethods.CHECK_NFT_RULES, + ), + getStatus: async () => + callBaseMethod(Podkop.AvailableMethods.GET_STATUS), + checkSingBox: async () => + callBaseMethod( + Podkop.AvailableMethods.CHECK_SING_BOX, + ), + getSingBoxStatus: async () => + callBaseMethod( + Podkop.AvailableMethods.GET_SING_BOX_STATUS, + ), +}; diff --git a/fe-app-podkop/src/podkop/tabs/dashboard/initDashboardController.ts b/fe-app-podkop/src/podkop/tabs/dashboard/initDashboardController.ts index 2054df4..d9be183 100644 --- a/fe-app-podkop/src/podkop/tabs/dashboard/initDashboardController.ts +++ b/fe-app-podkop/src/podkop/tabs/dashboard/initDashboardController.ts @@ -1,24 +1,19 @@ -import { - getDashboardSections, - getPodkopStatus, - getSingBoxStatus, -} from '../../methods'; import { getClashApiUrl, getClashWsUrl, onMount, preserveScrollForPage, } from '../../../helpers'; -import { - triggerLatencyGroupTest, - triggerLatencyProxyTest, - triggerProxySelector, -} from '../../../clash'; import { store, StoreType } from '../../../store'; import { socket } from '../../../socket'; import { prettyBytes } from '../../../helpers/prettyBytes'; import { renderSections } from './renderSections'; import { renderWidget } from './renderWidget'; +import { + ClashMethods, + CustomPodkopMethods, + PodkopShellMethods, +} from '../../methods'; // Fetchers @@ -32,7 +27,7 @@ async function fetchDashboardSections() { }, }); - const { data, success } = await getDashboardSections(); + const { data, success } = await CustomPodkopMethods.getDashboardSections(); if (!success) { console.log('[fetchDashboardSections]: failed to fetch', getClashApiUrl()); @@ -49,22 +44,12 @@ async function fetchDashboardSections() { } async function fetchServicesInfo() { - try { - const [podkop, singbox] = await Promise.all([ - getPodkopStatus(), - getSingBoxStatus(), - ]); - - store.set({ - servicesInfoWidget: { - loading: false, - failed: false, - data: { singbox: singbox.running, podkop: podkop.enabled }, - }, - }); - } catch (err) { - console.log('[fetchServicesInfo]: failed to fetchServices', err); + const [podkop, singbox] = await Promise.all([ + PodkopShellMethods.getStatus(), + PodkopShellMethods.getSingBoxStatus(), + ]); + if (!podkop.success || !singbox.success) { store.set({ servicesInfoWidget: { loading: false, @@ -73,6 +58,16 @@ async function fetchServicesInfo() { }, }); } + + if (podkop.success && singbox.success) { + store.set({ + servicesInfoWidget: { + loading: false, + failed: false, + data: { singbox: singbox.data.running, podkop: podkop.data.enabled }, + }, + }); + } } async function connectToClashSockets() { @@ -155,7 +150,7 @@ async function connectToClashSockets() { // Handlers async function handleChooseOutbound(selector: string, tag: string) { - await triggerProxySelector(selector, tag); + await ClashMethods.setProxy(selector, tag); await fetchDashboardSections(); } @@ -167,7 +162,7 @@ async function handleTestGroupLatency(tag: string) { }, }); - await triggerLatencyGroupTest(tag); + await ClashMethods.getGroupLatency(tag); await fetchDashboardSections(); store.set({ @@ -186,7 +181,7 @@ async function handleTestProxyLatency(tag: string) { }, }); - await triggerLatencyProxyTest(tag); + await ClashMethods.getProxyLatency(tag); await fetchDashboardSections(); store.set({ diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runDnsCheck.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runDnsCheck.ts index 28c62af..18a0dac 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runDnsCheck.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runDnsCheck.ts @@ -1,8 +1,8 @@ -import { getDNSCheck } from '../../../methods'; import { updateDiagnosticsCheck } from '../updateDiagnosticsCheck'; import { insertIf } from '../../../../helpers'; import { IDiagnosticsChecksItem } from '../../../../store'; import { DIAGNOSTICS_CHECKS_MAP } from './contstants'; +import { PodkopShellMethods } from '../../../methods'; export async function runDnsCheck() { const { order, title, code } = DIAGNOSTICS_CHECKS_MAP.DNS; @@ -16,7 +16,7 @@ export async function runDnsCheck() { items: [], }); - const dnsChecks = await getDNSCheck(); + const dnsChecks = await PodkopShellMethods.checkDNSAvailable(); if (!dnsChecks.success) { updateDiagnosticsCheck({ diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts index 4b3548e..d2b87e3 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runFakeIPCheck.ts @@ -1,9 +1,8 @@ -import * as podkopMethods from '../../../methods'; -import * as fakeIPMethods from '../../../../fakeip/methods'; import { updateDiagnosticsCheck } from '../updateDiagnosticsCheck'; import { insertIf } from '../../../../helpers'; import { IDiagnosticsChecksItem } from '../../../../store'; import { DIAGNOSTICS_CHECKS_MAP } from './contstants'; +import { PodkopShellMethods, RemoteFakeIPMethods } from '../../../methods'; export async function runFakeIPCheck() { const { order, title, code } = DIAGNOSTICS_CHECKS_MAP.FAKEIP; @@ -17,9 +16,9 @@ export async function runFakeIPCheck() { items: [], }); - const routerFakeIPResponse = await podkopMethods.getFakeIPCheck(); - const checkFakeIPResponse = await fakeIPMethods.getFakeIpCheck(); - const checkIPResponse = await fakeIPMethods.getIpCheck(); + const routerFakeIPResponse = await PodkopShellMethods.checkFakeIP(); + const checkFakeIPResponse = await RemoteFakeIPMethods.getFakeIpCheck(); + const checkIPResponse = await RemoteFakeIPMethods.getIpCheck(); console.log('runFakeIPCheck', { routerFakeIPResponse, diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runNftCheck.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runNftCheck.ts index b7fa0c2..cc0a4c9 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runNftCheck.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runNftCheck.ts @@ -1,7 +1,7 @@ -import { getNftRulesCheck } from '../../../methods'; import { updateDiagnosticsCheck } from '../updateDiagnosticsCheck'; -import { getFakeIpCheck, getIpCheck } from '../../../../fakeip'; import { DIAGNOSTICS_CHECKS_MAP } from './contstants'; +import { RemoteFakeIPMethods } from '../../../methods/fakeip'; +import { PodkopShellMethods } from '../../../methods'; export async function runNftCheck() { const { order, title, code } = DIAGNOSTICS_CHECKS_MAP.NFT; @@ -15,10 +15,10 @@ export async function runNftCheck() { items: [], }); - await getFakeIpCheck(); - await getIpCheck(); + await RemoteFakeIPMethods.getFakeIpCheck(); + await RemoteFakeIPMethods.getIpCheck(); - const nftablesChecks = await getNftRulesCheck(); + const nftablesChecks = await PodkopShellMethods.checkNftRules(); if (!nftablesChecks.success) { updateDiagnosticsCheck({ diff --git a/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts b/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts index 80a8bd1..037e905 100644 --- a/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts +++ b/fe-app-podkop/src/podkop/tabs/diagnostic/checks/runSingBoxCheck.ts @@ -1,6 +1,6 @@ -import { getSingBoxCheck } from '../../../methods'; import { updateDiagnosticsCheck } from '../updateDiagnosticsCheck'; import { DIAGNOSTICS_CHECKS_MAP } from './contstants'; +import { PodkopShellMethods } from '../../../methods'; export async function runSingBoxCheck() { const { order, title, code } = DIAGNOSTICS_CHECKS_MAP.SINGBOX; @@ -14,7 +14,7 @@ export async function runSingBoxCheck() { items: [], }); - const singBoxChecks = await getSingBoxCheck(); + const singBoxChecks = await PodkopShellMethods.checkSingBox(); if (!singBoxChecks.success) { updateDiagnosticsCheck({ diff --git a/fe-app-podkop/src/podkop/types.ts b/fe-app-podkop/src/podkop/types.ts index df38f94..32c0447 100644 --- a/fe-app-podkop/src/podkop/types.ts +++ b/fe-app-podkop/src/podkop/types.ts @@ -1,5 +1,35 @@ +// eslint-disable-next-line @typescript-eslint/no-namespace +export namespace ClashAPI { + export interface ProxyHistoryEntry { + time: string; + delay: number; + } + + export interface ProxyBase { + type: string; + name: string; + udp: boolean; + history: ProxyHistoryEntry[]; + now?: string; + all?: string[]; + } + + export interface Proxies { + proxies: Record; + } +} + // eslint-disable-next-line @typescript-eslint/no-namespace export namespace Podkop { + export enum AvailableMethods { + CHECK_DNS_AVAILABLE = 'check_dns_available', + CHECK_FAKEIP = 'check_fakeip', + CHECK_NFT_RULES = 'check_nft_rules', + GET_STATUS = 'get_status', + CHECK_SING_BOX = 'check_sing_box', + GET_SING_BOX_STATUS = 'get_sing_box_status', + } + export interface Outbound { code: string; displayName: string; @@ -102,4 +132,15 @@ export namespace Podkop { fakeip: boolean; IP: string; } + + export interface GetStatus { + enabled: number; + status: string; + } + + export interface GetSingBoxStatus { + running: number; + enabled: number; + status: string; + } } 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 d1cd702..ac258f0 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 @@ -1003,7 +1003,7 @@ function validateProxyUrl(url) { }; } -// src/api/createBaseApiRequest.ts +// src/podkop/api.ts async function createBaseApiRequest(fetchFn, options) { const wrappedFn = () => options?.timeoutMs && options?.operationName ? withTimeout( fetchFn(), @@ -1032,62 +1032,8 @@ async function createBaseApiRequest(fetchFn, options) { } } -// src/clash/methods/getConfig.ts -async function getClashConfig() { - return createBaseApiRequest( - () => fetch(`${getClashApiUrl()}/configs`, { - method: "GET", - headers: { "Content-Type": "application/json" } - }) - ); -} - -// src/clash/methods/getGroupDelay.ts -async function getClashGroupDelay(group, url = "https://www.gstatic.com/generate_204", timeout = 2e3) { - const endpoint = `${getClashApiUrl()}/group/${group}/delay?url=${encodeURIComponent( - url - )}&timeout=${timeout}`; - return createBaseApiRequest( - () => fetch(endpoint, { - method: "GET", - headers: { "Content-Type": "application/json" } - }) - ); -} - -// src/clash/methods/getProxies.ts -async function getClashProxies() { - return createBaseApiRequest( - () => fetch(`${getClashApiUrl()}/proxies`, { - method: "GET", - headers: { "Content-Type": "application/json" } - }) - ); -} - -// src/clash/methods/getVersion.ts -async function getClashVersion() { - return createBaseApiRequest( - () => fetch(`${getClashApiUrl()}/version`, { - method: "GET", - headers: { "Content-Type": "application/json" } - }) - ); -} - -// src/clash/methods/triggerProxySelector.ts -async function triggerProxySelector(selector, outbound) { - return createBaseApiRequest( - () => fetch(`${getClashApiUrl()}/proxies/${selector}`, { - method: "PUT", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ name: outbound }) - }) - ); -} - -// src/clash/methods/triggerLatencyTest.ts -async function triggerLatencyGroupTest(tag, timeout = 5e3, url = "https://www.gstatic.com/generate_204") { +// src/podkop/methods/clash/getGroupLatency.ts +async function getGroupLatency(tag, timeout = 5e3, url = "https://www.gstatic.com/generate_204") { return createBaseApiRequest( () => fetch( `${getClashApiUrl()}/group/${tag}/delay?url=${encodeURIComponent(url)}&timeout=${timeout}`, @@ -1098,7 +1044,19 @@ async function triggerLatencyGroupTest(tag, timeout = 5e3, url = "https://www.gs ) ); } -async function triggerLatencyProxyTest(tag, timeout = 2e3, url = "https://www.gstatic.com/generate_204") { + +// src/podkop/methods/clash/getProxies.ts +async function getProxies() { + return createBaseApiRequest( + () => fetch(`${getClashApiUrl()}/proxies`, { + method: "GET", + headers: { "Content-Type": "application/json" } + }) + ); +} + +// src/podkop/methods/clash/getProxyLatency.ts +async function getProxyLatency(tag, timeout = 2e3, url = "https://www.gstatic.com/generate_204") { return createBaseApiRequest( () => fetch( `${getClashApiUrl()}/proxies/${tag}/delay?url=${encodeURIComponent(url)}&timeout=${timeout}`, @@ -1110,15 +1068,34 @@ async function triggerLatencyProxyTest(tag, timeout = 2e3, url = "https://www.gs ); } -// src/podkop/methods/getConfigSections.ts +// src/podkop/methods/clash/setProxy.ts +async function setProxy(selector, outbound) { + return createBaseApiRequest( + () => fetch(`${getClashApiUrl()}/proxies/${selector}`, { + method: "PUT", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ name: outbound }) + }) + ); +} + +// src/podkop/methods/clash/index.ts +var ClashMethods = { + getGroupLatency, + getProxies, + getProxyLatency, + setProxy +}; + +// src/podkop/methods/custom/getConfigSections.ts async function getConfigSections() { return uci.load("podkop").then(() => uci.sections("podkop")); } -// src/podkop/methods/getDashboardSections.ts +// src/podkop/methods/custom/getDashboardSections.ts async function getDashboardSections() { const configSections = await getConfigSections(); - const clashProxies = await getClashProxies(); + const clashProxies = await ClashMethods.getProxies(); if (!clashProxies.success) { return { success: false, @@ -1241,37 +1218,51 @@ async function getDashboardSections() { }; } -// src/podkop/methods/getPodkopStatus.ts -async function getPodkopStatus() { - const response = await executeShellCommand({ - command: "/usr/bin/podkop", - args: ["get_status"], - timeout: 1e4 - }); - if (response.stdout) { - return JSON.parse(response.stdout.replace(/\n/g, "")); - } - return { enabled: 0, status: "unknown" }; +// src/podkop/methods/custom/index.ts +var CustomPodkopMethods = { + getConfigSections, + getDashboardSections +}; + +// src/podkop/methods/fakeip/getFakeIpCheck.ts +async function getFakeIpCheck() { + return createBaseApiRequest( + () => fetch(`https://${FAKEIP_CHECK_DOMAIN}/check`, { + method: "GET", + headers: { "Content-Type": "application/json" } + }), + { + operationName: "getFakeIpCheck", + timeoutMs: 5e3 + } + ); } -// src/podkop/methods/getSingBoxStatus.ts -async function getSingBoxStatus() { - const response = await executeShellCommand({ - command: "/usr/bin/podkop", - args: ["get_sing_box_status"], - timeout: 1e4 - }); - if (response.stdout) { - return JSON.parse(response.stdout.replace(/\n/g, "")); - } - return { running: 0, enabled: 0, status: "unknown" }; +// src/podkop/methods/fakeip/getIpCheck.ts +async function getIpCheck() { + return createBaseApiRequest( + () => fetch(`https://${IP_CHECK_DOMAIN}/check`, { + method: "GET", + headers: { "Content-Type": "application/json" } + }), + { + operationName: "getIpCheck", + timeoutMs: 5e3 + } + ); } -// src/podkop/methods/getDNSCheck.ts -async function getDNSCheck() { +// src/podkop/methods/fakeip/index.ts +var RemoteFakeIPMethods = { + getFakeIpCheck, + getIpCheck +}; + +// src/podkop/methods/shell/callBaseMethod.ts +async function callBaseMethod(method) { const response = await executeShellCommand({ command: "/usr/bin/podkop", - args: ["check_dns_available"], + args: [method], timeout: 1e4 }); if (response.stdout) { @@ -1286,62 +1277,39 @@ async function getDNSCheck() { }; } -// src/podkop/methods/getNftRulesCheck.ts -async function getNftRulesCheck() { - const response = await executeShellCommand({ - command: "/usr/bin/podkop", - args: ["check_nft_rules"], - timeout: 1e4 - }); - if (response.stdout) { - return { - success: true, - data: JSON.parse(response.stdout) - }; - } - return { - success: false, - error: "" - }; -} +// src/podkop/types.ts +var Podkop; +((Podkop2) => { + let AvailableMethods; + ((AvailableMethods2) => { + AvailableMethods2["CHECK_DNS_AVAILABLE"] = "check_dns_available"; + AvailableMethods2["CHECK_FAKEIP"] = "check_fakeip"; + AvailableMethods2["CHECK_NFT_RULES"] = "check_nft_rules"; + AvailableMethods2["GET_STATUS"] = "get_status"; + AvailableMethods2["CHECK_SING_BOX"] = "check_sing_box"; + AvailableMethods2["GET_SING_BOX_STATUS"] = "get_sing_box_status"; + })(AvailableMethods = Podkop2.AvailableMethods || (Podkop2.AvailableMethods = {})); +})(Podkop || (Podkop = {})); -// src/podkop/methods/getSingBoxCheck.ts -async function getSingBoxCheck() { - const response = await executeShellCommand({ - command: "/usr/bin/podkop", - args: ["check_sing_box"], - timeout: 1e4 - }); - if (response.stdout) { - return { - success: true, - data: JSON.parse(response.stdout) - }; - } - return { - success: false, - error: "" - }; -} - -// src/podkop/methods/getFakeIPCheck.ts -async function getFakeIPCheck() { - const response = await executeShellCommand({ - command: "/usr/bin/podkop", - args: ["check_fakeip"], - timeout: 1e4 - }); - if (response.stdout) { - return { - success: true, - data: JSON.parse(response.stdout) - }; - } - return { - success: false, - error: "" - }; -} +// src/podkop/methods/shell/index.ts +var PodkopShellMethods = { + checkDNSAvailable: async () => callBaseMethod( + Podkop.AvailableMethods.CHECK_DNS_AVAILABLE + ), + checkFakeIP: async () => callBaseMethod( + Podkop.AvailableMethods.CHECK_FAKEIP + ), + checkNftRules: async () => callBaseMethod( + Podkop.AvailableMethods.CHECK_NFT_RULES + ), + getStatus: async () => callBaseMethod(Podkop.AvailableMethods.GET_STATUS), + checkSingBox: async () => callBaseMethod( + Podkop.AvailableMethods.CHECK_SING_BOX + ), + getSingBoxStatus: async () => callBaseMethod( + Podkop.AvailableMethods.GET_SING_BOX_STATUS + ) +}; // src/podkop/services/tab.service.ts var TabService = class _TabService { @@ -1994,7 +1962,7 @@ async function fetchDashboardSections() { failed: false } }); - const { data, success } = await getDashboardSections(); + const { data, success } = await CustomPodkopMethods.getDashboardSections(); if (!success) { console.log("[fetchDashboardSections]: failed to fetch", getClashApiUrl()); } @@ -2008,20 +1976,11 @@ async function fetchDashboardSections() { }); } async function fetchServicesInfo() { - try { - const [podkop, singbox] = await Promise.all([ - getPodkopStatus(), - getSingBoxStatus() - ]); - store.set({ - servicesInfoWidget: { - loading: false, - failed: false, - data: { singbox: singbox.running, podkop: podkop.enabled } - } - }); - } catch (err) { - console.log("[fetchServicesInfo]: failed to fetchServices", err); + const [podkop, singbox] = await Promise.all([ + PodkopShellMethods.getStatus(), + PodkopShellMethods.getSingBoxStatus() + ]); + if (!podkop.success || !singbox.success) { store.set({ servicesInfoWidget: { loading: false, @@ -2030,6 +1989,15 @@ async function fetchServicesInfo() { } }); } + if (podkop.success && singbox.success) { + store.set({ + servicesInfoWidget: { + loading: false, + failed: false, + data: { singbox: singbox.data.running, podkop: podkop.data.enabled } + } + }); + } } async function connectToClashSockets() { socket.subscribe( @@ -2105,7 +2073,7 @@ async function connectToClashSockets() { ); } async function handleChooseOutbound(selector, tag) { - await triggerProxySelector(selector, tag); + await ClashMethods.setProxy(selector, tag); await fetchDashboardSections(); } async function handleTestGroupLatency(tag) { @@ -2115,7 +2083,7 @@ async function handleTestGroupLatency(tag) { latencyFetching: true } }); - await triggerLatencyGroupTest(tag); + await ClashMethods.getGroupLatency(tag); await fetchDashboardSections(); store.set({ sectionsWidget: { @@ -2131,7 +2099,7 @@ async function handleTestProxyLatency(tag) { latencyFetching: true } }); - await triggerLatencyProxyTest(tag); + await ClashMethods.getProxyLatency(tag); await fetchDashboardSections(); store.set({ sectionsWidget: { @@ -2772,7 +2740,7 @@ async function runDnsCheck() { state: "loading", items: [] }); - const dnsChecks = await getDNSCheck(); + const dnsChecks = await PodkopShellMethods.checkDNSAvailable(); if (!dnsChecks.success) { updateDiagnosticsCheck({ order, @@ -2842,7 +2810,7 @@ async function runSingBoxCheck() { state: "loading", items: [] }); - const singBoxChecks = await getSingBoxCheck(); + const singBoxChecks = await PodkopShellMethods.checkSingBox(); if (!singBoxChecks.success) { updateDiagnosticsCheck({ order, @@ -2911,34 +2879,6 @@ async function runSingBoxCheck() { } } -// src/fakeip/methods/getIpCheck.ts -async function getIpCheck() { - return createBaseApiRequest( - () => fetch(`https://${IP_CHECK_DOMAIN}/check`, { - method: "GET", - headers: { "Content-Type": "application/json" } - }), - { - operationName: "getIpCheck", - timeoutMs: 5e3 - } - ); -} - -// src/fakeip/methods/getFakeIpCheck.ts -async function getFakeIpCheck() { - return createBaseApiRequest( - () => fetch(`https://${FAKEIP_CHECK_DOMAIN}/check`, { - method: "GET", - headers: { "Content-Type": "application/json" } - }), - { - operationName: "getFakeIpCheck", - timeoutMs: 5e3 - } - ); -} - // src/podkop/tabs/diagnostic/checks/runNftCheck.ts async function runNftCheck() { const { order, title, code } = DIAGNOSTICS_CHECKS_MAP.NFT; @@ -2950,9 +2890,9 @@ async function runNftCheck() { state: "loading", items: [] }); - await getFakeIpCheck(); - await getIpCheck(); - const nftablesChecks = await getNftRulesCheck(); + await RemoteFakeIPMethods.getFakeIpCheck(); + await RemoteFakeIPMethods.getIpCheck(); + const nftablesChecks = await PodkopShellMethods.checkNftRules(); if (!nftablesChecks.success) { updateDiagnosticsCheck({ order, @@ -3042,9 +2982,9 @@ async function runFakeIPCheck() { state: "loading", items: [] }); - const routerFakeIPResponse = await getFakeIPCheck(); - const checkFakeIPResponse = await getFakeIpCheck(); - const checkIPResponse = await getIpCheck(); + const routerFakeIPResponse = await PodkopShellMethods.checkFakeIP(); + const checkFakeIPResponse = await RemoteFakeIPMethods.getFakeIpCheck(); + const checkIPResponse = await RemoteFakeIPMethods.getIpCheck(); console.log("runFakeIPCheck", { routerFakeIPResponse, checkFakeIPResponse, @@ -3254,6 +3194,8 @@ return baseclass.extend({ CACHE_TIMEOUT, COMMAND_SCHEDULING, COMMAND_TIMEOUT, + ClashMethods, + CustomPodkopMethods, DIAGNOSTICS_INITIAL_DELAY, DIAGNOSTICS_UPDATE_INTERVAL, DNS_SERVER_OPTIONS, @@ -3263,7 +3205,9 @@ return baseclass.extend({ FETCH_TIMEOUT, IP_CHECK_DOMAIN, PODKOP_LUCI_APP_VERSION, + PodkopShellMethods, REGIONAL_OPTIONS, + RemoteFakeIPMethods, STATUS_COLORS, TabService, TabServiceInstance, @@ -3273,21 +3217,9 @@ return baseclass.extend({ executeShellCommand, getBaseUrl, getClashApiUrl, - getClashConfig, - getClashGroupDelay, - getClashProxies, getClashUIUrl, - getClashVersion, getClashWsUrl, - getConfigSections, - getDNSCheck, - getDashboardSections, - getFakeIPCheck, - getNftRulesCheck, - getPodkopStatus, getProxyUrlName, - getSingBoxCheck, - getSingBoxStatus, initDashboardController, initDiagnosticController, injectGlobalStyles, @@ -3302,9 +3234,6 @@ return baseclass.extend({ renderDiagnostic, splitProxyString, svgEl, - triggerLatencyGroupTest, - triggerLatencyProxyTest, - triggerProxySelector, validateDNS, validateDomain, validateIPV4,