fix release v2 recovery flows
This commit is contained in:
1 parent
ca856f9f54
commit
4905ea6738
44 files changed
+871
-201
No files matched your search
@@ -77,7 +77,11 @@ export const buildDockerServiceUrlCandidates = ({
|
||||
|
||||
for (const port of tcpPorts) {
|
||||
if (port.PublicPort) {
|
||||
const publishedHost = isUsablePublishedAddress(port.IP) ? port.IP : endpointHostname;
|
||||
const publishedHost = isUsablePublishedAddress(port.IP)
|
||||
? port.IP
|
||||
: isUsablePublishedAddress(endpointHostname ?? undefined)
|
||||
? endpointHostname
|
||||
: null;
|
||||
if (publishedHost) {
|
||||
addCandidate({
|
||||
url: `http://${formatUrlHost(publishedHost)}:${port.PublicPort}`,
|
||||
@@ -120,8 +124,16 @@ export const normalizeDockerServiceUrl = (value: string | null | undefined) => {
|
||||
}
|
||||
};
|
||||
|
||||
const isUsablePublishedAddress = (value: string | undefined): value is string =>
|
||||
Boolean(value && !["0.0.0.0", "::", "::0"].includes(value));
|
||||
const isUsablePublishedAddress = (value: string | undefined): value is string => {
|
||||
if (!value) return false;
|
||||
const host = value.toLowerCase().replace(/^\[|\]$/gu, "");
|
||||
return (
|
||||
!["0.0.0.0", "::", "::0", "::1", "localhost"].includes(host) &&
|
||||
!host.endsWith(".localhost") &&
|
||||
!/^127(?:\.\d{1,3}){3}$/.test(host) &&
|
||||
!host.startsWith("::ffff:127.")
|
||||
);
|
||||
};
|
||||
|
||||
const getEndpointHostname = (host: string) => {
|
||||
if (host === "socket" || host.startsWith("/")) return null;
|
||||
|
||||
@@ -332,6 +332,7 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/integrations/peanut"
|
||||
| "/docs/integrations/beszel"
|
||||
| "/docs/integrations/traefik"
|
||||
| "/docs/integrations/archiveteam-warrior"
|
||||
| "/docs/integrations/whats-up-docker"
|
||||
| "/docs/widgets/clock"
|
||||
| "/docs/widgets/weather"
|
||||
|
||||
@@ -50,4 +50,30 @@ describe("buildDockerServiceUrlCandidates", () => {
|
||||
reason: "dockerEndpointHost",
|
||||
});
|
||||
});
|
||||
|
||||
test.each(["127.0.0.1", "127.12.0.9", "::1", "::ffff:127.0.0.1", "localhost"])(
|
||||
"does not advertise loopback address %s to browsers",
|
||||
(address) => {
|
||||
const candidates = buildDockerServiceUrlCandidates({
|
||||
containerName: "sonarr",
|
||||
endpointHost: "socket",
|
||||
preferredPort: 8989,
|
||||
ports: [{ IP: address, PrivatePort: 8989, PublicPort: 8989, Type: "tcp" }],
|
||||
});
|
||||
|
||||
expect(candidates.some(({ source }) => source === "publishedAddress")).toBe(false);
|
||||
expect(candidates.some(({ url, scopes }) => url.includes(address) && scopes.includes("browser"))).toBe(false);
|
||||
},
|
||||
);
|
||||
|
||||
test("does not use a loopback Docker endpoint as a browser URL", () => {
|
||||
const candidates = buildDockerServiceUrlCandidates({
|
||||
containerName: "sonarr",
|
||||
endpointHost: "[::1]:2375",
|
||||
preferredPort: 8989,
|
||||
ports: [{ IP: "0.0.0.0", PrivatePort: 8989, PublicPort: 8989, Type: "tcp" }],
|
||||
});
|
||||
|
||||
expect(candidates.some(({ source }) => source === "endpointHost")).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -28,6 +28,20 @@ describe("native feature capability descriptor", () => {
|
||||
|
||||
test("derives optional connections and server selection limits", () => {
|
||||
expect(widgetKindsWithOptionalIntegrations).toEqual(new Set(["calendar"]));
|
||||
expect(widgetIntegrationLimits).toEqual({ audioStats: 1 });
|
||||
expect(widgetIntegrationLimits).toEqual({
|
||||
"smartHome-entityState": 1,
|
||||
"smartHome-executeAutomation": 1,
|
||||
mediaTranscoding: 1,
|
||||
"immich-serverStats": 1,
|
||||
"immich-albumCarousel": 1,
|
||||
paperlessNgx: 1,
|
||||
patchmon: 1,
|
||||
bazarr: 1,
|
||||
audioStats: 1,
|
||||
umami: 1,
|
||||
archiveTeamWarrior: 1,
|
||||
anchorNote: 1,
|
||||
wud: 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -18,14 +18,20 @@ export interface NativeFeatureCapabilityDescriptor {
|
||||
export const nativeFeatureCapabilities = {
|
||||
dnsHoleSummary: { integrations: getIntegrationKindsByCategory("dnsHole") },
|
||||
dnsHoleControls: { integrations: getIntegrationKindsByCategory("dnsHole") },
|
||||
"smartHome-entityState": { integrations: getIntegrationKindsByCategory("smartHomeServer") },
|
||||
"smartHome-executeAutomation": { integrations: getIntegrationKindsByCategory("smartHomeServer") },
|
||||
"smartHome-entityState": {
|
||||
integrations: getIntegrationKindsByCategory("smartHomeServer"),
|
||||
serverMaxIntegrations: 1,
|
||||
},
|
||||
"smartHome-executeAutomation": {
|
||||
integrations: getIntegrationKindsByCategory("smartHomeServer"),
|
||||
serverMaxIntegrations: 1,
|
||||
},
|
||||
mediaServer: { integrations: getIntegrationKindsByCategory("mediaService") },
|
||||
calendar: { integrations: getIntegrationKindsByCategory("calendar"), connectionOptional: true },
|
||||
downloads: { integrations: getIntegrationKindsByCategory("downloadClient") },
|
||||
"mediaRequests-requestList": { integrations: getIntegrationKindsByCategory("mediaRequest") },
|
||||
"mediaRequests-requestStats": { integrations: getIntegrationKindsByCategory("mediaRequest") },
|
||||
mediaTranscoding: { integrations: getIntegrationKindsByCategory("mediaTranscoding") },
|
||||
mediaTranscoding: { integrations: getIntegrationKindsByCategory("mediaTranscoding"), serverMaxIntegrations: 1 },
|
||||
mediaMissing: { integrations: getIntegrationKindsByCategory("mediaOrganizer") },
|
||||
networkControllerSummary: { integrations: getIntegrationKindsByCategory("networkController") },
|
||||
networkControllerStatus: { integrations: getIntegrationKindsByCategory("networkController") },
|
||||
@@ -45,22 +51,22 @@ export const nativeFeatureCapabilities = {
|
||||
beszelSystemStats: { integrations: ["beszel", "mock"] },
|
||||
beszelSystemTable: { integrations: ["beszel", "mock"] },
|
||||
coolify: { integrations: ["coolify"] },
|
||||
"immich-serverStats": { integrations: ["immich"] },
|
||||
"immich-albumCarousel": { integrations: ["immich"] },
|
||||
paperlessNgx: { integrations: ["paperlessNgx"] },
|
||||
patchmon: { integrations: ["patchmon"] },
|
||||
bazarr: { integrations: ["bazarr"] },
|
||||
"immich-serverStats": { integrations: ["immich"], serverMaxIntegrations: 1 },
|
||||
"immich-albumCarousel": { integrations: ["immich"], serverMaxIntegrations: 1 },
|
||||
paperlessNgx: { integrations: ["paperlessNgx"], serverMaxIntegrations: 1 },
|
||||
patchmon: { integrations: ["patchmon"], serverMaxIntegrations: 1 },
|
||||
bazarr: { integrations: ["bazarr"], serverMaxIntegrations: 1 },
|
||||
tracearr: { integrations: ["tracearr"] },
|
||||
speedtestTracker: { integrations: ["speedtestTracker"] },
|
||||
uptimeKuma: { integrations: ["uptimeKuma"] },
|
||||
audioStats: { integrations: ["navidrome", "audiobookshelf"], serverMaxIntegrations: 1 },
|
||||
umami: { integrations: ["umami"] },
|
||||
umami: { integrations: ["umami"], serverMaxIntegrations: 1 },
|
||||
vpn: { integrations: getIntegrationKindsByCategory("vpn") },
|
||||
ups: { integrations: getIntegrationKindsByCategory("ups") },
|
||||
archiveTeamWarrior: { integrations: ["archiveTeamWarrior"] },
|
||||
anchorNote: { integrations: ["anchor"] },
|
||||
archiveTeamWarrior: { integrations: ["archiveTeamWarrior"], serverMaxIntegrations: 1 },
|
||||
anchorNote: { integrations: ["anchor"], serverMaxIntegrations: 1 },
|
||||
traefik: { integrations: ["traefik"] },
|
||||
wud: { integrations: ["wud"] },
|
||||
wud: { integrations: ["wud"], serverMaxIntegrations: 1 },
|
||||
} as const satisfies Partial<Record<WidgetKind, NativeFeatureCapabilityDescriptor>>;
|
||||
|
||||
const nativeFeatureCapabilityEntries = Object.entries(nativeFeatureCapabilities) as [
|
||||
|
||||
Reference in new issue
Block a user