diff options
| author | Yonghui Zhang <[email protected]> | 2018-12-24 23:36:52 +0800 |
|---|---|---|
| committer | Yonghui Zhang <[email protected]> | 2018-12-24 23:39:47 +0800 |
| commit | 2b5820a56a5069e07eabb29ff18aa3574d9c2824 (patch) | |
| tree | 25c40cef55a19446af6ec6d4ab56683a8e3d1739 /src/api | |
| parent | 38e5b480c0ae4af53bf734d65595fbdbf72dd2c1 (diff) | |
use new configs PATCH API
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/configs.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/api/configs.js b/src/api/configs.js index 592f9fb..64f6b95 100644 --- a/src/api/configs.js +++ b/src/api/configs.js @@ -11,12 +11,20 @@ export async function fetchConfigs(apiConfig) { // req body // { Path: string } +function configsPatchWorkaround(o) { + // backward compatibility for older clash using `socket-port` + if ('socks-port' in o) { + o['socket-port'] = o['socks-port']; + } + return o; +} + export async function updateConfigs(apiConfig, o) { const { url, init } = getURLAndInit(apiConfig); return await fetch(url + endpoint, { ...init, method: 'PATCH', // mode: 'cors', - body: JSON.stringify(o) + body: JSON.stringify(configsPatchWorkaround(o)) }); } |
