diff options
| author | Haishan <[email protected]> | 2020-10-31 18:18:04 +0800 |
|---|---|---|
| committer | Haishan <[email protected]> | 2020-11-01 17:42:52 +0800 |
| commit | ff1a39d04e53b428e34d46c55ecd6689189b5443 (patch) | |
| tree | 94a60abe3d28a1d729b877356bdd38d75ce655a5 /src/api | |
| parent | e62c9165481ef12ee2310dee1c32f890b3fe4b78 (diff) | |
chore: run ts-migrate
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/configs.ts | 3 | ||||
| -rw-r--r-- | src/api/connections.ts | 10 | ||||
| -rw-r--r-- | src/api/proxies.ts (renamed from src/api/proxies.js) | 0 | ||||
| -rw-r--r-- | src/api/traffic.ts (renamed from src/api/traffic.js) | 0 |
4 files changed, 8 insertions, 5 deletions
diff --git a/src/api/configs.ts b/src/api/configs.ts index 4957e85..69b02d4 100644 --- a/src/api/configs.ts +++ b/src/api/configs.ts @@ -1,4 +1,5 @@ import { getURLAndInit } from 'src/misc/request-helper'; +import { ClashGeneralConfig } from 'src/store/types'; import { ClashAPIConfig } from 'src/types'; const endpoint = '/configs'; @@ -12,7 +13,7 @@ export async function fetchConfigs(apiConfig: ClashAPIConfig) { // req body // { Path: string } -type ClashConfigPartial = { 'socks-port'?: unknown }; +type ClashConfigPartial = Partial<ClashGeneralConfig>; function configsPatchWorkaround(o: ClashConfigPartial) { // backward compatibility for older clash using `socket-port` if ('socks-port' in o) { diff --git a/src/api/connections.ts b/src/api/connections.ts index 7608a41..d4ed58e 100644 --- a/src/api/connections.ts +++ b/src/api/connections.ts @@ -9,11 +9,13 @@ const subscribers = []; // see also https://github.com/Dreamacro/clash/blob/dev/constant/metadata.go#L41 type UUID = string; -type ConnectionItem = { +type ConnNetwork = 'tcp' | 'udp'; +type ConnType = 'HTTP' | 'HTTP Connect' | 'Socks5' | 'Redir' | 'Unknown'; +export type ConnectionItem = { id: UUID; metadata: { - network: 'tcp' | 'udp'; - type: 'HTTP' | 'HTTP Connect' | 'Socks5' | 'Redir' | 'Unknown'; + network: ConnNetwork; + type: ConnType; sourceIP: string; destinationIP: string; sourcePort: string; @@ -24,7 +26,7 @@ type ConnectionItem = { download: number; // e.g. "2019-11-30T22:48:13.416668+08:00", start: string; - chains: Array<string>; + chains: string[]; // e.g. 'Match', 'DomainKeyword' rule: string; }; diff --git a/src/api/proxies.js b/src/api/proxies.ts index 72e1c52..72e1c52 100644 --- a/src/api/proxies.js +++ b/src/api/proxies.ts diff --git a/src/api/traffic.js b/src/api/traffic.ts index e50ec5e..e50ec5e 100644 --- a/src/api/traffic.js +++ b/src/api/traffic.ts |
