diff options
| author | Larvan2 <[email protected]> | 2023-03-25 22:25:37 +0800 |
|---|---|---|
| committer | Larvan2 <[email protected]> | 2023-03-25 22:25:37 +0800 |
| commit | a12ed559b0779587f29fc183ac9afd45303c0462 (patch) | |
| tree | 0b366839bec4d3bc893a7f3c6381491577129236 /src/api | |
| parent | c7cbac93c823e03ae02f8bee72b4c363160604b2 (diff) | |
feat: add upgrade und restart API
Diffstat (limited to 'src/api')
| -rw-r--r-- | src/api/configs.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/api/configs.ts b/src/api/configs.ts index ff62ce7..a91480c 100644 --- a/src/api/configs.ts +++ b/src/api/configs.ts @@ -5,6 +5,8 @@ import { ClashAPIConfig } from '~/types'; const endpoint = '/configs'; const updateGeoDatabasesFileEndpoint = '/configs/geo'; const flushFakeIPPoolEndpoint = '/cache/fakeip/flush'; +const restartCoreEndpoint = '/restart'; +const upgradeCoreEndpoint = '/upgrade'; export async function fetchConfigs(apiConfig: ClashAPIConfig) { const { url, init } = getURLAndInit(apiConfig); @@ -42,6 +44,18 @@ export async function updateGeoDatabasesFile(apiConfig: ClashAPIConfig) { return await fetch(url + updateGeoDatabasesFileEndpoint, { ...init, body, method: 'POST' }); } +export async function restartCore(apiConfig: ClashAPIConfig) { + const { url, init } = getURLAndInit(apiConfig); + const body = '{"path": "", "payload": ""}'; + return await fetch(url + restartCoreEndpoint, { ...init, body, method: 'POST' }); +} + +export async function upgradeCore(apiConfig: ClashAPIConfig) { + const { url, init } = getURLAndInit(apiConfig); + const body = '{"path": "", "payload": ""}'; + return await fetch(url + upgradeCoreEndpoint, { ...init, body, method: 'POST' }); +} + export async function flushFakeIPPool(apiConfig: ClashAPIConfig) { const { url, init } = getURLAndInit(apiConfig); return await fetch(url + flushFakeIPPoolEndpoint, { ...init, method: 'POST' }); |
