fix: narrow PR to verified bug fixes
This commit is contained in:
1 parent
3f9941f9c7
commit
268c864801
8 files changed
+50
-123
No files matched your search
@@ -1,30 +1,27 @@
|
|||||||
---
|
---
|
||||||
title: 'App'
|
title: "App"
|
||||||
description: 'Embeds an app into the board.'
|
description: "Embeds an app into the board."
|
||||||
hide_title: true
|
hide_title: true
|
||||||
---
|
---
|
||||||
|
|
||||||
import { AddingWidget } from '@site/src/components/widgets/adding';
|
import { AddingWidget } from "@site/src/components/widgets/adding";
|
||||||
import { WidgetConfig } from '@site/src/components/widgets/configuration';
|
import { WidgetConfig } from "@site/src/components/widgets/configuration";
|
||||||
import { WidgetHeader } from '@site/src/components/widgets/header';
|
import { WidgetHeader } from "@site/src/components/widgets/header";
|
||||||
import { appWidget } from '.';
|
import { appWidget } from ".";
|
||||||
|
|
||||||
|
<WidgetHeader widget={appWidget} categories={["Links", "Apps"]} />
|
||||||
<WidgetHeader
|
|
||||||
widget={appWidget}
|
|
||||||
categories={['Links', 'Apps']}
|
|
||||||
/>
|
|
||||||
|
|
||||||
The app widget allows you to add a link to an application or a website that you want to access quickly from your Homarr board.
|
The app widget allows you to add a link to an application or a website that you want to access quickly from your Homarr board.
|
||||||
It also supports a status check to indicate whether Homarr can reach the application or website.
|
It also supports a status check to indicate whether Homarr can reach the application or website.
|
||||||
|
In view mode, right-clicking uses the browser's link menu. Homarr's widget menu remains available in edit mode.
|
||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
import githubApp from './img/github.png';
|
import githubApp from "./img/github.png";
|
||||||
import jellyseerrApp from './img/jellyseerr-description-tooltip.png';
|
import jellyseerrApp from "./img/jellyseerr-description-tooltip.png";
|
||||||
import piHoleApp from './img/pi-hole-ping-icon.png';
|
import piHoleApp from "./img/pi-hole-ping-icon.png";
|
||||||
|
|
||||||
<div className='flex gap-1'>
|
<div className="flex gap-1">
|
||||||
<img src={githubApp} alt="app github with-status-check" width={128 * 1.5} height={128 * 1.5} />
|
<img src={githubApp} alt="app github with-status-check" width={128 * 1.5} height={128 * 1.5} />
|
||||||
<img src={piHoleApp} alt="app pi-hole with-status-check status-check-icon" width={128 * 1.5} height={128 * 1.5} />
|
<img src={piHoleApp} alt="app pi-hole with-status-check status-check-icon" width={128 * 1.5} height={128 * 1.5} />
|
||||||
<img src={jellyseerrApp} alt="app jellyseerr with-description-tooltip" height={128 * 1.5} />
|
<img src={jellyseerrApp} alt="app jellyseerr with-description-tooltip" height={128 * 1.5} />
|
||||||
@@ -34,4 +31,5 @@ import piHoleApp from './img/pi-hole-ping-icon.png';
|
|||||||
<AddingWidget />
|
<AddingWidget />
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
<WidgetConfig configuration={appWidget.configuration} />
|
<WidgetConfig configuration={appWidget.configuration} />
|
||||||
@@ -1,29 +1,26 @@
|
|||||||
---
|
---
|
||||||
title: 'Bookmarks'
|
title: "Bookmarks"
|
||||||
description: 'Displays multiple app links'
|
description: "Displays multiple app links"
|
||||||
hide_title: true
|
hide_title: true
|
||||||
---
|
---
|
||||||
|
|
||||||
import { AddingWidget } from '@site/src/components/widgets/adding';
|
import { AddingWidget } from "@site/src/components/widgets/adding";
|
||||||
import { WidgetConfig } from '@site/src/components/widgets/configuration';
|
import { WidgetConfig } from "@site/src/components/widgets/configuration";
|
||||||
import { WidgetHeader } from '@site/src/components/widgets/header';
|
import { WidgetHeader } from "@site/src/components/widgets/header";
|
||||||
import { bookmarksWidget } from '.';
|
import { bookmarksWidget } from ".";
|
||||||
|
|
||||||
|
<WidgetHeader widget={bookmarksWidget} categories={["Links", "Apps"]} />
|
||||||
<WidgetHeader
|
|
||||||
widget={bookmarksWidget}
|
|
||||||
categories={['Links', 'Apps']}
|
|
||||||
/>
|
|
||||||
|
|
||||||
The bookmarks widget allows you to display multiple app links in a single widget.
|
The bookmarks widget allows you to display multiple app links in a single widget.
|
||||||
You can add links to your favorite applications, websites, or any other resources you want quick access to.
|
You can add links to your favorite applications, websites, or any other resources you want quick access to.
|
||||||
|
In view mode, right-clicking uses the browser's link menu. Homarr's widget menu remains available in edit mode.
|
||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
import gridIconsOnly from './img/grid-icons-only.png';
|
import gridIconsOnly from "./img/grid-icons-only.png";
|
||||||
import gridWithTitle from './img/grid-with-title.png';
|
import gridWithTitle from "./img/grid-with-title.png";
|
||||||
import verticalListAll from './img/vertical-list-all.png';
|
import verticalListAll from "./img/vertical-list-all.png";
|
||||||
import vericalListSimple from './img/vertical-list-simple.png';
|
import vericalListSimple from "./img/vertical-list-simple.png";
|
||||||
|
|
||||||
<div className='flex gap-1'>
|
<div className='flex gap-1'>
|
||||||
<div className='flex flex-col gap-1'>
|
<div className='flex flex-col gap-1'>
|
||||||
@@ -33,12 +30,13 @@ import vericalListSimple from './img/vertical-list-simple.png';
|
|||||||
|
|
||||||
<img src={gridWithTitle} alt="bookmarks grid with-title" width={256 + 4} height={256 + 4} />
|
<img src={gridWithTitle} alt="bookmarks grid with-title" width={256 + 4} height={256 + 4} />
|
||||||
<img src={verticalListAll} alt="bookmarks vertical-list all-elements" width={128} height={256 + 4} />
|
<img src={verticalListAll} alt="bookmarks vertical-list all-elements" width={128} height={256 + 4} />
|
||||||
</div>
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
### Adding the widget
|
### Adding the widget
|
||||||
|
|
||||||
<AddingWidget />
|
<AddingWidget />
|
||||||
|
|
||||||
### Configuration
|
### Configuration
|
||||||
|
|
||||||
<WidgetConfig configuration={bookmarksWidget.configuration} />
|
<WidgetConfig configuration={bookmarksWidget.configuration} />
|
||||||
@@ -48,9 +48,9 @@ export const WidgetContextMenu = ({ item, definition, widgetStateRef, children }
|
|||||||
const settings = useSettings();
|
const settings = useSettings();
|
||||||
|
|
||||||
if (!session || !settings.enableRightClickOnWidgets) return <>{children}</>;
|
if (!session || !settings.enableRightClickOnWidgets) return <>{children}</>;
|
||||||
// App widgets are links — let the browser's native context menu (open in new tab, copy link)
|
const isLinkWidget = item.kind === "app" || item.kind === "bookmarks";
|
||||||
// show in view mode. In edit mode keep the Homarr menu so items can still be edited/removed.
|
// Keep the Homarr menu in edit mode so these widgets can still be edited or removed.
|
||||||
if (item.kind === "app" && !isEditMode) return <>{children}</>;
|
if (isLinkWidget && !isEditMode) return <>{children}</>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WidgetContextMenuInner item={item} definition={definition} widgetStateRef={widgetStateRef} settings={settings}>
|
<WidgetContextMenuInner item={item} definition={definition} widgetStateRef={widgetStateRef} settings={settings}>
|
||||||
|
|||||||
@@ -301,6 +301,8 @@ interface UseCssVariableConfiguration {
|
|||||||
isDynamic: boolean;
|
isDynamic: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const minimumResizeWidthDelta = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This hook is used to configure the css variables for the gridstack
|
* This hook is used to configure the css variables for the gridstack
|
||||||
* Those css variables are used to define the size of the gridstack items
|
* Those css variables are used to define the size of the gridstack items
|
||||||
@@ -329,13 +331,13 @@ const useCssVariableConfiguration = ({
|
|||||||
const currentHeight = wrapperRef.current.clientHeight;
|
const currentHeight = wrapperRef.current.clientHeight;
|
||||||
const prevSize = prevSizeRef.current;
|
const prevSize = prevSizeRef.current;
|
||||||
|
|
||||||
// Only skip recalculation when the width change is insignificant (< 20px)
|
// Only skip recalculation when the width change is insignificant
|
||||||
// and, for dynamic sections, the height is unchanged. This prevents infinite
|
// and, for dynamic sections, the height is unchanged. This prevents infinite
|
||||||
// feedback loops when the vertical scrollbar appears/disappears, causing
|
// feedback loops when the vertical scrollbar appears/disappears, causing
|
||||||
// clientWidth to oscillate by ~15px, while still reacting to height changes.
|
// clientWidth to oscillate by ~15px, while still reacting to height changes.
|
||||||
if (
|
if (
|
||||||
prevSize !== null &&
|
prevSize !== null &&
|
||||||
Math.abs(currentWidth - prevSize.width) < 20 &&
|
Math.abs(currentWidth - prevSize.width) < minimumResizeWidthDelta &&
|
||||||
(!isDynamic || currentHeight === prevSize.height)
|
(!isDynamic || currentHeight === prevSize.height)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
+9
-16
@@ -32,22 +32,15 @@ export const createSignInEventHandler = (db: Database): Exclude<NextAuthConfig["
|
|||||||
|
|
||||||
const groupsKey = env.AUTH_OIDC_GROUPS_ATTRIBUTE;
|
const groupsKey = env.AUTH_OIDC_GROUPS_ATTRIBUTE;
|
||||||
// Groups from oidc provider are provided from the profile, it's not typed.
|
// Groups from oidc provider are provided from the profile, it's not typed.
|
||||||
// Some providers send a single group as a string instead of an array — normalize it.
|
if (
|
||||||
// Only accept string or string[] claims; reject null, numbers, objects, etc.
|
!env.AUTH_OIDC_GROUPS_LOCAL_MANAGEMENT &&
|
||||||
const oidcGroups = profile && groupsKey in profile ? profile[groupsKey] : undefined;
|
dbUser.provider === "oidc" &&
|
||||||
const normalizedOidcGroups: string[] | undefined = (() => {
|
profile &&
|
||||||
if (typeof oidcGroups === "string") return [oidcGroups];
|
groupsKey in profile &&
|
||||||
if (Array.isArray(oidcGroups) && oidcGroups.every((group): group is string => typeof group === "string")) {
|
Array.isArray(profile[groupsKey])
|
||||||
return oidcGroups;
|
) {
|
||||||
}
|
logger.debug(`Using profile groups (${groupsKey}): ${JSON.stringify(profile[groupsKey])}`);
|
||||||
if (oidcGroups !== undefined) {
|
await synchronizeGroupsWithExternalForUserAsync(db, user.id, profile[groupsKey] as string[]);
|
||||||
logger.warn(`Invalid OIDC groups claim "${groupsKey}"`);
|
|
||||||
}
|
|
||||||
return undefined;
|
|
||||||
})();
|
|
||||||
if (!env.AUTH_OIDC_GROUPS_LOCAL_MANAGEMENT && dbUser.provider === "oidc" && normalizedOidcGroups !== undefined) {
|
|
||||||
logger.debug(`Using profile groups (${groupsKey}): ${JSON.stringify(normalizedOidcGroups)}`);
|
|
||||||
await synchronizeGroupsWithExternalForUserAsync(db, user.id, normalizedOidcGroups);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// In ldap-authroization we return the groups from ldap, it's not typed.
|
// In ldap-authroization we return the groups from ldap, it's not typed.
|
||||||
|
|||||||
@@ -152,48 +152,6 @@ describe("createSignInEventHandler should create signInEventHandler", () => {
|
|||||||
});
|
});
|
||||||
expect(dbGroupMembers?.groupId).toBe("1");
|
expect(dbGroupMembers?.groupId).toBe("1");
|
||||||
});
|
});
|
||||||
test("should add membership when the groups claim is a single string", async () => {
|
|
||||||
// Arrange
|
|
||||||
const db = createDb();
|
|
||||||
await createUserAsync(db, "oidc");
|
|
||||||
await createGroupAsync(db);
|
|
||||||
const eventHandler = createSignInEventHandler(db);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await eventHandler?.({
|
|
||||||
user: { id: "1", name: "test" },
|
|
||||||
profile: { preferred_username: "test", someRandomGroupsKey: "test" },
|
|
||||||
account: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
const dbGroupMembers = await db.query.groupMembers.findFirst({
|
|
||||||
where: eq(groupMembers.userId, "1"),
|
|
||||||
});
|
|
||||||
expect(dbGroupMembers?.groupId).toBe("1");
|
|
||||||
});
|
|
||||||
test("should not change memberships for an invalid groups claim", async () => {
|
|
||||||
// Arrange
|
|
||||||
const db = createDb();
|
|
||||||
await createUserAsync(db, "oidc");
|
|
||||||
await createGroupAsync(db);
|
|
||||||
await db.insert(groupMembers).values({ userId: "1", groupId: "1" });
|
|
||||||
const eventHandler = createSignInEventHandler(db);
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await eventHandler?.({
|
|
||||||
user: { id: "1", name: "test" },
|
|
||||||
profile: { preferred_username: "test", someRandomGroupsKey: 42 },
|
|
||||||
account: null,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
const dbGroupMembers = await db.query.groupMembers.findMany({
|
|
||||||
where: eq(groupMembers.userId, "1"),
|
|
||||||
columns: { groupId: true },
|
|
||||||
});
|
|
||||||
expect(dbGroupMembers).toEqual([{ groupId: "1" }]);
|
|
||||||
});
|
|
||||||
test("should remove group membership", async () => {
|
test("should remove group membership", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const db = createDb();
|
const db = createDb();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ParseError, ResponseError } from "@homarr/common/server";
|
import { ResponseError } from "@homarr/common/server";
|
||||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||||
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
|
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
|
||||||
import { createCertificateAgentAsync, fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
|
import { createCertificateAgentAsync, fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
|
||||||
@@ -163,20 +163,7 @@ export class BeszelIntegration extends Integration {
|
|||||||
throw new ResponseError(response);
|
throw new ResponseError(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
let data: BeszelAuthResponse;
|
const data = (await response.json()) as BeszelAuthResponse;
|
||||||
try {
|
|
||||||
data = (await response.json()) as BeszelAuthResponse;
|
|
||||||
} catch (error) {
|
|
||||||
logger.warn("Failed to parse Beszel auth response JSON", {
|
|
||||||
integrationId: this.integration.id,
|
|
||||||
error: error instanceof Error ? error.message : String(error),
|
|
||||||
});
|
|
||||||
throw new ErrorWithMetadata(
|
|
||||||
"Beszel authentication response was not valid JSON",
|
|
||||||
{ integrationId: this.integration.id },
|
|
||||||
{ cause: error instanceof Error ? error : new Error(String(error)) },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
const expiresAt = parseTokenExpiration(data.token) ?? undefined;
|
const expiresAt = parseTokenExpiration(data.token) ?? undefined;
|
||||||
|
|
||||||
// A token that has already lapsed by the time it reaches us means our clock and Beszel's
|
// A token that has already lapsed by the time it reaches us means our clock and Beszel's
|
||||||
@@ -621,19 +608,7 @@ export class BeszelIntegration extends Integration {
|
|||||||
return TestConnectionError.StatusResult({ status: response.status, url: response.url });
|
return TestConnectionError.StatusResult({ status: response.status, url: response.url });
|
||||||
}
|
}
|
||||||
|
|
||||||
let data: BeszelAuthResponse;
|
const data = (await response.json()) as BeszelAuthResponse;
|
||||||
try {
|
|
||||||
data = (await response.json()) as BeszelAuthResponse;
|
|
||||||
} catch (error) {
|
|
||||||
logger.warn("Failed to parse Beszel testing response JSON", {
|
|
||||||
error: error instanceof Error ? error.message : String(error),
|
|
||||||
});
|
|
||||||
return TestConnectionError.ParseResult(
|
|
||||||
new ParseError("Beszel testing response was not valid JSON", {
|
|
||||||
cause: error instanceof Error ? error : new Error(String(error)),
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!data.token) {
|
if (!data.token) {
|
||||||
return TestConnectionError.UnauthorizedResult(401);
|
return TestConnectionError.UnauthorizedResult(401);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,10 @@ export class UnraidIntegration extends Integration implements ISystemHealthMonit
|
|||||||
// Each entry in cpus[] is one logical CPU (thread). Dividing the summed per-thread
|
// Each entry in cpus[] is one logical CPU (thread). Dividing the summed per-thread
|
||||||
// utilization by the thread count (not physical cores) gives the correct average and
|
// utilization by the thread count (not physical cores) gives the correct average and
|
||||||
// avoids over-reporting on SMT systems. Guard against zero to avoid Infinity/NaN.
|
// avoids over-reporting on SMT systems. Guard against zero to avoid Infinity/NaN.
|
||||||
const cpuUtilizationNormalized = cpuCount > 0 ? cpuUtilization / cpuCount : 0;
|
let cpuUtilizationNormalized = 0;
|
||||||
|
if (cpuCount > 0) {
|
||||||
|
cpuUtilizationNormalized = cpuUtilization / cpuCount;
|
||||||
|
}
|
||||||
|
|
||||||
const totalMemory = systemInfo.info.memory.layout.reduce((acc, layout) => layout.size + acc, 0);
|
const totalMemory = systemInfo.info.memory.layout.reduce((acc, layout) => layout.size + acc, 0);
|
||||||
const usedMemory = totalMemory * (systemInfo.metrics.memory.percentTotal / 100);
|
const usedMemory = totalMemory * (systemInfo.metrics.memory.percentTotal / 100);
|
||||||
|
|||||||
Reference in new issue
Block a user