refactor widget-only integrations
This commit is contained in:
122 files changed
+2259
-3016
No files matched your search
@@ -31,9 +31,6 @@ const integrationAliases: Partial<Record<IntegrationKind, readonly string[]>> =
|
||||
audiobookshelf: ["audiobookshelf"],
|
||||
navidrome: ["navidrome"],
|
||||
paperlessNgx: ["paperless-ngx", "paperless"],
|
||||
searchCh: ["search-ch"],
|
||||
gitHubContainerRegistry: ["ghcr"],
|
||||
linuxServerIO: ["linuxserver"],
|
||||
coolify: ["coolify"],
|
||||
truenas: ["truenas"],
|
||||
};
|
||||
@@ -63,19 +60,7 @@ export const matchIntegrationKind = (search: string): IntegrationKind | null =>
|
||||
return null;
|
||||
};
|
||||
|
||||
const notDockerDiscoverable = new Set<IntegrationKind>([
|
||||
"dockerHub",
|
||||
"github",
|
||||
"gitlab",
|
||||
"npm",
|
||||
"codeberg",
|
||||
"linuxServerIO",
|
||||
"gitHubContainerRegistry",
|
||||
"quay",
|
||||
"ical",
|
||||
"searchCh",
|
||||
"mock",
|
||||
]);
|
||||
const notDockerDiscoverable = new Set<IntegrationKind>(["ical", "mock"]);
|
||||
|
||||
interface ContainerMatchInput {
|
||||
image: string;
|
||||
|
||||
@@ -168,16 +168,11 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/integrations/aria2"
|
||||
| "/docs/integrations/audiobookshelf"
|
||||
| "/docs/integrations/beszel"
|
||||
| "/docs/integrations/codeberg"
|
||||
| "/docs/integrations/coolify"
|
||||
| "/docs/integrations/dash-dot"
|
||||
| "/docs/integrations/deluge"
|
||||
| "/docs/integrations/docker-hub"
|
||||
| "/docs/integrations/docker"
|
||||
| "/docs/integrations/emby"
|
||||
| "/docs/integrations/github-containerregistry"
|
||||
| "/docs/integrations/github"
|
||||
| "/docs/integrations/gitlab"
|
||||
| "/docs/integrations/glances"
|
||||
| "/docs/integrations/gluetun"
|
||||
| "/docs/integrations/gotify"
|
||||
@@ -188,10 +183,8 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/integrations/jellyseerr"
|
||||
| "/docs/integrations/kubernetes"
|
||||
| "/docs/integrations/lidarr"
|
||||
| "/docs/integrations/linux-server-io"
|
||||
| "/docs/integrations/navidrome"
|
||||
| "/docs/integrations/nextcloud"
|
||||
| "/docs/integrations/npm"
|
||||
| "/docs/integrations/ntfy"
|
||||
| "/docs/integrations/nzbget"
|
||||
| "/docs/integrations/open-media-vault"
|
||||
@@ -204,11 +197,9 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/integrations/prowlarr"
|
||||
| "/docs/integrations/proxmox"
|
||||
| "/docs/integrations/q-bittorent"
|
||||
| "/docs/integrations/quay"
|
||||
| "/docs/integrations/radarr"
|
||||
| "/docs/integrations/readarr"
|
||||
| "/docs/integrations/sabnzbd"
|
||||
| "/docs/integrations/search-ch"
|
||||
| "/docs/integrations/seerr"
|
||||
| "/docs/integrations/slskd"
|
||||
| "/docs/integrations/sonarr"
|
||||
@@ -315,14 +306,6 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/integrations/nextcloud"
|
||||
| "/docs/integrations/unifi-controller"
|
||||
| "/docs/integrations/opnsense"
|
||||
| "/docs/integrations/github"
|
||||
| "/docs/integrations/docker-hub"
|
||||
| "/docs/integrations/gitlab"
|
||||
| "/docs/integrations/npm"
|
||||
| "/docs/integrations/codeberg"
|
||||
| "/docs/integrations/linux-server-io"
|
||||
| "/docs/integrations/github-containerregistry"
|
||||
| "/docs/integrations/quay"
|
||||
| "/docs/integrations/ntfy"
|
||||
| "/docs/integrations/gotify"
|
||||
| "/docs/integrations/ical"
|
||||
@@ -330,7 +313,6 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/integrations/truenas"
|
||||
| "/docs/integrations/unraid"
|
||||
| "/docs/integrations/coolify"
|
||||
| "/docs/integrations/search-ch"
|
||||
| "/docs/integrations/immich"
|
||||
| "/docs/integrations/paperless-ngx"
|
||||
| "/docs/integrations/tracearr"
|
||||
|
||||
@@ -31,14 +31,6 @@ export const integrationDocSlugs: Record<IntegrationKind, string | null> = {
|
||||
nextcloud: "nextcloud",
|
||||
unifiController: "unifi-controller",
|
||||
opnsense: "opnsense",
|
||||
github: "github",
|
||||
dockerHub: "docker-hub",
|
||||
gitlab: "gitlab",
|
||||
npm: "npm",
|
||||
codeberg: "codeberg",
|
||||
linuxServerIO: "linux-server-io",
|
||||
gitHubContainerRegistry: "github-containerregistry",
|
||||
quay: "quay",
|
||||
ntfy: "ntfy",
|
||||
gotify: "gotify",
|
||||
ical: "ical",
|
||||
@@ -46,7 +38,6 @@ export const integrationDocSlugs: Record<IntegrationKind, string | null> = {
|
||||
truenas: "truenas",
|
||||
unraid: "unraid",
|
||||
coolify: "coolify",
|
||||
searchCh: "search-ch",
|
||||
immich: "immich",
|
||||
paperlessNgx: "paperless-ngx",
|
||||
tracearr: "tracearr",
|
||||
@@ -58,6 +49,5 @@ export const integrationDocSlugs: Record<IntegrationKind, string | null> = {
|
||||
gluetun: "gluetun",
|
||||
peaNut: "peanut",
|
||||
beszel: "beszel",
|
||||
archiveTeamWarrior: null,
|
||||
mock: null,
|
||||
};
|
||||
@@ -17,3 +17,4 @@ export * from "./emptysuperjson";
|
||||
export * from "./hotkeys";
|
||||
export * from "./docker-integration-match";
|
||||
export * from "./integration-url-template";
|
||||
export * from "./release-provider";
|
||||
@@ -283,70 +283,6 @@ export const integrationDefs = {
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/opnsense"),
|
||||
defaultPort: 443,
|
||||
},
|
||||
github: {
|
||||
name: "Github",
|
||||
secretKinds: [[], ["personalAccessToken"], ["githubAppId", "githubInstallationId", "privateKey"]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/github.svg",
|
||||
category: ["releasesProvider"],
|
||||
defaultUrl: "https://api.github.com",
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/github"),
|
||||
},
|
||||
dockerHub: {
|
||||
name: "Docker Hub",
|
||||
secretKinds: [[], ["username", "personalAccessToken"]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/docker.svg",
|
||||
category: ["releasesProvider"],
|
||||
defaultUrl: "https://hub.docker.com",
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/docker-hub"),
|
||||
},
|
||||
gitlab: {
|
||||
name: "Gitlab",
|
||||
secretKinds: [[], ["personalAccessToken"]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/gitlab.svg",
|
||||
category: ["releasesProvider"],
|
||||
defaultUrl: "https://gitlab.com",
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/gitlab"),
|
||||
},
|
||||
npm: {
|
||||
name: "NPM",
|
||||
secretKinds: [[]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/npm.svg",
|
||||
category: ["releasesProvider"],
|
||||
defaultUrl: "https://registry.npmjs.org",
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/npm"),
|
||||
},
|
||||
codeberg: {
|
||||
name: "Codeberg",
|
||||
secretKinds: [[], ["personalAccessToken"]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/codeberg.svg",
|
||||
category: ["releasesProvider"],
|
||||
defaultUrl: "https://codeberg.org",
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/codeberg"),
|
||||
},
|
||||
linuxServerIO: {
|
||||
name: "LinuxServer.io",
|
||||
secretKinds: [[]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/linuxserver-io.svg",
|
||||
category: ["releasesProvider"],
|
||||
defaultUrl: "https://api.linuxserver.io",
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/linux-server-io"),
|
||||
},
|
||||
gitHubContainerRegistry: {
|
||||
name: "GitHub Container Registry",
|
||||
secretKinds: [[], ["personalAccessToken"], ["githubAppId", "githubInstallationId", "privateKey"]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/github.svg",
|
||||
category: ["releasesProvider"],
|
||||
defaultUrl: "https://api.github.com",
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/github"),
|
||||
},
|
||||
quay: {
|
||||
name: "Quay",
|
||||
secretKinds: [[], ["personalAccessToken"]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/png/quay.png",
|
||||
category: ["releasesProvider"],
|
||||
defaultUrl: "https://quay.io",
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/quay"),
|
||||
},
|
||||
ntfy: {
|
||||
name: "ntfy",
|
||||
secretKinds: [["topic"], ["topic", "apiKey"]],
|
||||
@@ -401,13 +337,6 @@ export const integrationDefs = {
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/coolify"),
|
||||
defaultPort: 8000,
|
||||
},
|
||||
searchCh: {
|
||||
name: "Search.ch",
|
||||
secretKinds: [[]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/search-ch.png",
|
||||
category: ["timetable"],
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/search-ch"),
|
||||
},
|
||||
immich: {
|
||||
name: "Immich",
|
||||
secretKinds: [["apiKey"]],
|
||||
@@ -496,14 +425,6 @@ export const integrationDefs = {
|
||||
category: ["vpn"],
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/gluetun"),
|
||||
},
|
||||
archiveTeamWarrior: {
|
||||
name: "ArchiveTeam Warrior",
|
||||
secretKinds: [[], ["username", "password"]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/selfhst/icons/png/archiveteam-warrior.png",
|
||||
category: ["archiving"],
|
||||
defaultUrl: "http://localhost:8001",
|
||||
documentationUrl: null,
|
||||
},
|
||||
// This integration only returns mock data, it is used during development (but can also be used in production by directly going to the create page)
|
||||
mock: {
|
||||
name: "Mock",
|
||||
@@ -602,7 +523,6 @@ export const integrationCategories = [
|
||||
"search",
|
||||
"mediaTranscoding",
|
||||
"networkController",
|
||||
"releasesProvider",
|
||||
"notifications",
|
||||
"firewall",
|
||||
"timetable",
|
||||
@@ -612,7 +532,6 @@ export const integrationCategories = [
|
||||
"speedtest",
|
||||
"analytics",
|
||||
"vpn",
|
||||
"archiving",
|
||||
"ups",
|
||||
"documents",
|
||||
"mediaLibrary",
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import { objectKeys } from "@homarr/common";
|
||||
|
||||
export const releaseProviderDefs = {
|
||||
github: {
|
||||
name: "Github",
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/github.svg",
|
||||
defaultUrl: "https://api.github.com",
|
||||
},
|
||||
dockerHub: {
|
||||
name: "Docker Hub",
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/docker.svg",
|
||||
defaultUrl: "https://hub.docker.com",
|
||||
},
|
||||
gitlab: {
|
||||
name: "Gitlab",
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/gitlab.svg",
|
||||
defaultUrl: "https://gitlab.com",
|
||||
},
|
||||
npm: {
|
||||
name: "NPM",
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/npm.svg",
|
||||
defaultUrl: "https://registry.npmjs.org",
|
||||
},
|
||||
codeberg: {
|
||||
name: "Codeberg",
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/codeberg.svg",
|
||||
defaultUrl: "https://codeberg.org",
|
||||
},
|
||||
linuxServerIO: {
|
||||
name: "LinuxServer.io",
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/linuxserver-io.svg",
|
||||
defaultUrl: "https://api.linuxserver.io",
|
||||
},
|
||||
gitHubContainerRegistry: {
|
||||
name: "GitHub Container Registry",
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/github.svg",
|
||||
defaultUrl: "https://ghcr.io",
|
||||
},
|
||||
quay: {
|
||||
name: "Quay",
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/png/quay.png",
|
||||
defaultUrl: "https://quay.io",
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const releaseProviderKinds = objectKeys(releaseProviderDefs);
|
||||
export type ReleaseProviderKind = keyof typeof releaseProviderDefs;
|
||||
|
||||
export const getReleaseProviderName = (provider: ReleaseProviderKind) => releaseProviderDefs[provider].name;
|
||||
export const getReleaseProviderIconUrl = (provider: ReleaseProviderKind) => releaseProviderDefs[provider].iconUrl;
|
||||
export const getReleaseProviderDefaultUrl = (provider: ReleaseProviderKind) => releaseProviderDefs[provider].defaultUrl;
|
||||
|
||||
const releaseProviderRegistryPrefixes: Partial<Record<ReleaseProviderKind, string>> = {
|
||||
dockerHub: "docker.io/",
|
||||
gitHubContainerRegistry: "ghcr.io/",
|
||||
linuxServerIO: "lscr.io/",
|
||||
quay: "quay.io/",
|
||||
};
|
||||
|
||||
const removeContainerImageVersion = (identifier: string) => {
|
||||
const digestIndex = identifier.indexOf("@");
|
||||
const withoutDigest = digestIndex === -1 ? identifier : identifier.slice(0, digestIndex);
|
||||
const tagIndex = withoutDigest.indexOf(":", withoutDigest.lastIndexOf("/") + 1);
|
||||
|
||||
return tagIndex === -1 ? withoutDigest : withoutDigest.slice(0, tagIndex);
|
||||
};
|
||||
|
||||
export const normalizeReleaseProviderIdentifier = (provider: ReleaseProviderKind, identifier: string) => {
|
||||
const trimmedIdentifier = identifier.trim();
|
||||
const registryPrefix = releaseProviderRegistryPrefixes[provider];
|
||||
const withoutRegistry =
|
||||
registryPrefix && trimmedIdentifier.startsWith(registryPrefix)
|
||||
? trimmedIdentifier.slice(registryPrefix.length)
|
||||
: trimmedIdentifier;
|
||||
|
||||
return removeContainerImageVersion(withoutRegistry);
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { normalizeReleaseProviderIdentifier } from "../release-provider";
|
||||
|
||||
describe("normalizeReleaseProviderIdentifier", () => {
|
||||
it("normalizes full ghcr image references", () => {
|
||||
expect(normalizeReleaseProviderIdentifier("gitHubContainerRegistry", "ghcr.io/muchobien/pocketbase:latest")).toBe(
|
||||
"muchobien/pocketbase",
|
||||
);
|
||||
expect(normalizeReleaseProviderIdentifier("gitHubContainerRegistry", "ghcr.io/homarr-labs/homarr:latest")).toBe(
|
||||
"homarr-labs/homarr",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps existing ghcr owner/name identifiers unchanged", () => {
|
||||
expect(normalizeReleaseProviderIdentifier("gitHubContainerRegistry", "homarr-labs/homarr")).toBe(
|
||||
"homarr-labs/homarr",
|
||||
);
|
||||
});
|
||||
|
||||
it("normalizes container image identifiers for other registries", () => {
|
||||
expect(normalizeReleaseProviderIdentifier("dockerHub", "postgres:17")).toBe("postgres");
|
||||
expect(normalizeReleaseProviderIdentifier("dockerHub", "docker.io/library/postgres:17")).toBe("library/postgres");
|
||||
expect(normalizeReleaseProviderIdentifier("dockerHub", "library/postgres@sha256:abc123")).toBe("library/postgres");
|
||||
expect(normalizeReleaseProviderIdentifier("linuxServerIO", "lscr.io/linuxserver/radarr:latest")).toBe(
|
||||
"linuxserver/radarr",
|
||||
);
|
||||
expect(normalizeReleaseProviderIdentifier("quay", "quay.io/prometheus/prometheus:v3.0.0")).toBe(
|
||||
"prometheus/prometheus",
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -30,7 +30,6 @@ export const widgetIntegrationSupport: Partial<Record<WidgetKind, readonly Integ
|
||||
systemResources: ["dashDot", "openmediavault", "truenas", "unraid", "glances"],
|
||||
systemDisks: ["dashDot", "openmediavault", "truenas", "unraid"],
|
||||
coolify: ["coolify"],
|
||||
timetable: ["searchCh"],
|
||||
"immich-serverStats": ["immich"],
|
||||
"immich-albumCarousel": ["immich"],
|
||||
paperlessNgx: ["paperlessNgx"],
|
||||
@@ -80,18 +79,7 @@ export const featuredIntegrations: readonly IntegrationKind[] = [
|
||||
"jellyfin",
|
||||
];
|
||||
|
||||
export const hiddenFromOnboarding = new Set<IntegrationKind>([
|
||||
"searchCh",
|
||||
"github",
|
||||
"dockerHub",
|
||||
"gitlab",
|
||||
"npm",
|
||||
"codeberg",
|
||||
"linuxServerIO",
|
||||
"gitHubContainerRegistry",
|
||||
"quay",
|
||||
"mock",
|
||||
]);
|
||||
export const hiddenFromOnboarding = new Set<IntegrationKind>(["mock"]);
|
||||
|
||||
export const defaultBookmarkApps = [
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user