diff --git a/changelog.d/fixes/7547-prefer-public-endpoint-url.md b/changelog.d/fixes/7547-prefer-public-endpoint-url.md new file mode 100644 index 0000000000..387f0d09a1 --- /dev/null +++ b/changelog.d/fixes/7547-prefer-public-endpoint-url.md @@ -0,0 +1 @@ +- **fix(dashboard):** Public and managed tunnel endpoints now take precedence over loopback URLs in dashboard setup and copyable API configuration ([#7547](https://github.com/diegosouzapw/OmniRoute/pull/7547)) — thanks @nguyenha935 diff --git a/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx b/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx index 54e27f4991..f2972f1ccc 100644 --- a/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx +++ b/src/app/(dashboard)/dashboard/endpoint/EndpointPageClient.tsx @@ -5,7 +5,7 @@ import Link from "next/link"; import { Card, Button, Input, Modal, CardSkeleton, SegmentedControl } from "@/shared/components"; import Toggle from "@/shared/components/Toggle"; import { useCopyToClipboard } from "@/shared/hooks/useCopyToClipboard"; -import { useDisplayBaseUrl } from "@/shared/hooks"; +import { isPublicDisplayBaseUrl, useDisplayBaseUrl } from "@/shared/hooks"; import { AI_PROVIDERS, getProviderByAlias } from "@/shared/constants/providers"; import { getProviderDisplayName } from "@/lib/display/names"; import { useTranslations } from "next-intl"; @@ -19,12 +19,7 @@ const CLOUD_ACTION_TIMEOUT_MS = 15000; type TranslationValues = Record; type CloudflaredTunnelPhase = - | "unsupported" - | "not_installed" - | "stopped" - | "starting" - | "running" - | "error"; + "unsupported" | "not_installed" | "stopped" | "starting" | "running" | "error"; type CloudflaredTunnelStatus = { supported: boolean; @@ -43,12 +38,7 @@ type CloudflaredTunnelStatus = { }; type TailscaleTunnelPhase = - | "unsupported" - | "not_installed" - | "needs_login" - | "stopped" - | "running" - | "error"; + "unsupported" | "not_installed" | "needs_login" | "stopped" | "running" | "error"; type TailscaleTunnelStatus = { supported: boolean; @@ -70,13 +60,7 @@ type TailscaleTunnelStatus = { }; type NgrokTunnelPhase = - | "unsupported" - | "not_installed" - | "stopped" - | "needs_auth" - | "starting" - | "running" - | "error"; + "unsupported" | "not_installed" | "stopped" | "needs_auth" | "starting" | "running" | "error"; type NgrokTunnelStatus = { supported: boolean; @@ -187,6 +171,7 @@ export default function APIPageClient({ machineId }: Readonly(null); + const [localApiUrl, setLocalApiUrl] = useState("http://localhost:20128/v1"); const [lanUrls, setLanUrls] = useState([]); const [tailscaleIpUrl, setTailscaleIpUrl] = useState(null); const [activeEndpointTab, setActiveEndpointTab] = useState("apis"); @@ -335,6 +320,7 @@ export default function APIPageClient({ machineId }: Readonly + candidates.findIndex((other) => other.url === candidate.url) === index + ); const visibleTunnelCount = [showCloudflaredTunnel, showTailscaleFunnel, showNgrokTunnel].filter( Boolean ).length; @@ -1357,7 +1355,7 @@ export default function APIPageClient({ machineId }: Readonly