fix hardcoded leading-slash hrefs to respect FRIGATE_BASE_PATH

This commit is contained in:
Josh Hawkins 2026-05-16 19:28:16 -05:00
parent 7413ce08d4
commit 6b99b3fc3e
11 changed files with 51 additions and 11 deletions

View File

@ -6,6 +6,7 @@ import {
isRedirectingToLogin,
setRedirectingToLogin,
} from "@/api/auth-redirect";
import { baseUrl } from "@/api/baseUrl";
export default function ProtectedRoute({
requiredRoles,
@ -24,7 +25,7 @@ export default function ProtectedRoute({
!isRedirectingToLogin()
) {
setRedirectingToLogin(true);
window.location.href = "/login";
window.location.href = `${baseUrl}login`;
}
}, [auth.isLoading, auth.isAuthenticated, auth.user]);

View File

@ -94,7 +94,11 @@ export default function ReviewCard({
toast.success(t("export.toast.success"), {
position: "top-center",
action: (
<a href="/export" target="_blank" rel="noopener noreferrer">
<a
href={`${baseUrl}export`}
target="_blank"
rel="noopener noreferrer"
>
<Button>{t("export.toast.view")}</Button>
</a>
),

View File

@ -1,4 +1,5 @@
import { useApiHost } from "@/api";
import { baseUrl } from "@/api/baseUrl";
import { useCameraFriendlyName } from "@/hooks/use-camera-friendly-name";
import { useTranslation } from "react-i18next";
import useSWR from "swr";
@ -79,7 +80,7 @@ export function ChatAttachmentChip({
<Tooltip>
<TooltipTrigger asChild>
<a
href={`/explore?event_id=${eventId}`}
href={`${baseUrl}explore?event_id=${eventId}`}
target="_blank"
rel="noopener noreferrer"
className={cn(

View File

@ -1,4 +1,5 @@
import { useApiHost } from "@/api";
import { baseUrl } from "@/api/baseUrl";
import { useTranslation } from "react-i18next";
import { LuExternalLink } from "react-icons/lu";
import {
@ -54,7 +55,7 @@ export function ChatEventThumbnailsRow({
<Tooltip>
<TooltipTrigger asChild>
<a
href={`/explore?event_id=${event.id}`}
href={`${baseUrl}explore?event_id=${event.id}`}
target="_blank"
rel="noopener noreferrer"
onClick={(e) => e.stopPropagation()}

View File

@ -116,7 +116,11 @@ export default function SearchResultActions({
closeButton: true,
dismissible: false,
action: (
<a href="/replay" target="_blank" rel="noopener noreferrer">
<a
href={`${baseUrl}replay`}
target="_blank"
rel="noopener noreferrer"
>
<Button>
{t("dialog.toast.goToReplay", { ns: "views/replay" })}
</Button>

View File

@ -1,4 +1,5 @@
import { useCallback, useState } from "react";
import { baseUrl } from "@/api/baseUrl";
import {
Dialog,
DialogContent,
@ -227,7 +228,11 @@ export default function DebugReplayDialog({
closeButton: true,
dismissible: false,
action: (
<a href="/replay" target="_blank" rel="noopener noreferrer">
<a
href={`${baseUrl}replay`}
target="_blank"
rel="noopener noreferrer"
>
<Button>{t("dialog.toast.goToReplay")}</Button>
</a>
),

View File

@ -163,7 +163,11 @@ export default function ExportDialog({
toast.success(t("export.toast.queued"), {
position: "top-center",
action: (
<a href="/export" target="_blank" rel="noopener noreferrer">
<a
href={`${baseUrl}export`}
target="_blank"
rel="noopener noreferrer"
>
<Button>{t("export.toast.view")}</Button>
</a>
),

View File

@ -1,4 +1,5 @@
import { useCallback, useState } from "react";
import { baseUrl } from "@/api/baseUrl";
import { Drawer, DrawerContent, DrawerTrigger } from "../ui/drawer";
import { Button } from "../ui/button";
import { FaArrowDown, FaCalendarAlt, FaCog, FaFilter } from "react-icons/fa";
@ -190,7 +191,11 @@ export default function MobileReviewSettingsDrawer({
toast.success(t("export.toast.queued", { ns: "components/dialog" }), {
position: "top-center",
action: (
<a href="/export" target="_blank" rel="noopener noreferrer">
<a
href={`${baseUrl}export`}
target="_blank"
rel="noopener noreferrer"
>
<Button>
{t("export.toast.view", { ns: "components/dialog" })}
</Button>

View File

@ -8,6 +8,7 @@ import {
} from "@/components/ui/dropdown-menu";
import { HiDotsHorizontal } from "react-icons/hi";
import { useApiHost } from "@/api";
import { baseUrl } from "@/api/baseUrl";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Event } from "@/types/event";
@ -79,7 +80,11 @@ export default function EventMenu({
closeButton: true,
dismissible: false,
action: (
<a href="/replay" target="_blank" rel="noopener noreferrer">
<a
href={`${baseUrl}replay`}
target="_blank"
rel="noopener noreferrer"
>
<Button>
{t("dialog.toast.goToReplay", { ns: "views/replay" })}
</Button>

View File

@ -49,6 +49,7 @@ import { FiMoreVertical } from "react-icons/fi";
import { IoMdArrowRoundBack } from "react-icons/io";
import useSWR from "swr";
import MotionReviewTimeline from "@/components/timeline/MotionReviewTimeline";
import { baseUrl } from "@/api/baseUrl";
import { Button } from "@/components/ui/button";
import BlurredIconButton from "@/components/button/BlurredIconButton";
import {
@ -284,7 +285,11 @@ export default function EventView({
{
position: "top-center",
action: (
<a href="/export" target="_blank" rel="noopener noreferrer">
<a
href={`${baseUrl}export`}
target="_blank"
rel="noopener noreferrer"
>
<Button>
{t("export.toast.view", { ns: "components/dialog" })}
</Button>

View File

@ -3,6 +3,7 @@ import { useTranslation } from "react-i18next";
import useSWR from "swr";
import axios from "axios";
import { isDesktop, isMobile } from "react-device-detect";
import { baseUrl } from "@/api/baseUrl";
import Logo from "@/components/Logo";
import { FrigateConfig } from "@/types/frigateConfig";
import { TimeRange } from "@/types/timeline";
@ -363,7 +364,11 @@ export default function MotionSearchView({
{
position: "top-center",
action: (
<a href="/export" target="_blank" rel="noopener noreferrer">
<a
href={`${baseUrl}export`}
target="_blank"
rel="noopener noreferrer"
>
<Button>
{t("export.toast.view", { ns: "components/dialog" })}
</Button>