Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ed6b16217 | ||
|
|
c6d22b3939 |
No files matched your search
+8
-8
@@ -74,7 +74,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td align="center">
|
<td align="center">
|
||||||
<a href="https://homarr.dev/docs/integrations/archiveteam-warrior" target="_blank" rel="noreferrer noopener">
|
<a href="null" 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="https://homarr.dev/docs/integrations/audiobookshelf" target="_blank" rel="noreferrer noopener">
|
<a href="null" 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="https://homarr.dev/docs/integrations/glances" target="_blank" rel="noreferrer noopener">
|
<a href="null" 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="https://homarr.dev/docs/integrations/navidrome" target="_blank" rel="noreferrer noopener">
|
<a href="null" 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="https://homarr.dev/docs/integrations/paperless-ngx" target="_blank" rel="noreferrer noopener">
|
<a href="null" 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="https://homarr.dev/docs/integrations/peanut" target="_blank" rel="noreferrer noopener">
|
<a href="null" 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@main/png/readarr.png" alt="Readarr" width="90" height="90" />
|
<img src="https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/readarr.svg" 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="https://homarr.dev/docs/integrations/uptime-kuma" target="_blank" rel="noreferrer noopener">
|
<a href="null" 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>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
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,6 +21,7 @@ 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) {
|
||||||
@@ -189,7 +190,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: this.integration.url,
|
serverUrl: createNextcloudCalendarServerUrl(this.integration.url),
|
||||||
credentials: {
|
credentials: {
|
||||||
username: this.getSecretValue("username"),
|
username: this.getSecretValue("username"),
|
||||||
password: this.getSecretValue("password"),
|
password: this.getSecretValue("password"),
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
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/",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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/",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
import { readFile, writeFile } from "fs/promises";
|
import { readFile, writeFile } from "fs/promises";
|
||||||
import {
|
import { integrationDefs } from "../packages/definitions/src/integration";
|
||||||
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;
|
||||||
@@ -25,29 +21,19 @@ async function updateIntegrationList() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate the new integration list
|
// Generate the new integration list
|
||||||
const integrations = integrationKinds
|
const integrations = Object.values(integrationDefs)
|
||||||
.filter((kind) => kind !== "mock")
|
.filter((def) => def.name !== "Mock")
|
||||||
.map((kind) => ({
|
.sort((a, b) => a.name.localeCompare(b.name));
|
||||||
...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) => {
|
||||||
const cellBody = `
|
currentRow.push(`<td align="center">
|
||||||
|
<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) {
|
||||||
@@ -81,7 +67,4 @@ ${endMarker}`;
|
|||||||
await writeFile(FILE, newContent, "utf8");
|
await writeFile(FILE, newContent, "utf8");
|
||||||
}
|
}
|
||||||
|
|
||||||
updateIntegrationList().catch((error: unknown) => {
|
updateIntegrationList().catch(console.error);
|
||||||
console.error(error);
|
|
||||||
process.exitCode = 1;
|
|
||||||
});
|
|
||||||
Reference in new issue
Block a user