diff --git a/src/FastGateway/Services/ProtectionService.cs b/src/FastGateway/Services/ProtectionService.cs index 7776ad1..4a54fff 100644 --- a/src/FastGateway/Services/ProtectionService.cs +++ b/src/FastGateway/Services/ProtectionService.cs @@ -119,6 +119,9 @@ public static class ProtectionService await masterDbContext.SaveChangesAsync(); + // 重新加载黑白名单 + await LoadBlacklistAndWhitelistAsync(masterDbContext); + return ResultDto.SuccessResult(); } @@ -207,6 +210,8 @@ public static class ProtectionService .SetProperty(i => i.Enable, blacklist.Enable) .SetProperty(i => i.Type, blacklist.Type)); + // 重新加载黑白名单 + await LoadBlacklistAndWhitelistAsync(masterDbContext); return ResultDto.SuccessResult(); } @@ -217,6 +222,9 @@ public static class ProtectionService .ExecuteDeleteAsync(); await masterDbContext.SaveChangesAsync(); + + // 重新加载黑白名单 + await LoadBlacklistAndWhitelistAsync(masterDbContext); } public static async Task>> GetBlacklistListAsync( @@ -240,5 +248,8 @@ public static class ProtectionService await masterDbContext.BlacklistAndWhitelists.Where(x => x.Id == id) .ExecuteUpdateAsync(x => x.SetProperty(i => i.Enable, enable)); + + // 重新加载黑白名单 + await LoadBlacklistAndWhitelistAsync(masterDbContext); } } \ No newline at end of file diff --git a/web/src/pages/http-proxy/features/CreateHttpProxy.tsx b/web/src/pages/http-proxy/features/CreateHttpProxy.tsx index 674653d..b826310 100644 --- a/web/src/pages/http-proxy/features/CreateHttpProxy.tsx +++ b/web/src/pages/http-proxy/features/CreateHttpProxy.tsx @@ -21,6 +21,7 @@ export default function CreateHttpProxy({ onClose, onOk, }: ICreateHttpProxyProps) { + return ( { values.enableBlacklist = v; formApi.setValues(values); @@ -182,6 +184,8 @@ export default function CreateHttpProxy({ values.enableWhitelist = v; formApi.setValues(values); }} + initValue={values.enableWhitelist} + defaultChecked={values.enableWhitelist} label={"白名单:" + (values.enableWhitelist ? '启用' : '停用')} style={{ marginTop: '5px', @@ -247,8 +251,6 @@ export default function CreateHttpProxy({ message: '域名不能为空', }]} onChange={(v: any) => { - console.log(v); - arrayField.serviceNames = v; formApi.setValues(values); }} diff --git a/web/src/pages/http-proxy/features/UpdateHttpProxy.tsx b/web/src/pages/http-proxy/features/UpdateHttpProxy.tsx index cd0db25..8d63aa0 100644 --- a/web/src/pages/http-proxy/features/UpdateHttpProxy.tsx +++ b/web/src/pages/http-proxy/features/UpdateHttpProxy.tsx @@ -136,7 +136,7 @@ export default function UpdateHttpProxy({ { values.enableBlacklist = v; formApi.setValues(values);