Compare commits

..
Author SHA1 Message Date
ajnart 3131b9d923 fix(docs): generate valid integration links 2026-09-06 09:50:52 +02:00
6 changed files with 34 additions and 98 deletions

No files matched your search

+8 -8
View File
@@ -74,7 +74,7 @@
</a> </a>
</td> </td>
<td align="center"> <td align="center">
<a href="null" target="_blank" rel="noreferrer noopener"> <a href="https://homarr.dev/docs/integrations/archiveteam-warrior" target="_blank" rel="noreferrer noopener">
<img src="https://cdn.jsdelivr.net/gh/selfhst/icons/png/archiveteam-warrior.png" alt="ArchiveTeam Warrior" width="90" height="90" /> <img src="https://cdn.jsdelivr.net/gh/selfhst/icons/png/archiveteam-warrior.png" alt="ArchiveTeam Warrior" width="90" height="90" />
<br/> <br/>
<p align="center">ArchiveTeam<br/>Warrior</p> <p align="center">ArchiveTeam<br/>Warrior</p>
@@ -88,7 +88,7 @@
</a> </a>
</td> </td>
<td align="center"> <td align="center">
<a href="null" target="_blank" rel="noreferrer noopener"> <a href="https://homarr.dev/docs/integrations/audiobookshelf" target="_blank" rel="noreferrer noopener">
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/audiobookshelf.svg" alt="Audiobookshelf" width="90" height="90" /> <img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/audiobookshelf.svg" alt="Audiobookshelf" width="90" height="90" />
<br/> <br/>
<p align="center">Audiobookshelf</p> <p align="center">Audiobookshelf</p>
@@ -137,7 +137,7 @@
</a> </a>
</td> </td>
<td align="center"> <td align="center">
<a href="null" target="_blank" rel="noreferrer noopener"> <a href="https://homarr.dev/docs/integrations/glances" target="_blank" rel="noreferrer noopener">
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/glances.svg" alt="Glances" width="90" height="90" /> <img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/glances.svg" alt="Glances" width="90" height="90" />
<br/> <br/>
<p align="center">Glances</p> <p align="center">Glances</p>
@@ -200,7 +200,7 @@
</a> </a>
</td> </td>
<td align="center"> <td align="center">
<a href="null" target="_blank" rel="noreferrer noopener"> <a href="https://homarr.dev/docs/integrations/navidrome" target="_blank" rel="noreferrer noopener">
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/navidrome.svg" alt="Navidrome" width="90" height="90" /> <img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/navidrome.svg" alt="Navidrome" width="90" height="90" />
<br/> <br/>
<p align="center">Navidrome</p> <p align="center">Navidrome</p>
@@ -249,7 +249,7 @@
</a> </a>
</td> </td>
<td align="center"> <td align="center">
<a href="null" target="_blank" rel="noreferrer noopener"> <a href="https://homarr.dev/docs/integrations/paperless-ngx" target="_blank" rel="noreferrer noopener">
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/paperless-ngx.svg" alt="Paperless-ngx" width="90" height="90" /> <img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/paperless-ngx.svg" alt="Paperless-ngx" width="90" height="90" />
<br/> <br/>
<p align="center">Paperless-ngx</p> <p align="center">Paperless-ngx</p>
@@ -263,7 +263,7 @@
</a> </a>
</td> </td>
<td align="center"> <td align="center">
<a href="null" target="_blank" rel="noreferrer noopener"> <a href="https://homarr.dev/docs/integrations/peanut" target="_blank" rel="noreferrer noopener">
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/peanut.svg" alt="PeaNUT" width="90" height="90" /> <img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/peanut.svg" alt="PeaNUT" width="90" height="90" />
<br/> <br/>
<p align="center">PeaNUT</p> <p align="center">PeaNUT</p>
@@ -313,7 +313,7 @@
</td> </td>
<td align="center"> <td align="center">
<a href="https://homarr.dev/docs/integrations/readarr" target="_blank" rel="noreferrer noopener"> <a href="https://homarr.dev/docs/integrations/readarr" target="_blank" rel="noreferrer noopener">
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/readarr.svg" alt="Readarr" width="90" height="90" /> <img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@main/png/readarr.png" alt="Readarr" width="90" height="90" />
<br/> <br/>
<p align="center">Readarr</p> <p align="center">Readarr</p>
</a> </a>
@@ -424,7 +424,7 @@
</a> </a>
</td> </td>
<td align="center"> <td align="center">
<a href="null" target="_blank" rel="noreferrer noopener"> <a href="https://homarr.dev/docs/integrations/uptime-kuma" target="_blank" rel="noreferrer noopener">
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/uptime-kuma.svg" alt="Uptime Kuma" width="90" height="90" /> <img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/uptime-kuma.svg" alt="Uptime Kuma" width="90" height="90" />
<br/> <br/>
<p align="center">Uptime<br/>Kuma</p> <p align="center">Uptime<br/>Kuma</p>
@@ -1,13 +0,0 @@
export const createNextcloudCalendarServerUrl = (integrationUrl: string) => {
const calendarServerUrl = new URL(integrationUrl);
const integrationPath = calendarServerUrl.pathname.replace(/\/+$/, "");
const davPath = "/remote.php/dav";
calendarServerUrl.pathname = integrationPath.endsWith(davPath)
? `${integrationPath}/`
: `${integrationPath}${davPath}/`;
calendarServerUrl.search = "";
calendarServerUrl.hash = "";
return calendarServerUrl.toString();
};
@@ -21,7 +21,6 @@ import type { ICalendarIntegration } from "../interfaces/calendar/calendar-integ
import type { CalendarEvent } from "../interfaces/calendar/calendar-types"; import type { CalendarEvent } from "../interfaces/calendar/calendar-types";
import type { Notification } from "../interfaces/notifications/notification-types"; import type { Notification } from "../interfaces/notifications/notification-types";
import type { INotificationsIntegration } from "../interfaces/notifications/notifications-integration"; import type { INotificationsIntegration } from "../interfaces/notifications/notifications-integration";
import { createNextcloudCalendarServerUrl } from "./nextcloud-url";
// Register all existing timezones // Register all existing timezones
if (ICAL.TimezoneService.count === 0) { if (ICAL.TimezoneService.count === 0) {
@@ -190,7 +189,7 @@ export class NextcloudIntegration extends Integration implements ICalendarIntegr
private async createCalendarClientAsync(agent?: Agent) { private async createCalendarClientAsync(agent?: Agent) {
return new DAVClient({ return new DAVClient({
serverUrl: createNextcloudCalendarServerUrl(this.integration.url), serverUrl: this.integration.url,
credentials: { credentials: {
username: this.getSecretValue("username"), username: this.getSecretValue("username"),
password: this.getSecretValue("password"), password: this.getSecretValue("password"),
@@ -1,38 +0,0 @@
import type { Agent } from "node:https";
import { DAVClient } from "tsdav";
import { beforeEach, describe, expect, test, vi } from "vitest";
import { NextcloudIntegration } from "../nextcloud.integration";
vi.mock("tsdav", () => ({ DAVClient: vi.fn() }));
interface NextcloudCalendarClientFactory {
createCalendarClientAsync(agent: Agent): Promise<unknown>;
}
describe("NextcloudIntegration", () => {
beforeEach(() => {
vi.mocked(DAVClient).mockClear();
});
test("uses a calendar server URL that preserves the integration subpath", async () => {
const integration = new NextcloudIntegration({
id: "integration-id",
name: "Nextcloud",
url: "https://example.com/nextcloud",
externalUrl: null,
decryptedSecrets: [
{ kind: "username", value: "admin" },
{ kind: "password", value: "password" },
],
});
await (integration as unknown as NextcloudCalendarClientFactory).createCalendarClientAsync({} as Agent);
expect(DAVClient).toHaveBeenCalledWith(
expect.objectContaining({
serverUrl: "https://example.com/nextcloud/remote.php/dav/",
}),
);
});
});
@@ -1,29 +0,0 @@
import { describe, expect, test } from "vitest";
import { createNextcloudCalendarServerUrl } from "../nextcloud-url";
describe("createNextcloudCalendarServerUrl", () => {
test("uses the DAV endpoint for a root installation", () => {
expect(createNextcloudCalendarServerUrl("https://cloud.example.com")).toBe(
"https://cloud.example.com/remote.php/dav/",
);
});
test("preserves the base path for a subpath installation", () => {
expect(createNextcloudCalendarServerUrl("https://example.com/nextcloud")).toBe(
"https://example.com/nextcloud/remote.php/dav/",
);
});
test("does not duplicate a trailing slash", () => {
expect(createNextcloudCalendarServerUrl("https://example.com/nextcloud/")).toBe(
"https://example.com/nextcloud/remote.php/dav/",
);
});
test("does not duplicate an existing DAV endpoint", () => {
expect(createNextcloudCalendarServerUrl("https://example.com/nextcloud/remote.php/dav")).toBe(
"https://example.com/nextcloud/remote.php/dav/",
);
});
});
+25 -8
View File
@@ -1,5 +1,9 @@
import { readFile, writeFile } from "fs/promises"; import { readFile, writeFile } from "fs/promises";
import { integrationDefs } from "../packages/definitions/src/integration"; import {
getIntegrationDocumentationUrl,
integrationDefs,
integrationKinds,
} from "../packages/definitions/src/integration";
const FILE = "docs/README.md"; const FILE = "docs/README.md";
const MAX_COLUMNS_PER_ROW = 7; const MAX_COLUMNS_PER_ROW = 7;
@@ -21,19 +25,29 @@ async function updateIntegrationList() {
} }
// Generate the new integration list // Generate the new integration list
const integrations = Object.values(integrationDefs) const integrations = integrationKinds
.filter((def) => def.name !== "Mock") .filter((kind) => kind !== "mock")
.sort((a, b) => a.name.localeCompare(b.name)); .map((kind) => ({
...integrationDefs[kind],
documentationUrl: getIntegrationDocumentationUrl(kind),
}))
.toSorted((a, b) => a.name.localeCompare(b.name));
const tableRows: string[] = []; const tableRows: string[] = [];
let currentRow: string[] = []; let currentRow: string[] = [];
integrations.forEach((integration) => { integrations.forEach((integration) => {
currentRow.push(`<td align="center"> const cellBody = `
<a href="${integration.documentationUrl}" target="_blank" rel="noreferrer noopener">
<img src="${integration.iconUrl}" alt="${integration.name}" width="90" height="90" /> <img src="${integration.iconUrl}" alt="${integration.name}" width="90" height="90" />
<br/> <br/>
<p align="center">${integration.name.replaceAll(" ", "<br/>")}</p> <p align="center">${integration.name.replaceAll(" ", "<br/>")}</p>
</a> `;
let cellContent = `<div>${cellBody}</div>`;
if (integration.documentationUrl !== null) {
cellContent = `<a href="${integration.documentationUrl}" target="_blank" rel="noreferrer noopener">${cellBody}</a>`;
}
currentRow.push(`<td align="center">
${cellContent}
</td>`); </td>`);
if (currentRow.length === MAX_COLUMNS_PER_ROW) { if (currentRow.length === MAX_COLUMNS_PER_ROW) {
@@ -67,4 +81,7 @@ ${endMarker}`;
await writeFile(FILE, newContent, "utf8"); await writeFile(FILE, newContent, "utf8");
} }
updateIntegrationList().catch(console.error); updateIntegrationList().catch((error: unknown) => {
console.error(error);
process.exitCode = 1;
});