diff --git a/src/components/proxy-hosts/GeoBlockFields.tsx b/src/components/proxy-hosts/GeoBlockFields.tsx index 6447264b..fe41241d 100644 --- a/src/components/proxy-hosts/GeoBlockFields.tsx +++ b/src/components/proxy-hosts/GeoBlockFields.tsx @@ -13,7 +13,7 @@ import { Input } from "@/components/ui/input"; import { Switch } from "@/components/ui/switch"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { cn } from "@/lib/utils"; -import { Globe, X } from "lucide-react"; +import { Globe, Home, X } from "lucide-react"; import { useState, useEffect, useMemo, useCallback } from "react"; import { GeoBlockSettings } from "@/lib/settings"; import { GeoBlockMode } from "@/lib/models/proxy-hosts"; @@ -490,9 +490,10 @@ function ResponseHeadersEditor({ initialHeaders }: { initialHeaders: Record (initialValues?.geoblock_mode ?? "merge"); + const [resetKey, setResetKey] = useState(0); + const [initial, setInitial] = useState(rawInitial); + + function applyLanOnlyPreset() { + setEnabled(true); + setInitial((prev) => ({ + enabled: true, + block_countries: prev?.block_countries ?? [], + block_continents: prev?.block_continents ?? [], + block_asns: prev?.block_asns ?? [], + block_cidrs: [BLOCK_ALL_CIDR], + block_ips: prev?.block_ips ?? [], + allow_countries: prev?.allow_countries ?? [], + allow_continents: prev?.allow_continents ?? [], + allow_asns: prev?.allow_asns ?? [], + allow_cidrs: RFC1918_CIDRS, + allow_ips: prev?.allow_ips ?? [], + trusted_proxies: prev?.trusted_proxies ?? [], + fail_closed: prev?.fail_closed ?? false, + response_status: prev?.response_status ?? 403, + response_body: prev?.response_body ?? "Forbidden", + response_headers: prev?.response_headers ?? {}, + redirect_url: prev?.redirect_url ?? "", + })); + setResetKey((k) => k + 1); + } return (
@@ -636,6 +668,21 @@ export function GeoBlockFields({ initialValues, showModeSelector = true }: GeoBl )} {!showModeSelector &&
} + {/* Presets */} +
+ Presets: + +
+ {/* Block / Allow tabs */} @@ -643,13 +690,13 @@ export function GeoBlockFields({ initialValues, showModeSelector = true }: GeoBl Allow Rules - +

Allow rules take precedence over block rules.

- +