diff --git a/src/api/templates.js b/src/api/templates.js index 0ab5236..63e7c65 100644 --- a/src/api/templates.js +++ b/src/api/templates.js @@ -1,10 +1,25 @@ -const API_BASE = "/api"; +function apiBase() { + const raw = + (import.meta?.env?.VITE_API_BASE_URL || "") + .toString() + .replace(/\/+$/, ""); + if (raw) return raw + "/api"; + try { + if (typeof window !== "undefined") { + const host = window.location.hostname || ""; + if (host.startsWith("www.")) { + return `https://${host.replace(/^www\./, "")}/api`; + } + } + } catch {} + return "/api"; +} const cache = new Map(); // key -> Promise export async function fetchDefaultTemplate(typeKey = "news") { const t = (typeKey || "news").toLowerCase().trim(); - const res = await fetch(`${API_BASE}/templates/default?type=${encodeURIComponent(t)}`, { + const res = await fetch(`${apiBase()}/templates/default?type=${encodeURIComponent(t)}`, { credentials: "include", }); if (!res.ok) { diff --git a/src/components/Filters/TimeFilterButtons.jsx b/src/components/Filters/TimeFilterButtons.jsx index 41d5c57..47e8d80 100644 --- a/src/components/Filters/TimeFilterButtons.jsx +++ b/src/components/Filters/TimeFilterButtons.jsx @@ -5,7 +5,7 @@ export default function TimeFilterButtons({ active, onSelect }) { { code: "NOW", label: "Now", icon: "fa-solid fa-bolt" }, { code: "TODAY", label: "Today", icon: "fa-solid fa-sun" }, { code: "RECENT", label: "Recent", icon: "fa-solid fa-clock-rotate-left" }, - { code: "PAST", label: "Past", icon: "fa-solid fa-hourglass-half" }, + { code: "PAST", label: "Old", icon: "fa-solid fa-hourglass-half" }, ]; return ( diff --git a/src/components/Map/markerManager.js b/src/components/Map/markerManager.js index d02f813..268d4de 100644 --- a/src/components/Map/markerManager.js +++ b/src/components/Map/markerManager.js @@ -813,7 +813,6 @@ export function openCenteredOverlay({ map, post, theme, fullScreen = false }) {