diff --git a/next.config.js b/next.config.js index dae78ca01..acdf704dc 100644 --- a/next.config.js +++ b/next.config.js @@ -2,6 +2,7 @@ const { i18n } = require("./next-i18next.config"); /** @type {import('next').NextConfig} */ const nextConfig = { + assetPrefix: ".", reactStrictMode: true, output: "standalone", swcMinify: false, diff --git a/src/components/services/ping.jsx b/src/components/services/ping.jsx index 5d8068ffb..8785325cb 100644 --- a/src/components/services/ping.jsx +++ b/src/components/services/ping.jsx @@ -3,7 +3,7 @@ import useSWR from "swr"; export default function Ping({ group, service, style }) { const { t } = useTranslation(); - const { data, error } = useSWR(`/api/ping?${new URLSearchParams({ group, service }).toString()}`, { + const { data, error } = useSWR(`api/ping?${new URLSearchParams({ group, service }).toString()}`, { refreshInterval: 30000 }); diff --git a/src/components/services/status.jsx b/src/components/services/status.jsx index 041c5d82c..7adc912db 100644 --- a/src/components/services/status.jsx +++ b/src/components/services/status.jsx @@ -4,7 +4,7 @@ import useSWR from "swr"; export default function Status({ service, style }) { const { t } = useTranslation(); - const { data, error } = useSWR(`/api/docker/status/${service.container}/${service.server || ""}`); + const { data, error } = useSWR(`api/docker/status/${service.container}/${service.server || ""}`); let statusLabel = t("docker.unknown"); let statusTitle = ""; diff --git a/src/components/toggles/revalidate.jsx b/src/components/toggles/revalidate.jsx index 14fe8b377..c17f4abe3 100644 --- a/src/components/toggles/revalidate.jsx +++ b/src/components/toggles/revalidate.jsx @@ -2,7 +2,7 @@ import { MdRefresh } from "react-icons/md"; export default function Revalidate() { const revalidate = () => { - fetch("/api/revalidate").then((res) => { + fetch("api/revalidate").then((res) => { if (res.ok) { window.location.reload(); } diff --git a/src/components/version.jsx b/src/components/version.jsx index a71ee49e1..4abf21a41 100644 --- a/src/components/version.jsx +++ b/src/components/version.jsx @@ -10,7 +10,7 @@ export default function Version() { const revision = process.env.NEXT_PUBLIC_REVISION?.length ? process.env.NEXT_PUBLIC_REVISION : "dev"; const version = process.env.NEXT_PUBLIC_VERSION?.length ? process.env.NEXT_PUBLIC_VERSION : "dev"; - const { data: releaseData } = useSWR("/api/releases"); + const { data: releaseData } = useSWR("api/releases"); // use Intl.DateTimeFormat to format the date const formatDate = (date) => { diff --git a/src/components/widgets/glances/glances.jsx b/src/components/widgets/glances/glances.jsx index 9a746d2e2..972ba0764 100644 --- a/src/components/widgets/glances/glances.jsx +++ b/src/components/widgets/glances/glances.jsx @@ -23,7 +23,7 @@ export default function Widget({ options }) { const { settings } = useContext(SettingsContext); const { data, error } = useSWR( - `/api/widgets/glances?${new URLSearchParams({ lang: i18n.language, ...options }).toString()}`, { + `api/widgets/glances?${new URLSearchParams({ lang: i18n.language, ...options }).toString()}`, { refreshInterval: 1500, } ); diff --git a/src/components/widgets/kubernetes/kubernetes.jsx b/src/components/widgets/kubernetes/kubernetes.jsx index 2a9da46ae..3610ceab4 100644 --- a/src/components/widgets/kubernetes/kubernetes.jsx +++ b/src/components/widgets/kubernetes/kubernetes.jsx @@ -26,7 +26,7 @@ export default function Widget({ options }) { }; const { data, error } = useSWR( - `/api/widgets/kubernetes?${new URLSearchParams({ lang: i18n.language }).toString()}`, { + `api/widgets/kubernetes?${new URLSearchParams({ lang: i18n.language }).toString()}`, { refreshInterval: 1500 } ); diff --git a/src/components/widgets/longhorn/longhorn.jsx b/src/components/widgets/longhorn/longhorn.jsx index 538d24cca..f3743fa42 100644 --- a/src/components/widgets/longhorn/longhorn.jsx +++ b/src/components/widgets/longhorn/longhorn.jsx @@ -8,7 +8,7 @@ import Node from "./node"; export default function Longhorn({ options }) { const { expanded, total, labels, include, nodes } = options; - const { data, error } = useSWR(`/api/widgets/longhorn`, { + const { data, error } = useSWR(`api/widgets/longhorn`, { refreshInterval: 1500 }); diff --git a/src/components/widgets/openmeteo/openmeteo.jsx b/src/components/widgets/openmeteo/openmeteo.jsx index 266633502..eaf2e166b 100644 --- a/src/components/widgets/openmeteo/openmeteo.jsx +++ b/src/components/widgets/openmeteo/openmeteo.jsx @@ -16,7 +16,7 @@ function Widget({ options }) { const { t } = useTranslation(); const { data, error } = useSWR( - `/api/widgets/openmeteo?${new URLSearchParams({ ...options }).toString()}` + `api/widgets/openmeteo?${new URLSearchParams({ ...options }).toString()}` ); if (error || data?.error) { diff --git a/src/components/widgets/openweathermap/weather.jsx b/src/components/widgets/openweathermap/weather.jsx index 2458e3c6e..8ca75b00b 100644 --- a/src/components/widgets/openweathermap/weather.jsx +++ b/src/components/widgets/openweathermap/weather.jsx @@ -16,7 +16,7 @@ function Widget({ options }) { const { t, i18n } = useTranslation(); const { data, error } = useSWR( - `/api/widgets/openweathermap?${new URLSearchParams({ lang: i18n.language, ...options }).toString()}` + `api/widgets/openweathermap?${new URLSearchParams({ lang: i18n.language, ...options }).toString()}` ); if (error || data?.cod === 401 || data?.error) { diff --git a/src/components/widgets/resources/cpu.jsx b/src/components/widgets/resources/cpu.jsx index 514b845f6..82e780195 100644 --- a/src/components/widgets/resources/cpu.jsx +++ b/src/components/widgets/resources/cpu.jsx @@ -8,7 +8,7 @@ import Error from "../widget/error"; export default function Cpu({ expanded, refresh = 1500 }) { const { t } = useTranslation(); - const { data, error } = useSWR(`/api/widgets/resources?type=cpu`, { + const { data, error } = useSWR(`api/widgets/resources?type=cpu`, { refreshInterval: refresh, }); diff --git a/src/components/widgets/resources/cputemp.jsx b/src/components/widgets/resources/cputemp.jsx index 684fe2f6d..24250030d 100644 --- a/src/components/widgets/resources/cputemp.jsx +++ b/src/components/widgets/resources/cputemp.jsx @@ -12,7 +12,7 @@ function convertToFahrenheit(t) { export default function CpuTemp({ expanded, units, refresh = 1500 }) { const { t } = useTranslation(); - const { data, error } = useSWR(`/api/widgets/resources?type=cputemp`, { + const { data, error } = useSWR(`api/widgets/resources?type=cputemp`, { refreshInterval: refresh, }); diff --git a/src/components/widgets/resources/disk.jsx b/src/components/widgets/resources/disk.jsx index 7048bb2b2..75c9988c8 100644 --- a/src/components/widgets/resources/disk.jsx +++ b/src/components/widgets/resources/disk.jsx @@ -8,7 +8,7 @@ import Error from "../widget/error"; export default function Disk({ options, expanded, refresh = 1500 }) { const { t } = useTranslation(); - const { data, error } = useSWR(`/api/widgets/resources?type=disk&target=${options.disk}`, { + const { data, error } = useSWR(`api/widgets/resources?type=disk&target=${options.disk}`, { refreshInterval: refresh, }); diff --git a/src/components/widgets/resources/memory.jsx b/src/components/widgets/resources/memory.jsx index c3dbb277b..81de288fc 100644 --- a/src/components/widgets/resources/memory.jsx +++ b/src/components/widgets/resources/memory.jsx @@ -8,7 +8,7 @@ import Error from "../widget/error"; export default function Memory({ expanded, refresh = 1500 }) { const { t } = useTranslation(); - const { data, error } = useSWR(`/api/widgets/resources?type=memory`, { + const { data, error } = useSWR(`api/widgets/resources?type=memory`, { refreshInterval: refresh, }); diff --git a/src/components/widgets/resources/uptime.jsx b/src/components/widgets/resources/uptime.jsx index 73ec0a35e..81a5f76b1 100644 --- a/src/components/widgets/resources/uptime.jsx +++ b/src/components/widgets/resources/uptime.jsx @@ -8,7 +8,7 @@ import Error from "../widget/error"; export default function Uptime({ refresh = 1500 }) { const { t } = useTranslation(); - const { data, error } = useSWR(`/api/widgets/resources?type=uptime`, { + const { data, error } = useSWR(`api/widgets/resources?type=uptime`, { refreshInterval: refresh, }); diff --git a/src/components/widgets/weather/weather.jsx b/src/components/widgets/weather/weather.jsx index 08ebf774e..86fdda15a 100644 --- a/src/components/widgets/weather/weather.jsx +++ b/src/components/widgets/weather/weather.jsx @@ -16,7 +16,7 @@ function Widget({ options }) { const { t, i18n } = useTranslation(); const { data, error } = useSWR( - `/api/widgets/weather?${new URLSearchParams({ lang: i18n.language, ...options }).toString()}` + `api/widgets/weather?${new URLSearchParams({ lang: i18n.language, ...options }).toString()}` ); if (error || data?.error) { diff --git a/src/pages/_document.jsx b/src/pages/_document.jsx index c9a6c29e1..0698f6caa 100644 --- a/src/pages/_document.jsx +++ b/src/pages/_document.jsx @@ -9,8 +9,8 @@ export default function Document() { content="A highly customizable homepage (or startpage / application dashboard) with Docker and service API integrations." /> - - + +
diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 201f472cb..10f3b8787 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -56,10 +56,10 @@ export async function getStaticProps() { props: { initialSettings: settings, fallback: { - "/api/services": services, - "/api/bookmarks": bookmarks, - "/api/widgets": widgets, - "/api/hash": false, + "api/services": services, + "api/bookmarks": bookmarks, + "api/widgets": widgets, + "api/hash": false, }, ...(await serverSideTranslations(settings.language ?? "en")), }, @@ -72,10 +72,10 @@ export async function getStaticProps() { props: { initialSettings: {}, fallback: { - "/api/services": [], - "/api/bookmarks": [], - "/api/widgets": [], - "/api/hash": false, + "api/services": [], + "api/bookmarks": [], + "api/widgets": [], + "api/hash": false, }, ...(await serverSideTranslations("en")), }, @@ -86,8 +86,8 @@ export async function getStaticProps() { function Index({ initialSettings, fallback }) { const windowFocused = useWindowFocus(); const [stale, setStale] = useState(false); - const { data: errorsData } = useSWR("/api/validate"); - const { data: hashData, mutate: mutateHash } = useSWR("/api/hash"); + const { data: errorsData } = useSWR("api/validate"); + const { data: hashData, mutate: mutateHash } = useSWR("api/hash"); useEffect(() => { if (windowFocused) { @@ -108,7 +108,7 @@ function Index({ initialSettings, fallback }) { setStale(true); localStorage.setItem("hash", hashData.hash); - fetch("/api/revalidate").then((res) => { + fetch("api/revalidate").then((res) => { if (res.ok) { window.location.reload(); } @@ -179,9 +179,9 @@ function Home({ initialSettings }) { setSettings(initialSettings); }, [initialSettings, setSettings]); - const { data: services } = useSWR("/api/services"); - const { data: bookmarks } = useSWR("/api/bookmarks"); - const { data: widgets } = useSWR("/api/widgets"); + const { data: services } = useSWR("api/services"); + const { data: bookmarks } = useSWR("api/bookmarks"); + const { data: widgets } = useSWR("api/widgets"); const servicesAndBookmarks = [...services.map(sg => sg.services).flat(), ...bookmarks.map(bg => bg.bookmarks).flat()].filter(i => i?.href); @@ -343,17 +343,17 @@ function Home({ initialSettings }) { > ) : ( <> - - - - + + + + > )} - + - +