merge: stack v2 into dnd-kit grid
This commit is contained in:
874 files changed
+86805
-31530
No files matched your search
@@ -1,6 +1,15 @@
|
||||
import type { HomarrDocumentationPath } from "./homarr-docs-sitemap";
|
||||
|
||||
const documentationBaseUrl = "https://homarr.dev";
|
||||
const defaultDocumentationBaseUrl = "https://homarr.dev";
|
||||
|
||||
const getDocumentationBaseUrl = () => {
|
||||
const browserValue =
|
||||
typeof document === "undefined"
|
||||
? undefined
|
||||
: document.querySelector<HTMLMetaElement>('meta[name="homarr-website-url"]')?.content;
|
||||
const serverValue = typeof process === "undefined" ? undefined : process.env.HOMARR_WEBSITE_URL;
|
||||
return (browserValue || serverValue || defaultDocumentationBaseUrl).replace(/\/+$/u, "");
|
||||
};
|
||||
|
||||
// Please use the method so the path can be checked!
|
||||
export const createDocumentationLink = (
|
||||
@@ -8,7 +17,7 @@ export const createDocumentationLink = (
|
||||
hashTag?: `#${string}`,
|
||||
queryParams?: Record<string, string>,
|
||||
) => {
|
||||
const url = `${documentationBaseUrl}${path}`;
|
||||
const url = `${getDocumentationBaseUrl()}${path}`;
|
||||
const params = queryParams ? `?${new URLSearchParams(queryParams)}` : "";
|
||||
return `${url}${params}${hashTag ?? ""}`;
|
||||
};
|
||||
@@ -30,6 +30,21 @@ describe("createDocumentationLink should generate correct URLs", () => {
|
||||
});
|
||||
|
||||
describe("createDocumentationLink parameter validation", () => {
|
||||
test("uses the server-rendered website URL at runtime", () => {
|
||||
const meta = document.createElement("meta");
|
||||
meta.name = "homarr-website-url";
|
||||
meta.content = "https://docs.example.com/base/";
|
||||
document.head.append(meta);
|
||||
|
||||
try {
|
||||
expect(createDocumentationLink("/docs/getting-started")).toBe(
|
||||
"https://docs.example.com/base/docs/getting-started",
|
||||
);
|
||||
} finally {
|
||||
meta.remove();
|
||||
}
|
||||
});
|
||||
|
||||
test("should work with only path parameter", () => {
|
||||
const result = createDocumentationLink("/docs/getting-started");
|
||||
expect(result).toBe("https://homarr.dev/docs/getting-started");
|
||||
|
||||
@@ -27,7 +27,7 @@ export const widgetIntegrationSupport: Partial<Record<WidgetKind, readonly Integ
|
||||
healthMonitoring: getIntegrationKindsByCategory("healthMonitoring").filter((kind) => kind !== "patchmon"),
|
||||
firewall: getIntegrationKindsByCategory("firewall"),
|
||||
notifications: getIntegrationKindsByCategory("notifications"),
|
||||
mediaReleases: ["emby", "jellyfin", "plex"],
|
||||
mediaReleases: ["mock", "emby", "jellyfin", "plex"],
|
||||
systemResources: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology"],
|
||||
systemDisks: ["dashDot", "openmediavault", "truenas", "unraid", "synology"],
|
||||
coolify: ["coolify"],
|
||||
@@ -40,7 +40,13 @@ export const widgetIntegrationSupport: Partial<Record<WidgetKind, readonly Integ
|
||||
speedtestTracker: ["speedtestTracker"],
|
||||
uptimeKuma: ["uptimeKuma"],
|
||||
audioStats: ["navidrome", "audiobookshelf"],
|
||||
umami: ["umami"],
|
||||
vpn: getIntegrationKindsByCategory("vpn"),
|
||||
ups: getIntegrationKindsByCategory("ups"),
|
||||
beszelSystemTable: ["beszel", "mock"],
|
||||
beszelSystemGrid: ["beszel", "mock"],
|
||||
beszelAlerts: ["beszel", "mock"],
|
||||
beszelSystemStats: ["beszel", "mock"],
|
||||
archiveTeamWarrior: ["archiveTeamWarrior"],
|
||||
anchorNote: ["anchor"],
|
||||
traefik: ["traefik"],
|
||||
|
||||
Reference in new issue
Block a user