From 3cabaf7a3e187d7f1197b47053d9183b3c16d430 Mon Sep 17 00:00:00 2001 From: JeelsBoobz Date: Wed, 13 Sep 2023 09:35:25 +0700 Subject: [PATCH] refactor: add api Flush fake-ip --- src/apis/index.ts | 9 +++++++++ src/i18n/en.ts | 1 + src/i18n/zh.ts | 1 + src/pages/Config.tsx | 5 +++++ 4 files changed, 16 insertions(+) diff --git a/src/apis/index.ts b/src/apis/index.ts index b436704..4d66b56 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -45,6 +45,15 @@ export const upgradeBackendAPI = async () => { setUpgradingBackend(false) } +export const flushFakeIP = async () => { + const request = useRequest() + setUpgradingBackend(true) + try { + await request.post('cache/fakeip/flush') + } catch {} + setUpgradingBackend(false) +} + export const restartBackendAPI = async () => { const request = useRequest() setRestartingBackend(true) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index fdb71c6..244b715 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -50,6 +50,7 @@ export default { renderInTwoColumns: 'Render in two columns', updateGEODatabases: 'Update GEO Databases', restartCore: 'Restart Core', + flushFakeIP: 'Flush fake-ip', upgradeCore: 'Upgrade Core', proxiesSorting: 'Proxies Sorting', orderNatural: 'Original order in config file', diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts index fe48430..57f442f 100644 --- a/src/i18n/zh.ts +++ b/src/i18n/zh.ts @@ -50,6 +50,7 @@ export default { renderInTwoColumns: '双列渲染', updateGEODatabases: '更新 GEO 数据库文件', restartCore: '重启核心', + flushFakeIP: '清空 FakeIP', upgradeCore: '更新核心', proxiesSorting: '节点排序', orderNatural: '原配置文件中的排序', diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 22846e5..ee63a91 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -15,6 +15,7 @@ import { fetchBackendConfigAPI, fetchBackendVersionAPI, restartBackendAPI, + flushFakeIP, restartingBackend, updateBackendConfigAPI, updateGEODatabasesAPI, @@ -217,6 +218,10 @@ const ConfigForm = () => { {t('upgradeCore')} + +