Revert "Fix: subdirectory deployment (#2205)"

This revers commit b8eda91005
pull/2209/head v0.7.4
shamoon 1 year ago
parent 9e3bc8e64f
commit 8ec488efbd

@ -2,7 +2,6 @@ const { i18n } = require("./next-i18next.config");
/** @type {import('next').NextConfig} */
const nextConfig = {
assetPrefix: ".",
reactStrictMode: true,
output: "standalone",
swcMinify: false,

@ -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,
});

@ -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 = "";

@ -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();
}

@ -12,7 +12,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) => {

@ -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,
},

@ -25,7 +25,7 @@ export default function Widget({ options }) {
},
};
const { data, error } = useSWR(`api/widgets/kubernetes?${new URLSearchParams({ lang: i18n.language }).toString()}`, {
const { data, error } = useSWR(`/api/widgets/kubernetes?${new URLSearchParams({ lang: i18n.language }).toString()}`, {
refreshInterval: 1500,
});

@ -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,
});

@ -15,7 +15,7 @@ import mapIcon from "../../../utils/weather/openmeteo-condition-map";
function Widget({ options }) {
const { t } = useTranslation();
const { data, error } = useSWR(`api/widgets/openmeteo?${new URLSearchParams({ ...options }).toString()}`);
const { data, error } = useSWR(`/api/widgets/openmeteo?${new URLSearchParams({ ...options }).toString()}`);
if (error || data?.error) {
return <Error options={options} />;

@ -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) {

@ -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,
});

@ -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,
});

@ -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,
});

@ -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,
});

@ -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,
});

@ -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) {

@ -9,8 +9,8 @@ export default function Document() {
content="A highly customizable homepage (or startpage / application dashboard) with Docker and service API integrations."
/>
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="manifest" href="site.webmanifest?v=4" crossOrigin="use-credentials" />
<link rel="mask-icon" href="safari-pinned-tab.svg?v=4" color="#1e9cd7" />
<link rel="manifest" href="/site.webmanifest?v=4" crossOrigin="use-credentials" />
<link rel="mask-icon" href="/safari-pinned-tab.svg?v=4" color="#1e9cd7" />
</Head>
<body>
<Main />

@ -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(),
@ -368,17 +368,17 @@ function Home({ initialSettings }) {
</>
) : (
<>
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png?v=4" />
<link rel="shortcut icon" href="homepage.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png?v=4" />
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png?v=4" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=4" />
<link rel="shortcut icon" href="/homepage.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png?v=4" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png?v=4" />
</>
)}
<meta name="msapplication-TileColor" content={themes[settings.color || "slate"][settings.theme || "dark"]} />
<meta name="theme-color" content={themes[settings.color || "slate"][settings.theme || "dark"]} />
</Head>
<link rel="preload" href="api/config/custom.css" as="fetch" crossOrigin="anonymous" />
<link rel="preload" href="/api/config/custom.css" as="fetch" crossOrigin="anonymous" />
<style data-name="custom.css">
<FileContent
path="custom.css"
@ -387,7 +387,7 @@ function Home({ initialSettings }) {
emptyValue="/* No custom CSS */"
/>
</style>
<link rel="preload" href="api/config/custom.js" as="fetch" crossOrigin="anonymous" />
<link rel="preload" href="/api/config/custom.js" as="fetch" crossOrigin="anonymous" />
<script data-name="custom.js" src="/api/config/custom.js" async />
<div className="relative container m-auto flex flex-col justify-start z-10 h-full">

@ -23,7 +23,7 @@ export function formatProxyUrlWithSegments(widget, endpoint, segments) {
if (segments) {
params.append("segments", JSON.stringify(segments));
}
return `api/services/proxy?${params.toString()}`;
return `/api/services/proxy?${params.toString()}`;
}
export function formatProxyUrl(widget, endpoint, queryParams) {
@ -31,7 +31,7 @@ export function formatProxyUrl(widget, endpoint, queryParams) {
if (queryParams) {
params.append("query", JSON.stringify(queryParams));
}
return `api/services/proxy?${params.toString()}`;
return `/api/services/proxy?${params.toString()}`;
}
export function asJson(data) {

@ -12,10 +12,10 @@ export default function Component({ service }) {
const { widget } = service;
const { data: statusData, error: statusError } = useSWR(
`api/docker/status/${widget.container}/${widget.server || ""}`,
`/api/docker/status/${widget.container}/${widget.server || ""}`,
);
const { data: statsData, error: statsError } = useSWR(`api/docker/stats/${widget.container}/${widget.server || ""}`);
const { data: statsData, error: statsError } = useSWR(`/api/docker/stats/${widget.container}/${widget.server || ""}`);
if (statsError || statsData?.error || statusError || statusData?.error) {
const finalError = statsError ?? statsData?.error ?? statusError ?? statusData?.error;

Loading…
Cancel
Save