feat: polish release v2 experience (#6800)

This commit is contained in:
Thomas authored and GitHub committed 2026-09-07 19:17:37 +02:00
1 parent 925b0fb801
commit a4a903d7c3
295 files changed
+10627 -7115

No files matched your search

@@ -1,3 +1,4 @@
import { isRecord } from "@homarr/common";
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
const generationTelemetryCache = new Map<string, { expiresAt: number; value: OpenRouterGenerationTelemetry }>();
@@ -31,8 +32,7 @@ export type OpenRouterGenerationTelemetry = {
cancelled?: boolean;
};
const asRecord = (value: unknown): Record<string, unknown> | null =>
typeof value === "object" && value !== null && !Array.isArray(value) ? (value as Record<string, unknown>) : null;
const asRecord = (value: unknown): Record<string, unknown> | null => (isRecord(value) ? value : null);
const asFiniteNonNegativeNumber = (value: unknown) => {
const number = typeof value === "number" ? value : typeof value === "string" ? Number(value) : Number.NaN;
-29
View File
@@ -1,29 +0,0 @@
import { TRPCError } from "@trpc/server";
import { z } from "zod/v4";
import { and, eq } from "@homarr/db";
import { items } from "@homarr/db/schema";
import type { WidgetKind } from "@homarr/definitions";
import { publicProcedure } from "../trpc";
export const createOneItemMiddleware = (kind: WidgetKind) => {
return publicProcedure.input(z.object({ itemId: z.string() })).use(async ({ input, ctx, next }) => {
const item = await ctx.db.query.items.findFirst({
where: and(eq(items.id, input.itemId), eq(items.kind, kind)),
});
if (!item) {
throw new TRPCError({
code: "NOT_FOUND",
message: `Item with id ${input.itemId} not found`,
});
}
return next({
ctx: {
item,
},
});
});
};
+14 -20
View File
@@ -3,7 +3,7 @@ import { parse, stringify } from "superjson";
import { z } from "zod/v4";
import { constructIntegrationPermissions } from "@homarr/auth/shared";
import { createId } from "@homarr/common";
import { createId, isRecord } from "@homarr/common";
import { decryptSecret, encryptSecret } from "@homarr/common/server";
import { and, asc, desc, eq, handleTransactionsAsync, inArray } from "@homarr/db";
import type { Database } from "@homarr/db";
@@ -175,20 +175,20 @@ const getProviderHeaders = (configuration: AssistantConfiguration) => {
};
const getGenerationIdsFromMessageContent = (content: unknown) => {
if (!content || typeof content !== "object" || Array.isArray(content)) return [];
const metadata = (content as { metadata?: unknown }).metadata;
if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) return [];
const custom = (metadata as { custom?: unknown }).custom;
if (!custom || typeof custom !== "object" || Array.isArray(custom)) return [];
const telemetry = (custom as { telemetry?: unknown }).telemetry;
if (!telemetry || typeof telemetry !== "object" || Array.isArray(telemetry)) return [];
const steps = (telemetry as { steps?: unknown }).steps;
if (!isRecord(content)) return [];
const metadata = content.metadata;
if (!isRecord(metadata)) return [];
const custom = metadata.custom;
if (!isRecord(custom)) return [];
const telemetry = custom.telemetry;
if (!isRecord(telemetry)) return [];
const steps = telemetry.steps;
if (!Array.isArray(steps)) return [];
return steps
.flatMap((step) => {
if (!step || typeof step !== "object" || Array.isArray(step)) return [];
const generationId = (step as { generationId?: unknown }).generationId;
const accessToken = (step as { generationAccessToken?: unknown }).generationAccessToken;
if (!isRecord(step)) return [];
const generationId = step.generationId;
const accessToken = step.generationAccessToken;
return typeof generationId === "string" &&
/^gen-[A-Za-z0-9_-]{1,128}$/.test(generationId) &&
typeof accessToken === "string" &&
@@ -541,16 +541,10 @@ const addFeedbackToMessageContent = (serializedContent: string, type: "positive"
} catch {
throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "The stored message is invalid." });
}
if (!content || typeof content !== "object" || Array.isArray(content)) {
if (!isRecord(content)) {
throw new TRPCError({ code: "INTERNAL_SERVER_ERROR", message: "The stored message is invalid." });
}
const metadata =
"metadata" in content &&
content.metadata &&
typeof content.metadata === "object" &&
!Array.isArray(content.metadata)
? content.metadata
: {};
const metadata = isRecord(content.metadata) ? content.metadata : {};
return stringify({
...content,
metadata: { ...metadata, submittedFeedback: { type } },
@@ -2,6 +2,8 @@ import { isDeepStrictEqual } from "node:util";
import { TRPCError } from "@trpc/server";
import { isRecord } from "@homarr/common";
interface BoardPlacement {
id: string;
kind: string;
@@ -70,12 +72,7 @@ export const throwIfCustomWidgetBoardDuplicationForbidden = (
function normalizeCustomWidgetOptions(options: Record<string, unknown>) {
return {
...options,
configuration:
options.configuration !== null &&
typeof options.configuration === "object" &&
!Array.isArray(options.configuration)
? options.configuration
: {},
configuration: isRecord(options.configuration) ? options.configuration : {},
configurationVersion:
typeof options.configurationVersion === "number" && Number.isInteger(options.configurationVersion)
? options.configurationVersion
@@ -1,5 +1,6 @@
import type { legacyCustomWidgetDefinitions } from "@homarr/db/schema";
import { buildCustomWidgetAiPrompt } from "@homarr/custom-widgets/authoring-prompt";
import { isRecord } from "@homarr/common";
type LegacyCustomWidgetDefinition = typeof legacyCustomWidgetDefinitions.$inferSelect;
@@ -65,7 +66,7 @@ function redactLegacyRequestBody(value: string | null) {
function redactAllValues(value: unknown): unknown {
if (Array.isArray(value)) return value.map(redactAllValues);
if (value !== null && typeof value === "object")
if (isRecord(value))
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, redactAllValues(child)]));
if (value === null) return null;
return "[REDACTED VALUE]";
@@ -3,6 +3,7 @@ import { createHash } from "node:crypto";
import { TRPCError } from "@trpc/server";
import { z } from "zod/v4";
import { isRecord } from "@homarr/common";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { customWidgetDefinitionSchema } from "@homarr/custom-widgets/core";
import { and, eq } from "@homarr/db";
@@ -143,7 +144,7 @@ export const templateProcedures = {
function getAffectedRowCount(result: unknown): number {
if (Array.isArray(result)) return getAffectedRowCount(result[0]);
if (!result || typeof result !== "object") return 0;
if (!isRecord(result)) return 0;
if ("affectedRows" in result && typeof result.affectedRows === "number") return result.affectedRows;
if ("rowCount" in result && typeof result.rowCount === "number") return result.rowCount;
if ("changes" in result && typeof result.changes === "number") return result.changes;
+36 -1
View File
@@ -20,6 +20,7 @@ import {
getHeaderItems,
headerPreferencesMutationSchema,
parseHeaderPreferences,
userByteUnitSystemSchema,
userChangeColorSchemeSchema,
userChangeHomeBoardsSchema,
userChangePasswordApiSchema,
@@ -212,7 +213,7 @@ export const userRouter = createTRPCRouter({
image: z
.string()
.regex(/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9/+]+=*$/g)
.max(350000) // approximately 256KB in base64 (256 * 1024 * 4 / 3 + prefixes)
.max(350000) // approximately 256 KiB in base64 (256 * 1024 * 4 / 3 + prefixes)
.nullable(),
}),
)
@@ -370,6 +371,7 @@ export const userRouter = createTRPCRouter({
provider: true,
homeBoardId: true,
mobileHomeBoardId: true,
byteUnitSystem: true,
firstDayOfWeek: true,
pingIconsEnabled: true,
enableRightClickOnWidgets: true,
@@ -408,6 +410,7 @@ export const userRouter = createTRPCRouter({
provider: true,
homeBoardId: true,
mobileHomeBoardId: true,
byteUnitSystem: true,
firstDayOfWeek: true,
pingIconsEnabled: true,
enableRightClickOnWidgets: true,
@@ -682,6 +685,38 @@ export const userRouter = createTRPCRouter({
})
.where(eq(users.id, ctx.session.user.id));
}),
changeByteUnitSystem: protectedProcedure
.input(userByteUnitSystemSchema.and(byIdSchema))
.output(z.void())
.mutation(async ({ input, ctx }) => {
if (!ctx.session.user.permissions.includes("admin") && ctx.session.user.id !== input.id) {
throw new TRPCError({
code: "NOT_FOUND",
message: "User not found",
});
}
const dbUser = await ctx.db.query.users.findFirst({
columns: {
id: true,
},
where: eq(users.id, input.id),
});
if (!dbUser) {
throw new TRPCError({
code: "NOT_FOUND",
message: "User not found",
});
}
await ctx.db
.update(users)
.set({
byteUnitSystem: input.byteUnitSystem,
})
.where(eq(users.id, input.id));
}),
changeEnableRightClickOnWidgets: protectedProcedure
.meta({
openapi: {
@@ -1,6 +1,7 @@
import { TRPCError } from "@trpc/server";
import { z } from "zod/v4";
import { isRecord } from "@homarr/common";
import { ResponseError } from "@homarr/common/server";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { mockWidgetData } from "@homarr/integrations";
@@ -26,7 +27,7 @@ const assertMockNoteExists = (noteId: string) => {
const isJsonDeltaString = (value: string) => {
try {
const parsed: unknown = JSON.parse(value);
return typeof parsed === "object" && parsed !== null && Array.isArray((parsed as { ops?: unknown }).ops);
return isRecord(parsed) && Array.isArray(parsed.ops);
} catch {
return false;
}
@@ -2,6 +2,7 @@ import { TRPCError } from "@trpc/server";
import { parse as parseSuperJson } from "superjson";
import { z } from "zod/v4";
import { isRecord } from "@homarr/common";
import { decryptSecret } from "@homarr/common/server";
import { eq } from "@homarr/db";
import { boards, customWidgetDefinitions, items, legacyCustomWidgetDefinitions } from "@homarr/db/schema";
@@ -49,12 +50,7 @@ const parseItemOptions = (raw: string): CustomWidgetItemOptions => {
if (typeof options.definitionId !== "string" || options.definitionId.length === 0) throw new Error();
return {
definitionId: options.definitionId,
configuration:
options.configuration !== null &&
typeof options.configuration === "object" &&
!Array.isArray(options.configuration)
? (options.configuration as Record<string, unknown>)
: {},
configuration: isRecord(options.configuration) ? options.configuration : {},
configurationVersion:
typeof options.configurationVersion === "number" && Number.isInteger(options.configurationVersion)
? options.configurationVersion
+1
View File
@@ -10,6 +10,7 @@ export const getRscUserSettingsAsync = cache(async (userId: string) =>
columns: {
homeBoardId: true,
mobileHomeBoardId: true,
byteUnitSystem: true,
firstDayOfWeek: true,
pingIconsEnabled: true,
enableRightClickOnWidgets: true,
+3 -2
View File
@@ -29,9 +29,10 @@ export const getSessionFromApiKeyAsync = async (
return null;
}
const [apiKeyId, apiKey] = apiKeyHeaderValue.split(".");
const apiKeyParts = apiKeyHeaderValue.split(".");
const [apiKeyId, apiKey] = apiKeyParts;
if (!apiKeyId || !apiKey) {
if (apiKeyParts.length !== 2 || !apiKeyId || !apiKey) {
logger.warn("Failed to authenticate with api-key", { ipAddress, userAgent, reason: "API_KEY_INVALID_FORMAT" });
return null;
}
+1 -2
View File
@@ -9,8 +9,7 @@ export const fixUsernames = command({
// eslint-disable-next-line no-restricted-syntax
handler: async () => {
if (!process.env.AUTH_PROVIDERS?.toLowerCase().includes("credentials")) {
console.error("Credentials provider is not enabled");
return;
throw new Error("Credentials provider is not enabled");
}
const credentialUsers = await db.query.users.findMany({
@@ -13,8 +13,11 @@ export const integrationsDelete = command({
// eslint-disable-next-line no-restricted-syntax
handler: async (options) => {
if (!options.id && !options.name) {
console.error("Either --id or --name must be provided");
return;
throw new Error("Either --id or --name must be provided");
}
if (options.id && options.name) {
throw new Error("Use either --id or --name, not both");
}
let entry;
@@ -29,8 +32,7 @@ export const integrationsDelete = command({
}
if (!entry) {
console.error("Integration not found");
return;
throw new Error("Integration not found");
}
await db.delete(integrations).where(eq(integrations.id, entry.id));
+5 -9
View File
@@ -17,16 +17,14 @@ export const recreateAdmin = command({
// eslint-disable-next-line no-restricted-syntax
handler: async (options) => {
if (!process.env.AUTH_PROVIDERS?.toLowerCase().includes("credentials")) {
console.error("Credentials provider is not enabled");
return;
throw new Error("Credentials provider is not enabled");
}
const result = await usernameSchema.safeParseAsync(options.username);
if (!result.success) {
console.error("Invalid username:");
console.error(result.error.issues.map((error) => `- ${error.message}`).join("\n"));
return;
const issues = result.error.issues.map((error) => `- ${error.message}`).join("\n");
throw new Error(`Invalid username:\n${issues}`);
}
const totalCount = await db
@@ -40,8 +38,7 @@ export const recreateAdmin = command({
.then((rows) => rows.at(0)?.count ?? 0);
if (totalCount > 0) {
console.error("Credentials admin user exists");
return;
throw new Error("Credentials admin user exists");
}
const existingUser = await db.query.users.findFirst({
@@ -49,8 +46,7 @@ export const recreateAdmin = command({
});
if (existingUser) {
console.error("User with this name already exists");
return;
throw new Error("User with this name already exists");
}
const temporaryGroupId = createId();
+2 -4
View File
@@ -14,8 +14,7 @@ export const resetPassword = command({
// eslint-disable-next-line no-restricted-syntax
handler: async (options) => {
if (!process.env.AUTH_PROVIDERS?.toLowerCase().includes("credentials")) {
console.error("Credentials provider is not enabled");
return;
throw new Error("Credentials provider is not enabled");
}
const user = await db.query.users.findFirst({
@@ -23,8 +22,7 @@ export const resetPassword = command({
});
if (!user?.password) {
console.error(`User ${options.username} not found`);
return;
throw new Error(`User ${options.username} not found`);
}
// Generates a new password with 48 characters
+6 -4
View File
@@ -13,8 +13,11 @@ export const usersDelete = command({
// eslint-disable-next-line no-restricted-syntax
handler: async (options) => {
if (!options.id && !options.username) {
console.error("Either --id or --username must be provided");
return;
throw new Error("Either --id or --username must be provided");
}
if (options.id && options.username) {
throw new Error("Use either --id or --username, not both");
}
let user;
@@ -29,8 +32,7 @@ export const usersDelete = command({
}
if (!user) {
console.error("User not found");
return;
throw new Error("User not found");
}
await db.delete(users).where(eq(users.id, user.id));
@@ -15,13 +15,15 @@ export const usersUpdatePassword = command({
// eslint-disable-next-line no-restricted-syntax
handler: async (options) => {
if (!process.env.AUTH_PROVIDERS?.toLowerCase().includes("credentials")) {
console.error("Credentials provider is not enabled");
return;
throw new Error("Credentials provider is not enabled");
}
if (!options.id && !options.username) {
console.error("Either --id or --username must be provided");
return;
throw new Error("Either --id or --username must be provided");
}
if (options.id && options.username) {
throw new Error("Use either --id or --username, not both");
}
const user = await db.query.users.findFirst({
@@ -30,8 +32,7 @@ export const usersUpdatePassword = command({
});
if (!user?.password) {
console.error("User not found or has no credentials record");
return;
throw new Error("User not found or has no credentials record");
}
await db
-1
View File
@@ -12,4 +12,3 @@ export * from "./error";
export * from "./theme";
export * from "./function";
export * from "./grid-algorithm";
export * from "./id";
+55 -57
View File
@@ -16,53 +16,17 @@ export const formatNumber = (value: number, decimalPlaces: number) => {
return value.toFixed(decimalPlaces);
};
export const randomInt = (min: number, max: number) => {
return Math.floor(Math.random() * (max - min + 1) + min);
};
/**
* Number of bytes to a human-readable string using binary (KiB) suffixes.
* Does not accept floats; size in bytes should be an integer.
* Will return "NaI" and log a warning if a float is passed.
* `concat` is appended after the unit so it is omitted when the returned
* value is "NaI" or "∞". Returns "∞" if the size is too large to be
* represented in the current format.
*
* @deprecated Use `formatBytes` for single values, `formatBytesPair` for
* paired "used / total" displays, and `formatByteRate` for byte-per-second
* rates. This function is kept for backwards compatibility but should not
* be used in new code.
*/
export const humanFileSize = (size: number, concat = ""): string => {
//64bit limit for Number stops at EiB
const siRanges = ["B", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB"];
if (!Number.isInteger(size)) {
console.warn(
"Invalid use of the humanFileSize function with a float, please report this and what integration this is impacting.",
);
//Not an Integer
return "NaI";
}
let count = 0;
while (count < siRanges.length) {
const tempSize = size / Math.pow(1024, count);
if (tempSize < 1024) {
return tempSize.toFixed(Math.min(count, 1)) + siRanges[count] + concat;
}
count++;
}
return "∞";
};
const BINARY_UNITS = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"] as const;
const DECIMAL_UNITS = ["B", "KB", "MB", "GB", "TB", "PB", "EB"] as const;
export const defaultByteUnitSystem = "decimal" as const;
export type ByteUnitSystem = "binary" | "decimal";
export interface FormatBytesOptions {
/**
* Unit system to use. "binary" uses 1024 as the base and KiB/MiB/GiB/TiB suffixes,
* "decimal" uses 1000 as the base and KB/MB/GB/TB suffixes. Defaults to "binary".
* "decimal" uses 1000 as the base and KB/MB/GB/TB suffixes. Defaults to "decimal".
*/
unit?: ByteUnitSystem;
}
@@ -78,10 +42,17 @@ const pickUnitIndex = (bytes: number, base: number, lastIndex: number): number =
return index;
};
const pickRoundedUnitIndex = (value: number, base: number, lastIndex: number, fractionDigits: number): number => {
const index = pickUnitIndex(value, base, lastIndex);
if (index >= lastIndex) return index;
const scaled = value / base ** index;
return Number(scaled.toFixed(fractionDigits)) >= base ? index + 1 : index;
};
const sanitizeBytes = (bytes: number): number => (Number.isFinite(bytes) && bytes > 0 ? bytes : 0);
const resolveUnitConfig = (options: FormatBytesOptions) => {
const { unit = "binary" } = options;
const { unit = defaultByteUnitSystem } = options;
return {
units: unit === "binary" ? BINARY_UNITS : DECIMAL_UNITS,
base: unit === "binary" ? 1024 : 1000,
@@ -92,45 +63,45 @@ const resolveUnitConfig = (options: FormatBytesOptions) => {
* Format a byte value as a human-readable string with a unit suffix.
*
* Picks the largest unit that keeps the scaled value below the base. Use
* `formatBytesPair` when two related values (e.g. used and available) should
* `formatBytesPair` when two related values (e.g. used and total) should
* share a common unit.
*
* @example
* formatBytes(0); // "0.0 B"
* formatBytes(1024); // "1.0 KiB"
* formatBytes(985828802560); // "918.1 GiB"
* formatBytes(985828802560, { unit: "decimal" }); // "985.8 GB"
* formatBytes(1000); // "1.0 KB"
* formatBytes(985828802560); // "985.8 GB"
* formatBytes(985828802560, { unit: "binary" }); // "918.1 GiB"
*/
export const formatBytes = (bytes: number, options: FormatBytesOptions = {}): string => {
const { units, base } = resolveUnitConfig(options);
const safe = sanitizeBytes(bytes);
const index = pickUnitIndex(safe, base, units.length - 1);
const index = pickRoundedUnitIndex(safe, base, units.length - 1, 1);
const scaled = safe / base ** index;
return `${scaled.toFixed(1)} ${units[index]}`;
};
/**
* Format two related byte values (typically `used` and `available`) with a
* shared unit. The unit is picked from the sum of the two values so the
* combined display stays consistent.
* Format two related byte values (typically `used` and `total`) with a shared
* unit. The unit is picked from the larger displayed value so the pair stays
* consistent without promoting both values before either crosses a boundary.
*
* @example
* formatBytesPair(985828802560, 2858736793190);
* // { used: "0.9 TiB", available: "2.6 TiB" }
* // { used: "1.0 TB", total: "2.9 TB" }
*/
export const formatBytesPair = (
used: number,
available: number,
total: number,
options: FormatBytesOptions = {},
): { used: string; available: string } => {
): { used: string; total: string } => {
const { units, base } = resolveUnitConfig(options);
const safeUsed = sanitizeBytes(used);
const safeAvailable = sanitizeBytes(available);
const index = pickUnitIndex(safeUsed + safeAvailable, base, units.length - 1);
const safeTotal = sanitizeBytes(total);
const index = pickRoundedUnitIndex(Math.max(safeUsed, safeTotal), base, units.length - 1, 1);
const suffix = units[index];
return {
used: `${(safeUsed / base ** index).toFixed(1)} ${suffix}`,
available: `${(safeAvailable / base ** index).toFixed(1)} ${suffix}`,
total: `${(safeTotal / base ** index).toFixed(1)} ${suffix}`,
};
};
@@ -141,13 +112,40 @@ export const formatBytesPair = (
*
* @example
* formatByteRate(0); // "0.0 B/s"
* formatByteRate(1024); // "1.0 KiB/s"
* formatByteRate(985828802560, { unit: "decimal" }); // "985.8 GB/s"
* formatByteRate(1000); // "1.0 KB/s"
* formatByteRate(985828802560, { unit: "binary" }); // "918.1 GiB/s"
*/
export const formatByteRate = (bytes: number, options: FormatBytesOptions = {}): string =>
`${formatBytes(bytes, options)}/s`;
const BIT_RATE_UNITS = ["b/s", "Kb/s", "Mb/s", "Gb/s", "Tb/s", "Pb/s", "Eb/s"] as const;
export interface FormatBitRateOptions {
/** Maximum number of fractional digits. Trailing zeroes are omitted. Defaults to 1. */
maximumFractionDigits?: number;
}
/**
* Format a bit-per-second rate using decimal SI units.
*
* Inputs are always bits per second. Callers whose upstream contract uses
* kilobits must normalize explicitly before calling this function.
*
* @example
* formatBitRate(999); // "999 b/s"
* formatBitRate(1_000); // "1 Kb/s"
* formatBitRate(1_500_000); // "1.5 Mb/s"
*/
export const formatBitRate = (bitsPerSecond: number, options: FormatBitRateOptions = {}): string => {
const safeRate = Number.isFinite(bitsPerSecond) && bitsPerSecond > 0 ? bitsPerSecond : 0;
const requestedDigits = options.maximumFractionDigits ?? 1;
const maximumFractionDigits = Math.max(0, Math.min(20, Math.trunc(requestedDigits)));
const index = pickRoundedUnitIndex(safeRate, 1000, BIT_RATE_UNITS.length - 1, maximumFractionDigits);
const scaled = safeRate / 1000 ** index;
const formatted = Number(scaled.toFixed(maximumFractionDigits)).toString();
return `${formatted} ${BIT_RATE_UNITS[index]}`;
};
const IMPERIAL_MULTIPLIER = 1.609344;
export const metricToImperial = (metricValue: number) => metricValue / IMPERIAL_MULTIPLIER;
export const imperialToMetric = (imperialValue: number) => imperialValue * IMPERIAL_MULTIPLIER;
+3
View File
@@ -1,5 +1,8 @@
import { hashKey } from "@tanstack/query-core";
export const isRecord = (value: unknown): value is Record<string, unknown> =>
value !== null && typeof value === "object" && !Array.isArray(value);
export function objectKeys<O extends object>(obj: O): (keyof O)[] {
return Object.keys(obj) as (keyof O)[];
}
+58 -34
View File
@@ -1,35 +1,35 @@
import { describe, expect, it } from "vitest";
import { formatByteRate, formatBytes, formatBytesPair } from "../number";
import { formatBitRate, formatByteRate, formatBytes, formatBytesPair } from "../number";
describe("formatBytes", () => {
it("returns bytes for small values", () => {
expect(formatBytes(0)).toBe("0.0 B");
expect(formatBytes(1)).toBe("1.0 B");
expect(formatBytes(1023)).toBe("1023.0 B");
expect(formatBytes(999)).toBe("999.0 B");
});
it("scales binary units correctly", () => {
expect(formatBytes(1024)).toBe("1.0 KiB");
expect(formatBytes(1024 ** 2)).toBe("1.0 MiB");
expect(formatBytes(1024 ** 3)).toBe("1.0 GiB");
expect(formatBytes(1024 ** 4)).toBe("1.0 TiB");
it("scales decimal units by default", () => {
expect(formatBytes(1000)).toBe("1.0 KB");
expect(formatBytes(1000 ** 2)).toBe("1.0 MB");
expect(formatBytes(1000 ** 3)).toBe("1.0 GB");
expect(formatBytes(1000 ** 4)).toBe("1.0 TB");
});
it("scales decimal units when requested", () => {
expect(formatBytes(1000, { unit: "decimal" })).toBe("1.0 KB");
expect(formatBytes(1000 ** 2, { unit: "decimal" })).toBe("1.0 MB");
expect(formatBytes(1000 ** 3, { unit: "decimal" })).toBe("1.0 GB");
expect(formatBytes(1000 ** 4, { unit: "decimal" })).toBe("1.0 TB");
it("scales binary units when requested", () => {
expect(formatBytes(1024, { unit: "binary" })).toBe("1.0 KiB");
expect(formatBytes(1024 ** 2, { unit: "binary" })).toBe("1.0 MiB");
expect(formatBytes(1024 ** 3, { unit: "binary" })).toBe("1.0 GiB");
expect(formatBytes(1024 ** 4, { unit: "binary" })).toBe("1.0 TiB");
});
it("formats a typical storage value with one decimal", () => {
expect(formatBytes(985828802560)).toBe("918.1 GiB");
expect(formatBytes(985828802560, { unit: "decimal" })).toBe("985.8 GB");
expect(formatBytes(985828802560)).toBe("985.8 GB");
expect(formatBytes(985828802560, { unit: "binary" })).toBe("918.1 GiB");
});
it("caps at the largest unit to avoid overflow", () => {
expect(formatBytes(Number.MAX_SAFE_INTEGER)).toMatch(/PiB$/);
expect(formatBytes(Number.MAX_SAFE_INTEGER)).toMatch(/PB$/);
});
it("returns the zero value for negative or non-finite input", () => {
@@ -40,47 +40,53 @@ describe("formatBytes", () => {
});
describe("formatBytesPair", () => {
it("picks the unit of the larger total and applies it to both values", () => {
const { used, available } = formatBytesPair(985828802560, 2858736793190);
expect(used).toBe("0.9 TiB");
expect(available).toBe("2.6 TiB");
it("picks the unit of the larger value and applies it to both values", () => {
const { used, total } = formatBytesPair(985828802560, 2858736793190);
expect(used).toBe("1.0 TB");
expect(total).toBe("2.9 TB");
});
it("uses a smaller unit when both values fit in it", () => {
const { used, available } = formatBytesPair(1024 * 1024 * 100, 1024 * 1024 * 200);
expect(used).toBe("100.0 MiB");
expect(available).toBe("200.0 MiB");
const { used, total } = formatBytesPair(1024 * 1024 * 100, 1024 * 1024 * 200);
expect(used).toBe("104.9 MB");
expect(total).toBe("209.7 MB");
});
it("does not promote the pair when only their sum crosses a unit boundary", () => {
const { used, total } = formatBytesPair(700 * 1024, 700 * 1024);
expect(used).toBe("716.8 KB");
expect(total).toBe("716.8 KB");
});
it("falls back to zero when both inputs are invalid", () => {
const { used, available } = formatBytesPair(Number.NaN, -1);
const { used, total } = formatBytesPair(Number.NaN, -1);
expect(used).toBe("0.0 B");
expect(available).toBe("0.0 B");
expect(total).toBe("0.0 B");
});
it("uses the same unit across both values when one is invalid", () => {
const { used, available } = formatBytesPair(Number.NaN, 1024 ** 4);
expect(used).toBe("0.0 TiB");
expect(available).toBe("1.0 TiB");
const { used, total } = formatBytesPair(Number.NaN, 1024 ** 4);
expect(used).toBe("0.0 TB");
expect(total).toBe("1.1 TB");
});
it("honours the decimal unit option", () => {
const { used, available } = formatBytesPair(500_000_000_000, 1_500_000_000_000, { unit: "decimal" });
const { used, total } = formatBytesPair(500_000_000_000, 1_500_000_000_000, { unit: "decimal" });
expect(used).toBe("0.5 TB");
expect(available).toBe("1.5 TB");
expect(total).toBe("1.5 TB");
});
});
describe("formatByteRate", () => {
it("appends a /s suffix to the formatted value", () => {
expect(formatByteRate(0)).toBe("0.0 B/s");
expect(formatByteRate(1024)).toBe("1.0 KiB/s");
expect(formatByteRate(1024 ** 3)).toBe("1.0 GiB/s");
expect(formatByteRate(1000)).toBe("1.0 KB/s");
expect(formatByteRate(1000 ** 3)).toBe("1.0 GB/s");
});
it("honours the decimal unit option", () => {
expect(formatByteRate(1000, { unit: "decimal" })).toBe("1.0 KB/s");
expect(formatByteRate(1000 ** 2, { unit: "decimal" })).toBe("1.0 MB/s");
it("honours the binary unit option", () => {
expect(formatByteRate(1024, { unit: "binary" })).toBe("1.0 KiB/s");
expect(formatByteRate(1024 ** 2, { unit: "binary" })).toBe("1.0 MiB/s");
});
it("returns zero for invalid input", () => {
@@ -88,3 +94,21 @@ describe("formatByteRate", () => {
expect(formatByteRate(Number.NaN)).toBe("0.0 B/s");
});
});
describe("formatBitRate", () => {
it("uses decimal SI units with one optional fractional digit", () => {
expect(formatBitRate(999)).toBe("999 b/s");
expect(formatBitRate(1_000)).toBe("1 Kb/s");
expect(formatBitRate(1_000_000)).toBe("1 Mb/s");
expect(formatBitRate(1_500_000)).toBe("1.5 Mb/s");
expect(formatBitRate(1_000_000_000)).toBe("1 Gb/s");
expect(formatBitRate(1_234_567)).toBe("1.2 Mb/s");
});
it("returns zero for non-positive or non-finite rates", () => {
expect(formatBitRate(0)).toBe("0 b/s");
expect(formatBitRate(-1)).toBe("0 b/s");
expect(formatBitRate(Number.NaN)).toBe("0 b/s");
expect(formatBitRate(Number.POSITIVE_INFINITY)).toBe("0 b/s");
});
});
@@ -0,0 +1 @@
ALTER TABLE `user` ADD `byte_unit_system` varchar(7) DEFAULT 'decimal' NOT NULL;
File diff suppressed because it is too large. Load diff
@@ -344,6 +344,13 @@
"when": 1787556966768,
"tag": "0048_add_header_preferences_and_branding",
"breakpoints": true
},
{
"idx": 49,
"version": "5",
"when": 1788763848931,
"tag": "0049_add_byte_unit_system",
"breakpoints": true
}
]
}
@@ -0,0 +1 @@
ALTER TABLE "user" ADD COLUMN "byte_unit_system" varchar(7) DEFAULT 'decimal' NOT NULL;
File diff suppressed because it is too large. Load diff
@@ -106,6 +106,13 @@
"when": 1787556966592,
"tag": "0014_add_header_preferences_and_branding",
"breakpoints": true
},
{
"idx": 15,
"version": "7",
"when": 1788763848932,
"tag": "0015_add_byte_unit_system",
"breakpoints": true
}
]
}
@@ -0,0 +1 @@
ALTER TABLE `user` ADD `byte_unit_system` text DEFAULT 'decimal' NOT NULL;
File diff suppressed because it is too large. Load diff
@@ -330,6 +330,13 @@
"when": 1787556956665,
"tag": "0046_add_header_preferences_and_branding",
"breakpoints": true
},
{
"idx": 47,
"version": "6",
"when": 1788763848930,
"tag": "0047_add_byte_unit_system",
"breakpoints": true
}
]
}
+3
View File
@@ -42,6 +42,8 @@ import type {
SupportedAuthProvider,
WidgetKind,
} from "@homarr/definitions";
import { defaultByteUnitSystem } from "@homarr/common";
import type { ByteUnitSystem } from "@homarr/common";
import type { CustomWidgetSecretKind } from "@homarr/custom-widgets/core";
import { defaultHeaderPreferencesSerialized } from "@homarr/validation/header-preferences";
@@ -83,6 +85,7 @@ export const users = mysqlTable("user", {
openSearchInNewTab: boolean().default(false).notNull(),
ddgBangs: boolean().default(true).notNull(),
colorScheme: varchar({ length: 5 }).$type<ColorScheme>().default("dark").notNull(),
byteUnitSystem: varchar({ length: 7 }).$type<ByteUnitSystem>().default(defaultByteUnitSystem).notNull(),
firstDayOfWeek: tinyint().$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
pingIconsEnabled: boolean().default(false).notNull(),
enableRightClickOnWidgets: boolean().default(true).notNull(),
+3
View File
@@ -40,6 +40,8 @@ import type {
SupportedAuthProvider,
WidgetKind,
} from "@homarr/definitions";
import { defaultByteUnitSystem } from "@homarr/common";
import type { ByteUnitSystem } from "@homarr/common";
import type { CustomWidgetSecretKind } from "@homarr/custom-widgets/core";
import { defaultHeaderPreferencesSerialized } from "@homarr/validation/header-preferences";
@@ -81,6 +83,7 @@ export const users = pgTable("user", {
openSearchInNewTab: boolean().default(false).notNull(),
ddgBangs: boolean().default(true).notNull(),
colorScheme: varchar({ length: 5 }).$type<ColorScheme>().default("dark").notNull(),
byteUnitSystem: varchar({ length: 7 }).$type<ByteUnitSystem>().default(defaultByteUnitSystem).notNull(),
firstDayOfWeek: smallint().$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
pingIconsEnabled: boolean().default(false).notNull(),
enableRightClickOnWidgets: boolean().default(true).notNull(),
+3
View File
@@ -28,6 +28,8 @@ import type {
SupportedAuthProvider,
WidgetKind,
} from "@homarr/definitions";
import { defaultByteUnitSystem } from "@homarr/common";
import type { ByteUnitSystem } from "@homarr/common";
import type { CustomWidgetSecretKind } from "@homarr/custom-widgets/core";
import { defaultHeaderPreferencesSerialized } from "@homarr/validation/header-preferences";
@@ -63,6 +65,7 @@ export const users = sqliteTable("user", {
openSearchInNewTab: int({ mode: "boolean" }).default(true).notNull(),
ddgBangs: int({ mode: "boolean" }).default(true).notNull(),
colorScheme: text().$type<ColorScheme>().default("dark").notNull(),
byteUnitSystem: text().$type<ByteUnitSystem>().default(defaultByteUnitSystem).notNull(),
firstDayOfWeek: int().$type<DayOfWeek>().default(1).notNull(), // Defaults to Monday
pingIconsEnabled: int({ mode: "boolean" }).default(false).notNull(),
enableRightClickOnWidgets: int({ mode: "boolean" }).default(true).notNull(),
+5 -1
View File
@@ -1,5 +1,7 @@
import { createSelectSchema } from "drizzle-zod";
import { userByteUnitSystemSchema } from "@homarr/validation/user";
import { apps, boards, groups, invites, searchEngines, serverSettings, users } from "./schema";
export const selectAppSchema = createSelectSchema(apps);
@@ -8,4 +10,6 @@ export const selectGroupSchema = createSelectSchema(groups);
export const selectInviteSchema = createSelectSchema(invites);
export const selectSearchEnginesSchema = createSelectSchema(searchEngines);
export const selectSeverSettingsSchema = createSelectSchema(serverSettings);
export const selectUserSchema = createSelectSchema(users);
export const selectUserSchema = createSelectSchema(users, {
byteUnitSystem: userByteUnitSystemSchema.shape.byteUnitSystem,
});
@@ -37,7 +37,6 @@ export type HomarrDocumentationPath =
| "/blog/tags/update"
| "/blog/tags/version"
| "/blog/translations"
| "/carbon-test"
| "/search"
| "/docs/tags"
| "/docs/tags/active-directory"
+4 -2
View File
@@ -1,3 +1,5 @@
import { isRecord } from "@homarr/common";
export const dockerEndpointCapabilities = ["inventory", "logs", "lifecycle", "remove"] as const;
export type DockerEndpointCapability = (typeof dockerEndpointCapabilities)[number];
@@ -101,8 +103,8 @@ const parseCapabilities = (value: unknown, index: number): DockerEndpointCapabil
};
const getRecord = (value: unknown, path: string): Record<string, unknown> => {
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`${path} must be an object`);
return value as Record<string, unknown>;
if (!isRecord(value)) throw new Error(`${path} must be an object`);
return value;
};
const getNonEmptyString = (value: unknown, path: string) => {
+5 -5
View File
@@ -13,11 +13,11 @@ export const containerStateColorMap = {
} satisfies Record<ContainerState, MantineColor>;
export const memoryUsageColor = (number: number, state: string): MantineColor => {
const mbUsage = number / 1024 / 1024;
if (mbUsage === 0 && state !== "running") return "red";
if (mbUsage < 128) return "green";
if (mbUsage < 256) return "yellow";
if (mbUsage < 512) return "orange";
const mebibyteUsage = number / 1024 / 1024;
if (mebibyteUsage === 0 && state !== "running") return "red";
if (mebibyteUsage < 128) return "green";
if (mebibyteUsage < 256) return "yellow";
if (mebibyteUsage < 512) return "orange";
return "red";
};
+2 -2
View File
@@ -1,6 +1,6 @@
import { createHmac, hkdfSync } from "node:crypto";
import { createId } from "@homarr/common";
import { createId, formatBytes } from "@homarr/common";
import { env } from "@homarr/common/env";
import { decryptSecret, encryptSecret } from "@homarr/common/server";
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
@@ -100,7 +100,7 @@ export class ImageProxy {
url: this.redactUrl(urlAndHeaders.url),
headers: this.redactHeaders(urlAndHeaders.headers),
proxyUrl,
size: `${(arrayBuffer.byteLength / 1024).toFixed(1)}KB`,
size: formatBytes(arrayBuffer.byteLength),
});
return { image: arrayBuffer, contentType: response.headers.get("content-type") };
@@ -1,3 +1,4 @@
import { isRecord } from "@homarr/common";
import { ResponseError } from "@homarr/common/server";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
@@ -66,7 +67,7 @@ export const normalizeRealtimeSnapshot = (
const id = `realtime-${receivedAt.getTime()}`;
const events: LiveStatsEvent[] = [];
if (payload.stats && typeof payload.stats === "object" && !Array.isArray(payload.stats)) {
if (isRecord(payload.stats)) {
events.push({
type: "system_stats",
record: { id, system: systemId, stats: payload.stats, type: "1m", created, updated: created },
@@ -40,7 +40,7 @@ export interface BeszelSystemInfo {
dp: number;
/** battery [level%, charging state] */
bat?: [number, number];
/** bandwidth — public interface (Mbps, legacy). Use bb when available */
/** bandwidth — public interface (MiB/s, legacy). Use bb when available */
b?: number;
/** bandwidth — public interface (bytes/s, newer format). Preferred over b */
bb?: number;
@@ -94,9 +94,9 @@ export interface BeszelSystemDetails {
*
* Units:
* - CPU/GPU/memory/disk percentages: 0–100
* - Memory/disk absolute values (mu, du, m, d, etc.): GB
* - Disk I/O (dr, dw): MB/s
* - Network (ns, nr): bytes/s — all interfaces (including loopback, docker bridges)
* - Memory/disk absolute values (mu, du, m, d, etc.): GiB
* - Disk I/O (dr, dw): MiB/s
* - Legacy network (ns, nr): MiB/s — all interfaces (including loopback, docker bridges)
* - Bandwidth (b): bytes/s [sent, recv] — public interfaces only. Prefer b over ns/nr for user-facing charts
*/
export interface BeszelSystemStats {
@@ -110,49 +110,49 @@ export interface BeszelSystemStats {
cpus?: number[];
/** load average [1m, 5m, 15m] */
la?: [number, number, number];
/** total memory (GB) */
/** total memory (GiB) */
m: number;
/** memory used (GB) */
/** memory used (GiB) */
mu: number;
/** memory usage (%) */
mp: number;
/** memory buffer/cache (GB) */
/** memory buffer/cache (GiB) */
mb: number;
/** memory max used (GB) */
/** memory max used (GiB) */
mm?: number;
/** memory zfs arc (GB) */
/** memory zfs arc (GiB) */
mz?: number;
/** total swap (GB) */
/** total swap (GiB) */
s: number;
/** swap used (GB) */
/** swap used (GiB) */
su: number;
/** total disk (GB) */
/** total disk (GiB) */
d: number;
/** disk used (GB) */
/** disk used (GiB) */
du: number;
/** disk usage (%) */
dp: number;
/** disk read (MB/s) */
/** disk read (MiB/s) */
dr?: number;
/** disk write (MB/s) */
/** disk write (MiB/s) */
dw?: number;
/** disk read max (MB/s) */
/** disk read max (MiB/s) */
drm?: number;
/** disk write max (MB/s) */
/** disk write max (MiB/s) */
dwm?: number;
/** disk IOPS [read, write] */
/** disk throughput [read bytes/s, write bytes/s]. Prefer over dr/dw */
dio?: [number, number];
/** disk IOPS max [read, write] */
/** disk throughput max [read bytes/s, write bytes/s] */
diom?: [number, number];
/** network sent — all interfaces (bytes/s) */
/** legacy network sent — all interfaces (MiB/s) */
ns?: number;
/** network received — all interfaces (bytes/s) */
/** legacy network received — all interfaces (MiB/s) */
nr?: number;
/** bandwidth — public interfaces only (bytes/s) [sent, recv]. Prefer over ns/nr */
b?: [number, number];
/** network sent max (bytes/s) */
/** legacy network sent max (MiB/s) */
nsm?: number;
/** network received max (bytes/s) */
/** legacy network received max (MiB/s) */
nrm?: number;
/** bandwidth max [sent, recv] (bytes/s) */
bm?: [number, number];
@@ -173,21 +173,21 @@ export interface BeszelExtraFsStats {
d: number;
/** disk used (GiB) */
du: number;
/** read (bytes/s) */
/** legacy disk read (MiB/s) */
r: number;
/** write (bytes/s) */
/** legacy disk write (MiB/s) */
w: number;
/** read max (bytes/s) */
/** legacy disk read max (MiB/s) */
rm?: number;
/** write max (bytes/s) */
/** legacy disk write max (MiB/s) */
wm?: number;
/** read (IOPS) */
/** disk read (bytes/s) */
rb?: number;
/** write (IOPS) */
/** disk write (bytes/s) */
wb?: number;
/** read max (IOPS) */
/** disk read max (bytes/s) */
rbm?: number;
/** write max (IOPS) */
/** disk write max (bytes/s) */
wbm?: number;
}
@@ -236,18 +236,18 @@ export interface BeszelContainer {
* One entry per container in a BeszelContainerStatsRecord.
*
* Network fields: b (bandwidth) is preferred when available; fall back to ns/nr.
* Units: m = MB, c = %, b/ns/nr = bytes/s
* Units: m/ns/nr = MiB or MiB/s, c = %, b = bytes/s
*/
export interface BeszelContainerStats {
/** container name */
n: string;
/** CPU usage (%) */
c: number;
/** memory usage (MB) */
/** memory usage (MiB) */
m: number;
/** network sent (bytes/s) — legacy, use b when available */
/** network sent (MiB/s) — legacy, use b when available */
ns?: number;
/** network received (bytes/s) — legacy, use b when available */
/** network received (MiB/s) — legacy, use b when available */
nr?: number;
/** network bandwidth [sent, recv] (bytes/s) — preferred over ns/nr */
b?: [number, number];
@@ -388,7 +388,7 @@ export interface BeszelSystemRow {
gpu: number;
/** load average [1m, 5m, 15m] */
loadAvg: [number, number, number] | null;
/** public interface bandwidth (bytes/s). From info.bb or info.b * 1M */
/** public interface bandwidth (bytes/s). From info.bb or legacy info.b normalized from MiB/s */
netBytes: number;
/** temperature (°C) */
temp: number | null;
@@ -37,7 +37,8 @@ export class SabnzbdIntegration extends Integration implements IDownloadClientIn
const { history } = historyResult;
const status: DownloadClientStatus = {
paused: queue.paused,
rates: { down: Math.floor(Number(queue.kbpersec) * 1024) }, //Actually rounded kiBps ()
// SABnzbd's legacy kbpersec field is kibibytes per second; normalize it to bytes per second.
rates: { down: Math.floor(Number(queue.kbpersec) * 1024) },
types: [type],
};
const items = queue.slots
+35 -31
View File
@@ -10,8 +10,9 @@ import type {
LiveStatsEvent,
} from "../../beszel/beszel-types";
const GB = 1024 * 1024 * 1024;
const KB = 1024;
const KIBIBYTE = 1024;
const MEBIBYTE = 1024 * KIBIBYTE;
const GIBIBYTE = 1024 * MEBIBYTE;
interface MockSystemDef {
name: string;
@@ -34,7 +35,7 @@ const mockSystems: MockSystemDef[] = [
os: "Ubuntu 24.04",
cpu: "AMD Ryzen 9 7950X",
cores: 16,
mem: 64 * GB,
mem: 64 * GIBIBYTE,
arch: "amd64",
baseCpu: 35,
baseMem: 55,
@@ -47,7 +48,7 @@ const mockSystems: MockSystemDef[] = [
os: "Debian 12",
cpu: "Intel Xeon E-2388G",
cores: 8,
mem: 32 * GB,
mem: 32 * GIBIBYTE,
arch: "amd64",
baseCpu: 12,
baseMem: 70,
@@ -60,7 +61,7 @@ const mockSystems: MockSystemDef[] = [
os: "Raspberry Pi OS",
cpu: "ARM Cortex-A76",
cores: 4,
mem: 8 * GB,
mem: 8 * GIBIBYTE,
arch: "aarch64",
baseCpu: 45,
baseMem: 82,
@@ -73,7 +74,7 @@ const mockSystems: MockSystemDef[] = [
os: "Proxmox VE 8.2",
cpu: "Intel i7-13700K",
cores: 16,
mem: 128 * GB,
mem: 128 * GIBIBYTE,
arch: "amd64",
baseCpu: 22,
baseMem: 48,
@@ -86,7 +87,7 @@ const mockSystems: MockSystemDef[] = [
os: "TrueNAS SCALE",
cpu: "Intel Xeon E5-2680",
cores: 12,
mem: 48 * GB,
mem: 48 * GIBIBYTE,
arch: "amd64",
baseCpu: 8,
baseMem: 30,
@@ -95,15 +96,15 @@ const mockSystems: MockSystemDef[] = [
},
];
const containerProfiles: { name: string; cpuBase: number; memMB: number; netKB: number }[] = [
{ name: "nginx", cpuBase: 2, memMB: 120, netKB: 800 },
{ name: "postgres", cpuBase: 8, memMB: 450, netKB: 200 },
{ name: "redis", cpuBase: 3, memMB: 180, netKB: 500 },
{ name: "grafana", cpuBase: 5, memMB: 280, netKB: 150 },
{ name: "prometheus", cpuBase: 6, memMB: 350, netKB: 300 },
{ name: "traefik", cpuBase: 4, memMB: 90, netKB: 1200 },
{ name: "minio", cpuBase: 3, memMB: 200, netKB: 600 },
{ name: "gitea", cpuBase: 4, memMB: 250, netKB: 100 },
const containerProfiles: { name: string; cpuBase: number; memMiB: number; netKiB: number }[] = [
{ name: "nginx", cpuBase: 2, memMiB: 120, netKiB: 800 },
{ name: "postgres", cpuBase: 8, memMiB: 450, netKiB: 200 },
{ name: "redis", cpuBase: 3, memMiB: 180, netKiB: 500 },
{ name: "grafana", cpuBase: 5, memMiB: 280, netKiB: 150 },
{ name: "prometheus", cpuBase: 6, memMiB: 350, netKiB: 300 },
{ name: "traefik", cpuBase: 4, memMiB: 90, netKiB: 1200 },
{ name: "minio", cpuBase: 3, memMiB: 200, netKiB: 600 },
{ name: "gitea", cpuBase: 4, memMiB: 250, netKiB: 100 },
];
const rand = (min: number, max: number) => min + Math.random() * (max - min);
@@ -144,30 +145,30 @@ function generateSystemStatsSeries(count: number, sys: MockSystemDef): BeszelSys
const netSendWalk = smoothWalk(500, 200, count, 10, 8000);
const netRecvWalk = smoothWalk(800, 300, count, 10, 12000);
const diskTotal = rand(200, 2000) * GB;
const diskTotal = rand(200, 2000) * GIBIBYTE;
return cpuWalk.map((cpu, i) => {
const memPct = memPctWalk[i] ?? sys.baseMem;
const diskPct = diskPctWalk[i] ?? sys.baseDisk;
const memTotalGB = sys.mem / GB;
const diskTotalGB = diskTotal / GB;
const memTotalGiB = sys.mem / GIBIBYTE;
const diskTotalGiB = diskTotal / GIBIBYTE;
return {
cpu,
la: [cpu / 20 + rand(0, 0.5), cpu / 25 + rand(0, 0.3), cpu / 30 + rand(0, 0.2)] as [number, number, number],
m: memTotalGB,
mu: (memTotalGB * memPct) / 100,
m: memTotalGiB,
mu: (memTotalGiB * memPct) / 100,
mp: memPct,
mb: rand(0.5, 4),
s: 4,
su: rand(0, 2),
d: diskTotalGB,
du: (diskTotalGB * diskPct) / 100,
d: diskTotalGiB,
du: (diskTotalGiB * diskPct) / 100,
dp: diskPct,
dr: diskReadWalk[i] ?? 5,
dw: diskWriteWalk[i] ?? 3,
ns: (netSendWalk[i] ?? 500) * KB,
nr: (netRecvWalk[i] ?? 800) * KB,
b: [(netSendWalk[i] ?? 500) * KB * 0.7, (netRecvWalk[i] ?? 800) * KB * 0.7] as [number, number],
ns: ((netSendWalk[i] ?? 500) * KIBIBYTE) / MEBIBYTE,
nr: ((netRecvWalk[i] ?? 800) * KIBIBYTE) / MEBIBYTE,
b: [(netSendWalk[i] ?? 500) * KIBIBYTE * 0.7, (netRecvWalk[i] ?? 800) * KIBIBYTE * 0.7] as [number, number],
};
});
}
@@ -176,16 +177,19 @@ function generateContainerStatsSeries(count: number, profiles: typeof containerP
const walks = profiles.map((p) => ({
profile: p,
cpuWalk: smoothWalk(p.cpuBase, 1.5, count, 0, 50),
memWalk: smoothWalk(p.memMB, p.memMB * 0.1, count, p.memMB * 0.5, p.memMB * 2),
netWalk: smoothWalk(p.netKB, p.netKB * 0.3, count, 0, p.netKB * 4),
memWalk: smoothWalk(p.memMiB, p.memMiB * 0.1, count, p.memMiB * 0.5, p.memMiB * 2),
netWalk: smoothWalk(p.netKiB, p.netKiB * 0.3, count, 0, p.netKiB * 4),
}));
return Array.from({ length: count }, (_, i) =>
walks.map(({ profile, cpuWalk, memWalk, netWalk }) => ({
n: profile.name,
c: cpuWalk[i] ?? profile.cpuBase,
m: memWalk[i] ?? profile.memMB,
b: [(netWalk[i] ?? profile.netKB) * KB * 0.4, (netWalk[i] ?? profile.netKB) * KB * 0.6] as [number, number],
m: memWalk[i] ?? profile.memMiB,
b: [(netWalk[i] ?? profile.netKiB) * KIBIBYTE * 0.4, (netWalk[i] ?? profile.netKiB) * KIBIBYTE * 0.6] as [
number,
number,
],
})),
);
}
@@ -227,7 +231,7 @@ export class BeszelMockService {
mp: clamp(sys.baseMem + rand(-5, 5), 0, 100),
dp: clamp(sys.baseDisk + rand(-2, 2), 0, 100),
efs: i === 0 ? { "/mnt/sda": 86.9, "/mnt/sdb": 70.5, "/mnt/sdc": 42.7 } : undefined,
bb: rand(200, 3000) * KB,
bb: rand(200, 3000) * KIBIBYTE,
v: "0.8.2",
g: i === 3 ? rand(15, 45) : 0,
dt: rand(32, 58),
@@ -1,3 +1,4 @@
import { isRecord } from "@homarr/common";
import { ResponseError } from "@homarr/common/server";
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
@@ -38,7 +39,7 @@ export class PiHoleIntegrationV5 extends Integration implements DnsHoleSummaryIn
const data = await response.json();
// Pi-hole v5 returned an empty array if the API key is wrong
if (typeof data !== "object" || Array.isArray(data)) {
if (!isRecord(data)) {
return TestConnectionError.UnauthorizedResult(401);
}
@@ -10,6 +10,7 @@ import type { SynologyDiskRecord, SynologyVolumeRecord } from "./synology-types"
import {
AUTH_API_NAME,
INFO_API_NAME,
parseSynologyNumber,
REQUEST_TIMEOUT_MS,
SESSION_ERROR_CODES,
synologyApiInfoResponseSchema,
@@ -174,8 +175,8 @@ export class SynologyClient {
status: string | undefined,
displayName?: string,
): SynologyVolumeRecord | null {
const usedBytes = parseNumericValue(usedValue);
const totalBytes = parseNumericValue(totalValue);
const usedBytes = parseSynologyNumber(usedValue);
const totalBytes = parseSynologyNumber(totalValue);
if (usedBytes === null || totalBytes === null || totalBytes <= 0) {
return null;
}
@@ -194,7 +195,7 @@ export class SynologyClient {
identifier: disk.id ?? disk.name ?? disk.display_name ?? "unknown-disk",
name: disk.display_name ?? disk.name ?? disk.id ?? "unknown-disk",
status: disk.smart_status ?? disk.status,
temperature: parseOptionalNumericValue(disk.temp ?? disk.temperature),
temperature: parseSynologyNumber(disk.temp ?? disk.temperature),
volumeName: disk.volume_id ?? disk.vol_path,
}));
}
@@ -205,7 +206,7 @@ export class SynologyClient {
identifier: disk.disk_id ?? disk.id ?? disk.name ?? "unknown-disk",
name: disk.name ?? disk.disk_id ?? disk.id ?? "unknown-disk",
status: disk.overall_status ?? disk.status,
temperature: parseOptionalNumericValue(disk.temp ?? disk.temperature),
temperature: parseSynologyNumber(disk.temp ?? disk.temperature),
volumeName: undefined,
}));
}
@@ -394,16 +395,3 @@ function extractCookieHeader(headers: Headers): string | null {
return cookies.map((cookie) => cookie.split(";")[0]).join("; ");
}
function parseNumericValue(value: number | string | undefined): number | null {
if (value === undefined) {
return null;
}
const parsed = typeof value === "number" ? value : Number.parseFloat(value);
return Number.isFinite(parsed) ? parsed : null;
}
function parseOptionalNumericValue(value: number | string | undefined): number | null {
const parsed = parseNumericValue(value);
return parsed === null ? null : parsed;
}
@@ -10,6 +10,7 @@ import type { TestingResult } from "../base/test-connection/test-connection-serv
import type { ISystemHealthMonitoringIntegration } from "../interfaces/health-monitoring/health-monitoring-integration";
import type { SystemHealthMonitoring } from "../interfaces/health-monitoring/health-monitoring-types";
import { SynologyClient } from "./synology-client";
import { parseSynologyNumber } from "./synology-types";
import type { SynologyDiskRecord, SynologyVolumeRecord } from "./synology-types";
import type { synologySystemInfoDataSchema, synologyUtilizationDataSchema } from "./synology-types";
@@ -125,16 +126,16 @@ function mapVersion(systemInfo: z.infer<typeof synologySystemInfoDataSchema>): s
}
function mapCpuUtilization(utilization: z.infer<typeof synologyUtilizationDataSchema>): number {
const userLoad = parseNumericValue(utilization.cpu?.user_load) ?? 0;
const systemLoad = parseNumericValue(utilization.cpu?.system_load) ?? 0;
const userLoad = parseSynologyNumber(utilization.cpu?.user_load) ?? 0;
const systemLoad = parseSynologyNumber(utilization.cpu?.system_load) ?? 0;
const totalLoad = userLoad + systemLoad;
return Math.min(totalLoad, 100);
}
function mapMemoryBytes(utilization: z.infer<typeof synologyUtilizationDataSchema>) {
const memory = utilization.memory;
const totalRealKib = parseNumericValue(memory?.total_real);
const realUsagePercent = parseNumericValue(memory?.real_usage);
const totalRealKib = parseSynologyNumber(memory?.total_real);
const realUsagePercent = parseSynologyNumber(memory?.real_usage);
// DSM utilization API reports memory sizes in KiB, not bytes.
if (totalRealKib !== null && realUsagePercent !== null) {
@@ -146,8 +147,8 @@ function mapMemoryBytes(utilization: z.infer<typeof synologyUtilizationDataSchem
};
}
const availableKib = parseNumericValue(memory?.avail_real) ?? 0;
const cachedKib = parseNumericValue(memory?.cached) ?? 0;
const availableKib = parseSynologyNumber(memory?.avail_real) ?? 0;
const cachedKib = parseSynologyNumber(memory?.cached) ?? 0;
const totalKib = totalRealKib ?? availableKib + cachedKib;
const usedKib = Math.max(totalKib - availableKib, 0);
@@ -163,8 +164,8 @@ function mapNetworkTraffic(utilization: z.infer<typeof synologyUtilizationDataSc
return null;
}
const received = parseNumericValue(totalNetwork.rx);
const transmitted = parseNumericValue(totalNetwork.tx);
const received = parseSynologyNumber(totalNetwork.rx);
const transmitted = parseSynologyNumber(totalNetwork.tx);
if (received === null || transmitted === null) {
return null;
}
@@ -176,9 +177,9 @@ function mapNetworkTraffic(utilization: z.infer<typeof synologyUtilizationDataSc
}
function mapLoadAverage(utilization: z.infer<typeof synologyUtilizationDataSchema>) {
const oneMinute = parseNumericValue(utilization.cpu?.["1min_load"]);
const fiveMinute = parseNumericValue(utilization.cpu?.["5min_load"]);
const fifteenMinute = parseNumericValue(utilization.cpu?.["15min_load"]);
const oneMinute = parseSynologyNumber(utilization.cpu?.["1min_load"]);
const fiveMinute = parseSynologyNumber(utilization.cpu?.["5min_load"]);
const fifteenMinute = parseSynologyNumber(utilization.cpu?.["15min_load"]);
if (oneMinute === null && fiveMinute === null && fifteenMinute === null) {
return null;
@@ -210,7 +211,7 @@ function mapUptimeSeconds(systemInfo: z.infer<typeof synologySystemInfoDataSchem
}
function mapCpuTemperature(systemInfo: z.infer<typeof synologySystemInfoDataSchema>): number | undefined {
const temperature = parseNumericValue(systemInfo.sys_temp ?? systemInfo.temperature);
const temperature = parseSynologyNumber(systemInfo.sys_temp ?? systemInfo.temperature);
return temperature === null ? undefined : temperature;
}
@@ -313,11 +314,3 @@ function isHealthyStatus(status: string | undefined): boolean {
normalizedStatus.includes(unhealthyToken),
);
}
function parseNumericValue(value: number | string | undefined): number | null {
if (value === undefined) {
return null;
}
const parsed = typeof value === "number" ? value : Number.parseFloat(value);
return Number.isFinite(parsed) ? parsed : null;
}
@@ -36,6 +36,14 @@ export const synologyAuthResponseSchema = synologyEnvelopeSchema.extend({
const numericString = z.union([z.number(), z.string()]);
export function parseSynologyNumber(value: number | string | undefined): number | null {
if (value === undefined) {
return null;
}
const parsed = typeof value === "number" ? value : Number.parseFloat(value);
return Number.isFinite(parsed) ? parsed : null;
}
export const synologySystemInfoDataSchema = z
.object({
up_time: z.string().optional(),
@@ -2,7 +2,7 @@ import type { RawData } from "ws";
import { WebSocket } from "ws";
import z from "zod";
import { createId } from "@homarr/common";
import { createId, isRecord } from "@homarr/common";
import { matchErrorCode, RequestError, ResponseError } from "@homarr/common/server";
import {
getAllTrustedCertificatesAsync,
@@ -306,9 +306,7 @@ const resolveCertificateOptionsAsync = async (): Promise<CertificateOptions> =>
const parseMessage = (raw: RawData): Record<string, unknown> | undefined => {
try {
const parsed: unknown = JSON.parse(raw.toString());
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)
? (parsed as Record<string, unknown>)
: undefined;
return isRecord(parsed) ? parsed : undefined;
} catch {
return undefined;
}
@@ -1,5 +1,6 @@
import dayjs from "dayjs";
import { isRecord } from "@homarr/common";
import { ResponseError } from "@homarr/common/server";
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
import { createLogger } from "@homarr/core/infrastructure/logs";
@@ -39,8 +40,8 @@ const pad = (number: number) => String(number).padStart(2, "0");
const extractDataArray = (json: unknown): unknown[] => {
if (Array.isArray(json)) return json;
if (json && typeof json === "object" && "data" in json && Array.isArray((json as { data: unknown }).data)) {
return (json as { data: unknown[] }).data;
if (isRecord(json) && Array.isArray(json.data)) {
return json.data;
}
return [];
};
@@ -12,13 +12,13 @@ import {
Text,
ThemeIcon,
} from "@mantine/core";
import { IconBulb, IconPlus, IconSearch } from "@tabler/icons-react";
import { IconListCheck, IconPlus, IconSearch } from "@tabler/icons-react";
import type { RouterOutputs } from "@homarr/api";
import { clientApi } from "@homarr/api/client";
import { createModal, modalSizeSelect, useModalAction } from "@homarr/modals";
import { useI18n } from "@homarr/translation/client";
import { FloatingTip, selectGridCols, SelectableCard } from "@homarr/ui";
import { selectGridCols, SelectableCard } from "@homarr/ui";
import { QuickAddAppModal } from "./quick-add-app/quick-add-app-modal";
@@ -33,31 +33,43 @@ interface AppSelectModalProps {
export const AppSelectModal = createModal<AppSelectModalProps>(({ actions, innerProps }) => {
const [search, setSearch] = useState("");
const [selectedAppIds, setSelectedAppIds] = useState<Set<string>>(new Set());
const [createdApps, setCreatedApps] = useState<SelectableApp[]>([]);
const [multiSelectActive, setMultiSelectActive] = useState(false);
const t = useI18n();
const { data: apps = [], isPending } = clientApi.app.selectable.useQuery();
const { openModal: openQuickAddAppModal } = useModalAction(QuickAddAppModal);
const multiSelect = Boolean(innerProps.onSelectMany);
const multiSelectAvailable = Boolean(innerProps.onSelectMany);
const selectableApps = useMemo(
() => [...apps, ...createdApps.filter((createdApp) => !apps.some((app) => app.id === createdApp.id))],
[apps, createdApps],
);
const filteredApps = useMemo(
() =>
apps
selectableApps
.filter((app) => app.name.toLowerCase().includes(search.toLowerCase()))
.sort((appA, appB) => appA.name.localeCompare(appB.name)),
[apps, search],
[search, selectableApps],
);
const selectedApps = useMemo(() => apps.filter((app) => selectedAppIds.has(app.id)), [apps, selectedAppIds]);
const selectedApps = useMemo(
() => selectableApps.filter((app) => selectedAppIds.has(app.id)),
[selectableApps, selectedAppIds],
);
const handleSelect = (app: SelectableApp, event?: React.MouseEvent) => {
const isModifierPressed = multiSelect && Boolean(event?.shiftKey || event?.ctrlKey || event?.metaKey);
const isModifierPressed = multiSelectAvailable && Boolean(event?.shiftKey || event?.ctrlKey || event?.metaKey);
if (innerProps.onSelect && !isModifierPressed && selectedAppIds.size === 0) {
innerProps.onSelect(app);
if (!multiSelectActive && !isModifierPressed) {
if (innerProps.onSelect) innerProps.onSelect(app);
else innerProps.onSelectMany?.([app]);
actions.closeModal();
return;
}
if (multiSelect) {
if (multiSelectAvailable) {
setMultiSelectActive(true);
setSelectedAppIds((current) => {
const next = new Set(current);
if (next.has(app.id)) next.delete(app.id);
@@ -70,11 +82,13 @@ export const AppSelectModal = createModal<AppSelectModalProps>(({ actions, inner
const handleAddNewApp = () => {
openQuickAddAppModal({
onClose(app) {
if (multiSelect) {
if (multiSelectActive) {
setCreatedApps((current) => [...current, app]);
setSelectedAppIds((current) => new Set(current).add(app.id));
return;
}
innerProps.onSelect?.(app);
if (innerProps.onSelect) innerProps.onSelect(app);
else innerProps.onSelectMany?.([app]);
actions.closeModal();
},
});
@@ -85,19 +99,13 @@ export const AppSelectModal = createModal<AppSelectModalProps>(({ actions, inner
actions.closeModal();
};
const handleMultiSelectToggle = () => {
if (multiSelectActive) setSelectedAppIds(new Set());
setMultiSelectActive((current) => !current);
};
return (
<Stack gap="md">
<FloatingTip
opened={multiSelect}
showDelay={2_000}
dismissAfter={3_000}
transitionDuration={200}
closable={false}
alertProps={{ color: "primaryColor", icon: <IconBulb size={18} />, variant: "light" }}
>
{t("tips.multiSelectApps")}
</FloatingTip>
{/* Top Search Input */}
<Stack gap={6}>
<Input
@@ -113,6 +121,19 @@ export const AppSelectModal = createModal<AppSelectModalProps>(({ actions, inner
}
}}
/>
{multiSelectAvailable && (
<Group justify="flex-end">
<Button
size="compact-sm"
variant={multiSelectActive ? "light" : "subtle"}
leftSection={<IconListCheck size={16} />}
aria-pressed={multiSelectActive}
onClick={handleMultiSelectToggle}
>
{multiSelectActive ? t("app.action.select.cancelMultiple") : t("app.action.select.selectMultiple")}
</Button>
</Group>
)}
</Stack>
{/* Scrollable Container with App Cards */}
@@ -143,7 +164,7 @@ export const AppSelectModal = createModal<AppSelectModalProps>(({ actions, inner
key={app.id}
app={app}
isSelected={selectedAppIds.has(app.id)}
multiSelect={multiSelect}
multiSelectActive={multiSelectActive}
onSelect={handleSelect}
/>
))}
@@ -158,17 +179,22 @@ export const AppSelectModal = createModal<AppSelectModalProps>(({ actions, inner
</ScrollArea.Autosize>
{/* Multi-Select Action Footer */}
{multiSelect && selectedApps.length > 0 && (
{multiSelectActive && (
<Paper withBorder p="xs" radius="md" bg="light-dark(var(--mantine-color-gray-0), var(--mantine-color-dark-8))">
<Group justify="space-between" align="center">
<Text size="sm" fw={600}>
{t("app.action.select.appsSelected", { count: selectedApps.length })}
</Text>
<Group gap="xs">
<Button variant="default" size="xs" onClick={() => setSelectedAppIds(new Set())}>
<Button
variant="default"
size="xs"
disabled={selectedApps.length === 0}
onClick={() => setSelectedAppIds(new Set())}
>
{t("common.action.discard")}
</Button>
<Button color="primaryColor" size="xs" onClick={handleMultiSubmit}>
<Button color="primaryColor" size="xs" disabled={selectedApps.length === 0} onClick={handleMultiSubmit}>
{t("common.action.add")} ({selectedApps.length})
</Button>
</Group>
@@ -188,12 +214,12 @@ export const AppSelectModal = createModal<AppSelectModalProps>(({ actions, inner
const AppCard = ({
app,
isSelected,
multiSelect,
multiSelectActive,
onSelect,
}: {
app: SelectableApp;
isSelected: boolean;
multiSelect: boolean;
multiSelectActive: boolean;
onSelect: (app: SelectableApp, event?: React.MouseEvent) => void;
}) => {
const t = useI18n();
@@ -208,7 +234,7 @@ const AppCard = ({
description={app.description}
footerLeft={
<Text size="xs" c="dimmed">
{multiSelect && isSelected ? t("app.action.select.selected") : t("app.action.select.application")}
{multiSelectActive && isSelected ? t("app.action.select.selected") : t("app.action.select.application")}
</Text>
}
/>
+2 -1
View File
@@ -160,6 +160,7 @@ export const useConfirmModal = () => {
const { openModal } = useModalAction(ConfirmModal);
return {
openConfirmModal: (props: ConfirmModalProps) => openModal(props, { title: props.title }),
openConfirmModal: (props: ConfirmModalProps, options?: Pick<OpenModalOptions, "onClose">) =>
openModal(props, { title: props.title, onClose: options?.onClose }),
};
};
+4 -3
View File
@@ -13,6 +13,7 @@ import type {
import { createIntegrationRequestHandler } from "./lib/integration-request-handler";
const logger = createLogger({ module: "beszelRequestHandler" });
const MEBIBYTE = 1024 ** 2;
export type { BeszelSystemRow } from "@homarr/integrations/types";
@@ -22,7 +23,7 @@ export type { BeszelSystemRow } from "@homarr/integrations/types";
*
* BeszelSystemInfo uses short field names (see beszel-types.ts for full docs):
* cpu=CPU%, mp=memory%, dp=disk%, g=GPU%, la=loadAvg, u=uptime(s), v=version,
* bb=bandwidth(bytes/s), b=bandwidth(Mbps legacy), dt=disk temp, bat=battery,
* bb=bandwidth(bytes/s), b=bandwidth(MiB/s legacy), dt=disk temp, bat=battery,
* sv=[running,total] services, h=hostname, m=CPU model, c=cores, ct=threads
*/
function mapToSystemRow(system: BeszelSystem, details: BeszelSystemDetails | null): BeszelSystemRow {
@@ -37,8 +38,8 @@ function mapToSystemRow(system: BeszelSystem, details: BeszelSystemDetails | nul
extraFilesystems: info.efs ?? {},
gpu: info.g ?? 0,
loadAvg: info.la ?? null,
// bb = bytes/s (newer), b = Mbps (legacy, multiply to get bytes/s)
netBytes: info.bb ?? (info.b ?? 0) * 1_000_000,
// bb = bytes/s (newer), b = MiB/s (legacy, normalize to bytes/s)
netBytes: info.bb ?? (info.b ?? 0) * MEBIBYTE,
temp: info.dt ?? null,
battery: info.bat ?? null,
services: info.sv?.[0] ?? 0,
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
import { serialize } from "superjson";
import { isRecord } from "@homarr/common";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
import {
@@ -23,9 +24,6 @@ const SHARED_CACHE_ENVELOPE_VERSION = 2;
const DEFAULT_HANDLER_CACHE_VERSION = "v1";
const namespacePattern = /^[a-z0-9][a-z0-9:-]*$/;
const cacheVersionPattern = /^[a-z0-9][a-z0-9._-]*$/;
const isRecord = (value: unknown): value is Record<string, unknown> =>
value !== null && typeof value === "object" && !Array.isArray(value);
const canonicalize = (value: unknown): unknown => {
if (Array.isArray(value)) return value.map(canonicalize);
if (!isRecord(value)) return value;
+1
View File
@@ -1,2 +1,3 @@
export * from "./src/context";
export * from "./src/byte-format";
export * from "./src/preferences/definitions";
+1
View File
@@ -22,6 +22,7 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@homarr/common": "workspace:^0.1.0",
"@homarr/db": "workspace:^0.1.0",
"@homarr/server-settings": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
+20
View File
@@ -0,0 +1,20 @@
"use client";
import { useMemo } from "react";
import { formatByteRate, formatBytes, formatBytesPair } from "@homarr/common";
import { useSettings } from "./context";
export const useByteFormatter = () => {
const { byteUnitSystem } = useSettings();
return useMemo(
() => ({
formatBytes: (bytes: number) => formatBytes(bytes, { unit: byteUnitSystem }),
formatBytesPair: (used: number, total: number) => formatBytesPair(used, total, { unit: byteUnitSystem }),
formatByteRate: (bytes: number) => formatByteRate(bytes, { unit: byteUnitSystem }),
}),
[byteUnitSystem],
);
};
+4
View File
@@ -1,4 +1,5 @@
import type { User } from "@homarr/db/schema";
import { defaultByteUnitSystem } from "@homarr/common";
import type { ServerSettings } from "@homarr/server-settings";
import { parseBrandingSettings } from "@homarr/server-settings";
import type { HeaderPreferences } from "@homarr/validation/user";
@@ -11,6 +12,7 @@ export type SettingsContextProps = Omit<
| "defaultSearchEngineId"
| "homeBoardId"
| "mobileHomeBoardId"
| "byteUnitSystem"
| "openSearchInNewTab"
| "ddgBangs"
| "pingIconsEnabled"
@@ -42,6 +44,7 @@ export type UserSettings = Pick<
| "defaultSearchEngineId"
| "homeBoardId"
| "mobileHomeBoardId"
| "byteUnitSystem"
| "openSearchInNewTab"
| "ddgBangs"
| "pingIconsEnabled"
@@ -59,6 +62,7 @@ export const createSettings = ({
defaultSearchEngineId: user?.defaultSearchEngineId ?? serverSettings.search.defaultSearchEngineId,
openSearchInNewTab: user?.openSearchInNewTab ?? true,
ddgBangs: user?.ddgBangs ?? true,
byteUnitSystem: user?.byteUnitSystem ?? defaultByteUnitSystem,
firstDayOfWeek: user?.firstDayOfWeek ?? (1 as const),
homeBoardId: user?.homeBoardId ?? serverSettings.board.homeBoardId,
mobileHomeBoardId: user?.mobileHomeBoardId ?? serverSettings.board.mobileHomeBoardId,
@@ -35,6 +35,13 @@ export const userPreferenceDefinitions = [
mutationGroup: "firstDayOfWeek",
aliases: ["calendar", "week", "weekday"],
},
{
key: "byteUnitSystem",
kind: "select",
guest: false,
mutationGroup: "byteUnitSystem",
aliases: ["data", "size", "storage", "unit", "binary", "decimal", "GB", "GiB"],
},
{
key: "homeBoardId",
kind: "board",
@@ -7,6 +7,7 @@ import dayjs from "dayjs";
import localeData from "dayjs/plugin/localeData";
import { useSession } from "@homarr/auth/client";
import type { ByteUnitSystem } from "@homarr/common";
import type { ColorScheme } from "@homarr/definitions";
import { visiblePreferenceDefinitions } from "@homarr/settings";
import { localeConfigurations } from "@homarr/translation";
@@ -75,11 +76,16 @@ const SELECT_KINDS = new Set(["select", "searchEngine", "board"]);
export const useSettingsActions = (_: Record<string, unknown>, query: string): SettingsAction[] => {
const t = useI18n("search.mode.command.group.preferences.option");
const tUserField = useI18n("user.field");
const tByteUnit = useI18n("user.field.byteUnitSystem.options");
const tColorScheme = useI18n("common.colorScheme.options");
const { data: session } = useSession();
const isAuthenticated = Boolean(session?.user);
const normalizedQuery = query.trim().toLowerCase();
const preferences = useUserPreferences();
const byteUnitLabels: Record<ByteUnitSystem, string> = {
decimal: `${tByteUnit("decimal")} (KB, MB, GB)`,
binary: `${tByteUnit("binary")} (KiB, MiB, GiB)`,
};
const valueLabelResolvers: Record<string, () => string> = {
colorScheme: () => tColorScheme(preferences.getPreference("colorScheme").value as ColorScheme),
@@ -88,6 +94,7 @@ export const useSettingsActions = (_: Record<string, unknown>, query: string): S
return localeConfigurations[val as keyof typeof localeConfigurations]?.name ?? String(val);
},
firstDayOfWeek: () => dayjs.weekdays(false)[preferences.getPreference("firstDayOfWeek").value as DayOfWeek] ?? "",
byteUnitSystem: () => byteUnitLabels[preferences.getPreference("byteUnitSystem").value as ByteUnitSystem],
};
return visiblePreferenceDefinitions(isAuthenticated)
@@ -9,6 +9,7 @@ import {
IconHome,
IconLanguage,
IconLayoutBoard,
IconRulerMeasure,
IconSearch,
IconSettings,
IconWorldWww,
@@ -41,6 +42,7 @@ export type UserFieldPreferenceKey =
| "defaultSearchEngine"
| "openSearchInNewTab"
| "ddgBangs"
| "byteUnitSystem"
| "pingIconsEnabled"
| "enableRightClickOnWidgets";
@@ -48,6 +50,7 @@ export const userFieldPreferenceLabels: Partial<Record<UserPreferenceKey, UserFi
defaultSearchEngineId: "defaultSearchEngine",
openSearchInNewTab: "openSearchInNewTab",
ddgBangs: "ddgBangs",
byteUnitSystem: "byteUnitSystem",
pingIconsEnabled: "pingIconsEnabled",
enableRightClickOnWidgets: "enableRightClickOnWidgets",
} satisfies Partial<Record<UserPreferenceKey, UserFieldPreferenceKey>>;
@@ -59,6 +62,7 @@ export const preferenceIcons: Record<UserPreferenceKey, TablerIcon> = {
openSearchInNewTab: IconExternalLink,
ddgBangs: IconWorldWww,
firstDayOfWeek: IconCalendarWeek,
byteUnitSystem: IconRulerMeasure,
homeBoardId: IconHome,
mobileHomeBoardId: IconLayoutBoard,
pingIconsEnabled: IconActivity,
@@ -136,6 +140,13 @@ export const preferenceChildrenOptionsByKey: Partial<Record<UserPreferenceKey, C
value: day,
})),
),
byteUnitSystem: createStaticChildren("byteUnitSystem", () => {
const t = useI18n("user.field.byteUnitSystem.options");
return [
{ key: "decimal", label: `${t("decimal")} (KB, MB, GB)`, value: "decimal" },
{ key: "binary", label: `${t("binary")} (KiB, MiB, GiB)`, value: "binary" },
];
}),
homeBoardId: createAsyncSelectableChildren(
"homeBoardId",
() => clientApi.board.getAllBoards.useQuery(),
@@ -7,6 +7,7 @@ import type { DayOfWeek } from "@mantine/dates";
import { clientApi } from "@homarr/api/client";
import { useSession } from "@homarr/auth/client";
import type { ByteUnitSystem } from "@homarr/common";
import type { ColorScheme } from "@homarr/definitions";
import { showErrorNotification } from "@homarr/notifications";
import type { SettingsContextProps } from "@homarr/settings/creator";
@@ -92,6 +93,7 @@ export const useUserPreferences = () => {
const searchMutation = clientApi.user.changeSearchPreferences.useMutation({ onSuccess: refresh });
const homeBoardsMutation = clientApi.user.changeHomeBoards.useMutation({ onSuccess: refresh });
const firstDayMutation = clientApi.user.changeFirstDayOfWeek.useMutation({ onSuccess: refresh });
const byteUnitSystemMutation = clientApi.user.changeByteUnitSystem.useMutation({ onSuccess: refresh });
const pingMutation = clientApi.user.changePingIconsEnabled.useMutation({ onSuccess: refresh });
const rightClickMutation = clientApi.user.changeEnableRightClickOnWidgets.useMutation({ onSuccess: refresh });
@@ -116,6 +118,8 @@ export const useUserPreferences = () => {
mobileHomeBoardId: pick("mobileHomeBoardId", key, value) as string | null,
}),
firstDayOfWeek: (uid, _key, value) => firstDayMutation.mutateAsync({ id: uid, firstDayOfWeek: value as DayOfWeek }),
byteUnitSystem: (uid, _key, value) =>
byteUnitSystemMutation.mutateAsync({ id: uid, byteUnitSystem: value as ByteUnitSystem }),
pingIconsEnabled: (uid, _key, value) => pingMutation.mutateAsync({ id: uid, pingIconsEnabled: value as boolean }),
enableRightClickOnWidgets: (uid, _key, value) =>
rightClickMutation.mutateAsync({ id: uid, enableRightClickOnWidgets: value as boolean }),
@@ -125,6 +129,7 @@ export const useUserPreferences = () => {
searchPreferences: searchMutation.isPending,
homeBoards: homeBoardsMutation.isPending,
firstDayOfWeek: firstDayMutation.isPending,
byteUnitSystem: byteUnitSystemMutation.isPending,
pingIconsEnabled: pingMutation.isPending,
enableRightClickOnWidgets: rightClickMutation.isPending,
};
+3 -3
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informació",
"processor": "Processador: {cpuModelName}",
"memory": "Memòria: {memory}GiB",
"memoryAvailable": "Disponible: {memoryAvailable}GiB ({percent}%)",
"memory": "Memòria: {memory}",
"memoryAvailable": "Disponible: {memoryAvailable} ({percent}%)",
"version": "Versió: {version}",
"uptime": "Temps d'activitat: {months} Mesos, {days} Dies, {hours} Hores, {minutes} Minuts",
"loadAverage": "Càrrega mitjana:",
@@ -2699,7 +2699,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Amaga els torrents completats sota aquest llindar (en kiB/s)"
"label": "Amaga els torrents completats sota aquest llindar"
},
"categoryFilter": {
"label": "Categories/etiquetes per filtrar"
+5 -5
View File
@@ -2345,8 +2345,8 @@
"popover": {
"information": "信息",
"processor": "处理器:{cpuModelName}",
"memory": "内存:{memory} GiB",
"memoryAvailable": "可用:{memoryAvailable}GiB ({percent}%)",
"memory": "内存:{memory}",
"memoryAvailable": "可用:{memoryAvailable} ({percent}%)",
"version": "版本:{version}",
"uptime": "运行时间:{months} 月,{days} 天,{hours} 时,{minutes} 分",
"loadAverage": "平均负载:",
@@ -3091,7 +3091,7 @@
"label": "显示标记为已完成的杂项"
},
"activeTorrentThreshold": {
"label": "隐藏在此阈值下已完成的 Torrent (kiB/s)"
"label": "隐藏在此阈值下已完成的 Torrent"
},
"categoryFilter": {
"label": "要过滤的分类/标签"
@@ -3881,7 +3881,7 @@
"label": "百分比 (例如76%)"
},
"absolute": {
"label": "绝对值 (例如,800GB / 1TB)"
"label": "绝对值"
},
"free": {
"label": "空闲空间百分比(例如24%空闲)"
@@ -5178,7 +5178,7 @@
"restore": {
"dropzone": {
"title": "将备份 ZIP 拖到此处",
"description": "接受 Homarr SQLite 备份的 .zip 文件(最大 256 MB)"
"description": "接受 Homarr SQLite 备份的 .zip 文件(最大 {maxSize})"
},
"analyzing": "正在分析备份……",
"changeFile": "更改文件",
+1 -1
View File
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Sem přetáhněte ZIP se zálohou",
"description": "Přijímá soubory .zip ze zálohy Homarr SQLite (max. 256 MB)"
"description": "Přijímá soubory .zip ze zálohy Homarr SQLite (max. {maxSize})"
},
"analyzing": "Analýza zálohy...",
"changeFile": "Změnit soubor",
+5 -5
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Information",
"processor": "Processor: {cpuModelName}",
"memory": "Memory: {memory}GiB",
"memoryAvailable": "Tilgængelig: {memoryAvailable}GiB ({percent}%)",
"memory": "Memory: {memory}",
"memoryAvailable": "Tilgængelig: {memoryAvailable} ({percent}%)",
"version": "Version: {version}",
"uptime": "Oppetid: {months} Måneder, {days} Dage, {hours} Timer, {minutes} Minutter",
"loadAverage": "Belastningsgennemsnit:",
@@ -2886,7 +2886,7 @@
"label": "Vis Diverse poster markeret som færdige"
},
"activeTorrentThreshold": {
"label": "Skjul afsluttet torrent under denne tærskel (i kiB/s)"
"label": "Skjul afsluttet torrent under denne tærskel"
},
"categoryFilter": {
"label": "Kategorier/etiketter der skal filtreres"
@@ -3676,7 +3676,7 @@
"label": "Procentdel (f.eks. 76 %)"
},
"absolute": {
"label": "Absolutte værdier (f.eks. 800GB / 1TB)"
"label": "Absolutte værdier"
},
"free": {
"label": "Fri pladsprocent (fx, 24% fri)"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Slip din backup-ZIP her",
"description": "Accepterer .zip-filer fra en Homarr SQLite-backup (maks 256 MB)"
"description": "Accepterer .zip-filer fra en Homarr SQLite-backup (maks {maxSize})"
},
"analyzing": "Analyserer backup...",
"changeFile": "Skift fil",
+3 -3
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informationen",
"processor": "Prozessor: {cpuModelName}",
"memory": "Speicher: {memory}GiB",
"memoryAvailable": "Verfügbar: {memoryAvailable} GiB ({percent}%)",
"memory": "Speicher: {memory}",
"memoryAvailable": "Verfügbar: {memoryAvailable} ({percent}%)",
"version": "",
"uptime": "Laufzeit: {months} Monate, {days} Tage, {hours} Stunden, {minutes} Minuten",
"loadAverage": "Durchschnittliche Last:",
@@ -2886,7 +2886,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Abgeschlossene Torrents unter diesem Schwellenwert ausblenden (in kiB/s)"
"label": "Abgeschlossene Torrents unter diesem Schwellenwert ausblenden"
},
"categoryFilter": {
"label": "Kategorien/Labels zum Filtern"
+5 -5
View File
@@ -2194,8 +2194,8 @@
"popover": {
"information": "Informationen",
"processor": "Prozessor: {cpuModelName}",
"memory": "Speicher: {memory}GiB",
"memoryAvailable": "Verfügbar: {memoryAvailable} GiB ({percent}%)",
"memory": "Speicher: {memory}",
"memoryAvailable": "Verfügbar: {memoryAvailable} ({percent}%)",
"version": "Version: {version}",
"uptime": "Laufzeit: {months} Monate, {days} Tage, {hours} Stunden, {minutes} Minuten",
"loadAverage": "Durchschnittliche Last:",
@@ -2940,7 +2940,7 @@
"label": "Andere Einträge als abgeschlossen anzeigen"
},
"activeTorrentThreshold": {
"label": "Abgeschlossene Torrents unter diesem Schwellenwert ausblenden (in kiB/s)"
"label": "Abgeschlossene Torrents unter diesem Schwellenwert ausblenden"
},
"categoryFilter": {
"label": "Kategorien/Labels zum Filtern"
@@ -3730,7 +3730,7 @@
"label": "Prozentsatz (z.B. 76%)"
},
"absolute": {
"label": "Absolute Werte (z.B. 800GB / 1TB)"
"label": "Absolute Werte"
},
"free": {
"label": "Prozentsatz freier Speicherplatz (z. B. 24% frei)"
@@ -5022,7 +5022,7 @@
"restore": {
"dropzone": {
"title": "Backup-ZIP hierher ziehen",
"description": "Akzeptiert .zip-Dateien von einem Homarr SQLite-Backup (max. 256 MB)"
"description": "Akzeptiert .zip-Dateien von einem Homarr SQLite-Backup (max. {maxSize})"
},
"analyzing": "Analysiere Backup-Datei...",
"changeFile": "Datei ändern",
+1 -1
View File
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Αποθέστε το αντίγραφο ασφαλείας ZIP εδώ",
"description": "Δέχεται αρχεία .zip από αντίγραφο ασφαλείας Homarr SQLite (μέγιστο 256 MB)"
"description": "Δέχεται αρχεία .zip από αντίγραφο ασφαλείας Homarr SQLite (μέγιστο {maxSize})"
},
"analyzing": "Ανάλυση αντιγράφου ασφαλείας...",
"changeFile": "Αλλαγή αρχείου",
+3 -3
View File
@@ -2165,8 +2165,8 @@
"popover": {
"information": "Information",
"processor": "Processor: {cpuModelName}",
"memory": "Memory: {memory}GiB",
"memoryAvailable": "Available: {memoryAvailable}GiB ({percent}%)",
"memory": "Memory: {memory}",
"memoryAvailable": "Available: {memoryAvailable} ({percent}%)",
"version": "Version: {version}",
"uptime": "Uptime: {months} Months, {days} Days, {hours} Hours, {minutes} Minutes",
"loadAverage": "Load average:",
@@ -4978,7 +4978,7 @@
"restore": {
"dropzone": {
"title": "Drop your backup ZIP here",
"description": "Accepts .zip files from a Homarr SQLite backup (max 256 MB)"
"description": "Accepts .zip files from a Homarr SQLite backup (max {maxSize})"
},
"analyzing": "Analyzing backup...",
"changeFile": "Change file",
+42 -10
View File
@@ -283,6 +283,14 @@
"pingIconsEnabled": {
"label": "Use icons for pings"
},
"byteUnitSystem": {
"label": "Data size units",
"description": "Choose how Homarr displays byte sizes and byte rates. Bit rates always use decimal units.",
"options": {
"binary": "Binary",
"decimal": "Decimal"
}
},
"enableRightClickOnWidgets": {
"label": "Enable right-click on widgets",
"description": "Show Homarr's context menu when right-clicking a widget. Disable to use the browser's default menu (e.g. \"Open link in new tab\")."
@@ -738,6 +746,8 @@
"multiple": "Add {count}",
"selectedCount": "{count, plural, one {# selected} other {# selected}}",
"appsSelected": "{count, plural, one {# app selected} other {# apps selected}}",
"selectMultiple": "Select multiple",
"cancelMultiple": "Exit multi-select",
"customApplication": "Custom application",
"application": "Application"
},
@@ -1250,7 +1260,7 @@
"screenshots": "Screenshots",
"screenshotsDescription": "Up to five PNG, JPEG, or WebP images",
"screenshotsPlaceholder": "Choose screenshots",
"invalidScreenshot": "Use PNG, JPEG, or WebP images no larger than 5 MB each.",
"invalidScreenshot": "Use PNG, JPEG, or WebP images no larger than {maxSize} each.",
"privateSourceWarning": "This widget contains private source URLs for: {sources}. Replace personal hosts or IP addresses with safe service placeholders before publishing.",
"reviewSourcesTitle": "Review private source URLs",
"privateSourceConfirmation": "I reviewed these source URLs and they do not expose private infrastructure details",
@@ -1712,8 +1722,10 @@
"plural": "Medias",
"search": "Find a media",
"field": {
"preview": "Preview",
"size": "Size",
"creator": "Creator"
"creator": "Creator",
"actions": "Actions"
},
"action": {
"upload": {
@@ -1741,10 +1753,12 @@
}
},
"copy": {
"label": "Copy URL"
"label": "Copy URL",
"labelNamed": "Copy URL for {name}"
},
"open": {
"label": "Open media"
"label": "Open media",
"labelNamed": "Open {name}"
}
},
"noResults": {
@@ -3250,8 +3264,8 @@
"popover": {
"information": "Information",
"processor": "Processor: {cpuModelName}",
"memory": "Memory: {memory}GiB",
"memoryAvailable": "Available: {memoryAvailable}GiB ({percent}%)",
"memory": "Memory: {memory}",
"memoryAvailable": "Available: {memoryAvailable} ({percent}%)",
"version": "Version: {version}",
"uptime": "Uptime: {months} Months, {days} Days, {hours} Hours, {minutes} Minutes",
"loadAverage": "Load average:",
@@ -4077,7 +4091,7 @@
"label": "Show Miscellaneous entries marked as completed"
},
"activeTorrentThreshold": {
"label": "Hide completed torrent under this threshold (in kiB/s)"
"label": "Hide completed torrent under this threshold"
},
"categoryFilter": {
"label": "Categories/labels to filter"
@@ -4894,7 +4908,7 @@
"label": "Percentage (e.g., 76%)"
},
"absolute": {
"label": "Absolute values (e.g., 800GB / 1TB)"
"label": "Absolute values"
},
"free": {
"label": "Free space percentage (e.g., 24% free)"
@@ -6256,6 +6270,11 @@
"label": "Pings"
}
},
"action": {
"run": "Run {name} now",
"enable": "Enable {name}",
"disable": "Disable {name}"
},
"interval": {
"seconds": "Every {interval, plural, =1 {second} other {# seconds}}",
"minutes": "Every {interval, plural, =1 {minute} other {# minutes}}",
@@ -6397,7 +6416,13 @@
},
"availableTools": {
"title": "Available Tools",
"description": "{count} tools available. Expand a category to see individual tools and their descriptions."
"description": "{count} tools available. Expand a category to see individual tools and their descriptions.",
"filteredDescription": "{count} matching tools across expanded categories.",
"search": "Search tools",
"noResults": {
"title": "No tools match this search",
"description": "No MCP tool matches \"{search}\". Try a namespace, tool name, or description."
}
}
}
}
@@ -6424,7 +6449,7 @@
"restore": {
"dropzone": {
"title": "Drop your backup ZIP here",
"description": "Accepts .zip files from a Homarr SQLite backup (max 256 MB)"
"description": "Accepts .zip files from a Homarr SQLite backup (max {maxSize})"
},
"analyzing": "Analyzing backup...",
"changeFile": "Change file",
@@ -7191,6 +7216,13 @@
}
}
},
"byteUnitSystem": {
"children": {
"detail": {
"title": "Select your data size units"
}
}
},
"homeBoardId": {
"label": "Home board",
"children": {
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Información",
"processor": "Procesador: {cpuModelName}",
"memory": "Memoria: {memory} GiB",
"memoryAvailable": "Disponible: {memoryAvailable} GiB ({percent} %)",
"memory": "Memoria: {memory}",
"memoryAvailable": "Disponible: {memoryAvailable} ({percent} %)",
"version": "Versión: {version}",
"uptime": "Tiempo de actividad: {months} Meses, {days} Días, {hours} Horas, {minutes} Minutos",
"loadAverage": "Carga promedio:",
@@ -2886,7 +2886,7 @@
"label": "Mostrar entradas variadas marcadas como completadas"
},
"activeTorrentThreshold": {
"label": "Ocultar Torrent completado bajo este umbral (en kiB/s)"
"label": "Ocultar Torrent completado bajo este umbral"
},
"categoryFilter": {
"label": "Categorías/etiquetas para filtrar"
@@ -3676,7 +3676,7 @@
"label": "Porcentaje (e.g., 76 %)"
},
"absolute": {
"label": "Valores absolutos (e.g., 800 GB / 1 TB)"
"label": "Valores absolutos"
},
"free": {
"label": "Porcentaje de espacio libre (e.g., 24 % libre)"
+3 -3
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Teave",
"processor": "Protsessor: {cpuModelName}",
"memory": "Mälu: {memory} GiB",
"memoryAvailable": "Saadaval: {memoryAvailable} GiB ({percent}%)",
"memory": "Mälu: {memory}",
"memoryAvailable": "Saadaval: {memoryAvailable} ({percent}%)",
"version": "Versioon: {version}",
"uptime": "",
"loadAverage": "Keskmine koormus:",
@@ -2699,7 +2699,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Peida lõpetatud torrent alla selle läve (kiB/s)"
"label": "Peida lõpetatud torrent alla selle läve"
},
"categoryFilter": {
"label": "Filtreeritavad kategooriad/sildid"
+1 -1
View File
@@ -2699,7 +2699,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Piilota tämän kynnysarvon alle jäävät valmistuneet torrentit (kiB/s)"
"label": "Piilota tämän kynnysarvon alle jäävät valmistuneet torrentit"
},
"categoryFilter": {
"label": "Kategorioiden/tunnisteiden suodatus"
+4 -4
View File
@@ -2201,8 +2201,8 @@
"popover": {
"information": "Information",
"processor": "Processeur : {cpuModelName}",
"memory": "Mémoire : {memory}GiB",
"memoryAvailable": "Disponible : {memoryAvailable}GiB ({percent}%)",
"memory": "Mémoire : {memory}",
"memoryAvailable": "Disponible : {memoryAvailable} ({percent}%)",
"version": "Version : {version}",
"uptime": "Disponibilité : {months} Mois, {days} Jours, {hours} Heures, {minutes} Minutes",
"loadAverage": "Charge moyenne :",
@@ -2766,7 +2766,7 @@
"label": "Afficher les entrées diverses marquées comme terminées"
},
"activeTorrentThreshold": {
"label": "Masquer les Torrents terminés sous ce seuil (en kiB/s)"
"label": "Masquer les Torrents terminés sous ce seuil"
},
"categoryFilter": {
"label": "Catégories/étiquettes à filtrer"
@@ -3493,7 +3493,7 @@
"label": "Pourcentage (ex : 76%)"
},
"absolute": {
"label": "Valeurs absolues (ex. : 800 Go / 1 To)"
"label": "Valeurs absolues"
},
"free": {
"label": "Pourcentage d'espace libre (ex. : 24 % libre)"
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "מידע",
"processor": "מעבד: {cpuModelName}",
"memory": "זיכרון: {memory}GiB",
"memoryAvailable": "זמין: {memoryAvailable}GiB ({percent}%)",
"memory": "זיכרון: {memory}",
"memoryAvailable": "זמין: {memoryAvailable} ({percent}%)",
"version": "גרסה: {version}",
"uptime": "זמן פעילות: {months} חודשים, {days} ימים, {hours} שעות, {minutes} דקות",
"loadAverage": "ממוצע עומס:",
@@ -2886,7 +2886,7 @@
"label": "הצג ערכים שונים שסומנו כהשלמה"
},
"activeTorrentThreshold": {
"label": "הסתר טורנט שהושלם מתחת לסף הזה (בקיB/s)"
"label": "הסתר טורנט שהושלם מתחת לסף הזה"
},
"categoryFilter": {
"label": "קטגוריות/תוויות לסינון"
@@ -3676,7 +3676,7 @@
"label": "אחוז (לדוגמה, 76%)"
},
"absolute": {
"label": "ערכים מוחלטים (לדוגמה, 800GB / 1TB)"
"label": "ערכים מוחלטים"
},
"free": {
"label": "אחוז שטח פנוי (לדוגמה, 24% פנוי)"
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informacije",
"processor": "Procesor: {cpuModelName}",
"memory": "Memorija: {memory}GiB",
"memoryAvailable": "Dostupno: {memoryAvailable}GiB ({percent}%)",
"memory": "Memorija: {memory}",
"memoryAvailable": "Dostupno: {memoryAvailable} ({percent}%)",
"version": "Verzija: {version}",
"uptime": "",
"loadAverage": "Prosječno opterećenje:",
@@ -2699,7 +2699,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Sakrij dovršene torrente ispod ovog praga (u kiB/s)"
"label": "Sakrij dovršene torrente ispod ovog praga"
},
"categoryFilter": {
"label": "Kategorije/oznake za filtriranje"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Ovdje ispustite svoju ZIP sigurnosnu kopiju",
"description": "Prihvaća .zip datoteke iz Homarr SQLite sigurnosne kopije (maks. 256 MB)"
"description": "Prihvaća .zip datoteke iz Homarr SQLite sigurnosne kopije (maks. {maxSize})"
},
"analyzing": "Analiziranje sigurnosne kopije...",
"changeFile": "Promijeni datoteku",
+5 -5
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Információ",
"processor": "Processzor: {cpuModelName}",
"memory": "Memória: {memory} GiB",
"memoryAvailable": "Rendelkezésre álló: {memoryAvailable}GiB ({percent}%)",
"memory": "Memória: {memory}",
"memoryAvailable": "Rendelkezésre álló: {memoryAvailable} ({percent}%)",
"version": "Verzió: {version}",
"uptime": "Üzemidő: {months} hónap, {days} nap, {hours} óra, {minutes} perc",
"loadAverage": "Átlagos terhelés:",
@@ -2699,7 +2699,7 @@
"label": "Mutassa a befejezettként megjelölt Vegyes bejegyzéseket"
},
"activeTorrentThreshold": {
"label": "A küszöbérték alatt lévő befejezett torrenteket elrejtés (kiB/s-ban)"
"label": "A küszöbérték alatt lévő befejezett torrenteket elrejtés"
},
"categoryFilter": {
"label": "Szűrhető kategóriák/címkék"
@@ -3426,7 +3426,7 @@
"label": "Százalék (pl: 76%)"
},
"absolute": {
"label": "Abszolút értékek (pl. 800 Gb / 1 Tb)"
"label": "Abszolút értékek"
},
"free": {
"label": "A szabad hely aránya (pl. 24% szabad)"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Húzd ide a biztonsági mentés ZIP fájlt",
"description": "Homarr SQLite biztonsági mentésből származó .zip fájlok fogadhatók el (max 256 MB)"
"description": "Homarr SQLite biztonsági mentésből származó .zip fájlok fogadhatók el (max {maxSize})"
},
"analyzing": "Biztonsági mentés elemzése...",
"changeFile": "Fájl módosítása",
+5 -5
View File
@@ -2194,8 +2194,8 @@
"popover": {
"information": "Informazioni",
"processor": "Processore: {cpuModelName}",
"memory": "Memory: {memory}GiB",
"memoryAvailable": "Disponibile: {memoryAvailable}GiB ({percent}%)",
"memory": "Memoria: {memory}",
"memoryAvailable": "Disponibile: {memoryAvailable} ({percent}%)",
"version": "Versione: {version}",
"uptime": "Uptime: {months} Mesi, {days} Giorni, {hours} Ore, {minutes} Minuti",
"loadAverage": "Carico medio:",
@@ -2940,7 +2940,7 @@
"label": "Mostra voci varie contrassegnate come completate"
},
"activeTorrentThreshold": {
"label": "Nascondi il torrent completato sotto questa soglia (in kiB/s)"
"label": "Nascondi il torrent completato sotto questa soglia"
},
"categoryFilter": {
"label": "Categorie/etichette da filtrare"
@@ -3730,7 +3730,7 @@
"label": "Percentuale (es. 76%)"
},
"absolute": {
"label": "Valori assoluti (ad es. 800GB / 1TB)"
"label": "Valori assoluti"
},
"free": {
"label": "Percentuale di spazio libero (ad es. 24% libero)"
@@ -5023,7 +5023,7 @@
"restore": {
"dropzone": {
"title": "Rilascia qui il tuo ZIP di backup",
"description": "Accetta file .zip da un backup SQLite di Homarr (max 256 MB)"
"description": "Accetta file .zip da un backup SQLite di Homarr (max {maxSize})"
},
"analyzing": "Analisi del backup in corso...",
"changeFile": "Cambia file",
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "情報",
"processor": "プロセッサー: {cpuModelName}",
"memory": "メモリ: {memory} GiB",
"memoryAvailable": "利用可能: {memoryAvailable} GiB ({percent}%)",
"memory": "メモリ: {memory}",
"memoryAvailable": "利用可能: {memoryAvailable} ({percent}%)",
"version": "Version: {version}",
"uptime": "稼働時間: {months} ヶ月 {days} 日 {hours} 時間 {minutes} 分",
"loadAverage": "平均負荷:",
@@ -2886,7 +2886,7 @@
"label": "完了とマークされたその他の項目を表示"
},
"activeTorrentThreshold": {
"label": "このしきい値より低速で完了したトレントを非表示にします (KiB/s)"
"label": "このしきい値より低速で完了したトレントを非表示にします"
},
"categoryFilter": {
"label": "フィルターするカテゴリ/ラベル"
@@ -3676,7 +3676,7 @@
"label": "割合 (例 76%)"
},
"absolute": {
"label": "絶対値(例:800GB / 1TB)"
"label": "絶対値"
},
"free": {
"label": "空き領域の割合(例:24%空き)"
+5 -5
View File
@@ -2194,8 +2194,8 @@
"popover": {
"information": "정보",
"processor": "프로세서: {cpuModelName}",
"memory": "메모리: {memory}GiB",
"memoryAvailable": "사용 가능: {memoryAvailable}GiB ({percent}%)",
"memory": "메모리: {memory}",
"memoryAvailable": "사용 가능: {memoryAvailable} ({percent}%)",
"version": "버전: {version}",
"uptime": "작동 시간: {months}개월 {days}일 {hours}시간 {minutes}분",
"loadAverage": "평균 부하량:",
@@ -2753,7 +2753,7 @@
"label": "완료된 기타 항목 표시"
},
"activeTorrentThreshold": {
"label": "이 임계값 이하의 완료된 토렌트 숨기기 (kiB/s)"
"label": "이 임계값 이하의 완료된 토렌트 숨기기"
},
"categoryFilter": {
"label": "필터링할 카테고리/라벨"
@@ -3480,7 +3480,7 @@
"label": "퍼센트 (예: 76%)"
},
"absolute": {
"label": "절대값 (예: 800GB / 1TB)"
"label": "절대값"
},
"free": {
"label": "여유 공간 퍼센트 (예: 24% 남음)"
@@ -5007,7 +5007,7 @@
"restore": {
"dropzone": {
"title": "여기에 백업 ZIP 놓기",
"description": "Homarr SQLite 백업에서는 .zip 파일을 허용합니다(최대 256MB)"
"description": "Homarr SQLite 백업에서는 .zip 파일을 허용합니다(최대 {maxSize})"
},
"analyzing": "백업 분석 중...",
"changeFile": "파일 변경",
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informacija",
"processor": "Procesorius: {cpuModelName}",
"memory": "Atmintis: {memory}GiB",
"memoryAvailable": "Prieinama: {memoryAvailable}GiB ({percent}%)",
"memory": "Atmintis: {memory}",
"memoryAvailable": "Prieinama: {memoryAvailable} ({percent}%)",
"version": "Versija: {version}",
"uptime": "",
"loadAverage": "Vidutinė apkrova:",
@@ -2699,7 +2699,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Slėpti baigtus torrent žemiau šios ribos (kiB/s)"
"label": "Slėpti baigtus torrent žemiau šios ribos"
},
"categoryFilter": {
"label": "Kategorijos/žymos filtruoti"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Numeskite atsarginės kopijos ZIP failą čia",
"description": "Priima .zip failus iš Homarr SQLite atsarginės kopijos (maks. 256 MB)"
"description": "Priima .zip failus iš Homarr SQLite atsarginės kopijos (maks. {maxSize})"
},
"analyzing": "Analizuojama atsarginė kopija...",
"changeFile": "Pakeisti failą",
+3 -3
View File
@@ -2150,8 +2150,8 @@
"popover": {
"information": "Informācija",
"processor": "Procesors: {cpuModelName}",
"memory": "Atmiņa: {memory} GiB",
"memoryAvailable": "Pieejams: {memoryAvailable} GiB ({percent}%)",
"memory": "Atmiņa: {memory}",
"memoryAvailable": "Pieejams: {memoryAvailable} ({percent}%)",
"version": "Versija: {version}",
"uptime": "",
"loadAverage": "Vidējā slodze:",
@@ -4963,7 +4963,7 @@
"restore": {
"dropzone": {
"title": "Iemetiet savu dublējuma ZIP šeit",
"description": "Pieņem .zip failus no Homarr SQLite dublējuma (maks. 256 MB)"
"description": "Pieņem .zip failus no Homarr SQLite dublējuma (maks. {maxSize})"
},
"analyzing": "Notiek dublējuma analīze...",
"changeFile": "Mainīt failu",
+5 -5
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informatie",
"processor": "Processor: {cpuModelName}",
"memory": "Geheugen: {memory}GiB",
"memoryAvailable": "Beschikbaar: {memoryAvailable}GiB ({percent}%)",
"memory": "Geheugen: {memory}",
"memoryAvailable": "Beschikbaar: {memoryAvailable} ({percent}%)",
"version": "Versie: {version}",
"uptime": "Uptime: {months} maanden, {days} dagen, {hours} uren, {minutes} minuten",
"loadAverage": "Gemiddelde belasting:",
@@ -2886,7 +2886,7 @@
"label": "Diverse items gemarkeerd als voltooid weergeven"
},
"activeTorrentThreshold": {
"label": "Voltooide torrent verbergen onder deze drempel (in kiB/s)"
"label": "Voltooide torrent verbergen onder deze drempel"
},
"categoryFilter": {
"label": "Categorieën/labels om te filteren"
@@ -3676,7 +3676,7 @@
"label": "Percentage (bijv. 76%)"
},
"absolute": {
"label": "Absolute waarden (bijv. 800GB / 1TB)"
"label": "Absolute waarden"
},
"free": {
"label": "Vrije ruimte percentage (bijv. 24% vrij)"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Sleep je back-up ZIP hierheen",
"description": "Accepteert .zip-bestanden van een Homarr SQLite-back-up (max 256 MB)"
"description": "Accepteert .zip-bestanden van een Homarr SQLite-back-up (max {maxSize})"
},
"analyzing": "Back-up analyseren...",
"changeFile": "Bestand wijzigen",
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informasjon",
"processor": "Prosessor: {cpuModelName}",
"memory": "Minne: {memory}GiB",
"memoryAvailable": "Tilgjengelig: {memoryAvailable}GiB ({percent}%)",
"memory": "Minne: {memory}",
"memoryAvailable": "Tilgjengelig: {memoryAvailable} ({percent}%)",
"version": "Versjon: {version}",
"uptime": "Oppetid: {months} Måneder, {days} Dager, {hours} Timer, {minutes} Minutter",
"loadAverage": "Gjennomsnittsbelastning:",
@@ -2886,7 +2886,7 @@
"label": "Vis diverse oppføringer merket som fullført"
},
"activeTorrentThreshold": {
"label": "Skjul fullført torrent under denne terskelen (i kiB/s)"
"label": "Skjul fullført torrent under denne terskelen"
},
"categoryFilter": {
"label": "Kategorier/merker for filtrering"
@@ -3676,7 +3676,7 @@
"label": "Prosentandel (f.eks. 76%)"
},
"absolute": {
"label": "Absolutte verdier (f.eks. 800GB / 1TB)"
"label": "Absolutte verdier"
},
"free": {
"label": "Prosentandel ledig plass (f.eks. 24% ledig)"
+5 -5
View File
@@ -2194,8 +2194,8 @@
"popover": {
"information": "Informacja",
"processor": "Procesor: {cpuModelName}",
"memory": "Pamięć: {memory}GiB",
"memoryAvailable": "Dostępna pamięć {memoryAvailable} GB ({percent}%)",
"memory": "Pamięć: {memory}",
"memoryAvailable": "Dostępna pamięć {memoryAvailable} ({percent}%)",
"version": "Wersja: {version}",
"uptime": "Czas pracy: {months} mies., {days} dni, {hours} godzin, {minutes} minut",
"loadAverage": "Średnie obciążenie",
@@ -2940,7 +2940,7 @@
"label": "Pokaż różne wpisy oznaczone jako ukończone"
},
"activeTorrentThreshold": {
"label": "Ukryj ukończony torrent poniżej tego progu (w kiB/s)"
"label": "Ukryj ukończony torrent poniżej tego progu"
},
"categoryFilter": {
"label": "Kategorie/etykiety do filtrowania"
@@ -3730,7 +3730,7 @@
"label": "Procentowo (np. 76%)"
},
"absolute": {
"label": "Wartości bezwzględne (np. 800 GB / 1 TB)"
"label": "Wartości bezwzględne"
},
"free": {
"label": "Procent wolnego miejsca (np. 24% wolne)"
@@ -5023,7 +5023,7 @@
"restore": {
"dropzone": {
"title": "Upuść tutaj kopię zapasową ZIP",
"description": "Akceptuje pliki .zip z kopii zapasowej Homarr SQLite (maksymalnie 256 MB)"
"description": "Akceptuje pliki .zip z kopii zapasowej Homarr SQLite (maksymalnie {maxSize})"
},
"analyzing": "Analizowanie kopii zapasowej...",
"changeFile": "Zmień plik",
+5 -5
View File
@@ -2192,8 +2192,8 @@
"popover": {
"information": "Informação",
"processor": "Processador: {cpuModelName}",
"memory": "Memória: {memory}GiB",
"memoryAvailable": "Disponível: {memoryAvailable}GiB ({percent}%)",
"memory": "Memória: {memory}",
"memoryAvailable": "Disponível: {memoryAvailable} ({percent}%)",
"version": "Versão {version}",
"uptime": "Tempo de atividade: {months} mês(es), {days} dias, {hours} horas, {minutes} minutos",
"loadAverage": "Média de carga:",
@@ -2751,7 +2751,7 @@
"label": "Exibir entradas diversas marcadas como concluídas"
},
"activeTorrentThreshold": {
"label": "Ocultar torrents concluídos abaixo deste limite (em kiB/s)"
"label": "Ocultar torrents concluídos abaixo deste limite"
},
"categoryFilter": {
"label": "Categorias/rótulos para filtrar"
@@ -3478,7 +3478,7 @@
"label": "Porcentagem (ex: 76%)"
},
"absolute": {
"label": "Valores absolutos (ex: 800GB / 1TB)"
"label": "Valores absolutos"
},
"free": {
"label": "Porcentagem de espaço livre (ex: 24% livre)"
@@ -5005,7 +5005,7 @@
"restore": {
"dropzone": {
"title": "Solte seu arquivo ZIP de backup aqui",
"description": "Aceita arquivos .zip de um backup SQLite do Homarr (máx. 256 MB)"
"description": "Aceita arquivos .zip de um backup SQLite do Homarr (máx. {maxSize})"
},
"analyzing": "Analisando backup...",
"changeFile": "Alterar arquivo",
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informação",
"processor": "Processador: {cpuModelName}",
"memory": "Memória: {memory} GiB",
"memoryAvailable": "Disponível: {memoryAvailable} GiB ({percent}%)",
"memory": "Memória: {memory}",
"memoryAvailable": "Disponível: {memoryAvailable} ({percent}%)",
"version": "Versão: {version}",
"uptime": "",
"loadAverage": "Carga média:",
@@ -2699,7 +2699,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Ocultar torrents concluídos abaixo deste limite (em kiB/s)"
"label": "Ocultar torrents concluídos abaixo deste limite"
},
"categoryFilter": {
"label": "Categorias/rótulos para filtrar"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Solte seu backup ZIP aqui",
"description": "Aceita arquivos .zip de um backup SQLite do Homarr (máx. 256 MB)"
"description": "Aceita arquivos .zip de um backup SQLite do Homarr (máx. {maxSize})"
},
"analyzing": "Analisando backup...",
"changeFile": "Alterar arquivo",
+1 -1
View File
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Trage aici fișierul ZIP al copiei de rezervă",
"description": "Acceptă fișiere .zip de la o copie de rezervă SQLite Homarr (max 256 MB)"
"description": "Acceptă fișiere .zip de la o copie de rezervă SQLite Homarr (max {maxSize})"
},
"analyzing": "Se analizează copia de rezervă...",
"changeFile": "Schimbă fișierul",
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Информация",
"processor": "Процессор: {cpuModelName}",
"memory": "Память: {memory}GiB",
"memoryAvailable": "Доступно: {memoryAvailable}GiB ({percent}%)",
"memory": "Память: {memory}",
"memoryAvailable": "Доступно: {memoryAvailable} ({percent}%)",
"version": "Версия: {version}",
"uptime": "Время работы: {months} мес., {days} дн., {hours} ч., {minutes} мин.",
"loadAverage": "Средняя нагрузка:",
@@ -2886,7 +2886,7 @@
"label": "Показывать завершённые записи категории «Разное»"
},
"activeTorrentThreshold": {
"label": "Скрывать завершённые торренты ниже этого порога (в КиБ/с)"
"label": "Скрывать завершённые торренты ниже этого порога"
},
"categoryFilter": {
"label": "Фильтр по категориям/меткам"
@@ -3676,7 +3676,7 @@
"label": "В процентах (например, 76%)"
},
"absolute": {
"label": "Абсолютные значения (например, 800 ГБ / 1 ТБ)"
"label": "Абсолютные значения"
},
"free": {
"label": "Процент свободного места (например, 24% свободно)"
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informácie",
"processor": "Procesor: {cpuModelName}",
"memory": "Pamäť: {memory}GiB",
"memoryAvailable": "K dispozícii: {memoryAvailable}GiB ({percent}%)",
"memory": "Pamäť: {memory}",
"memoryAvailable": "K dispozícii: {memoryAvailable} ({percent}%)",
"version": "Verzia: {version}",
"uptime": "Doba prevádzky: {days} dní, {hours} hodín, {minutes} minút",
"loadAverage": "Priemerné zaťaženie:",
@@ -2699,7 +2699,7 @@
"label": "Zobraziť rôzne položky označené ako dokončené"
},
"activeTorrentThreshold": {
"label": "Skryť dokončený torrent pod touto hranicou (v kiB/s)"
"label": "Skryť dokončený torrent pod touto hranicou"
},
"categoryFilter": {
"label": "Kategórie/značky na filtrovanie"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Sem presuňte svoju zálohu ZIP",
"description": "Prijímajú sa súbory .zip zo zálohy SQLite Homarr (max. 256 MB)"
"description": "Prijímajú sa súbory .zip zo zálohy SQLite Homarr (max. {maxSize})"
},
"analyzing": "Analyzuje sa záloha...",
"changeFile": "Zmeniť súbor",
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Informacije",
"processor": "Procesor: {cpuModelName}",
"memory": "Pomnilnik: {memory}GiB",
"memoryAvailable": "Na voljo: {memoryAvailable}GiB ({percent}%)",
"memory": "Pomnilnik: {memory}",
"memoryAvailable": "Na voljo: {memoryAvailable} ({percent}%)",
"version": "Različica: {version}",
"uptime": "",
"loadAverage": "Povprečna obremenitev:",
@@ -2886,7 +2886,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Skrij dokončane torrente pod tem pragom (v kiB/s)"
"label": "Skrij dokončane torrente pod tem pragom"
},
"categoryFilter": {
"label": "Kategorije/oznake za filtriranje"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Spustite svojo varnostno kopijo ZIP tukaj",
"description": "Sprejema datoteke .zip iz varnostne kopije SQLite Homarr (največ 256 MB)"
"description": "Sprejema datoteke .zip iz varnostne kopije SQLite Homarr (največ {maxSize})"
},
"analyzing": "Analiziranje varnostne kopije ...",
"changeFile": "Spremeni datoteko",
+1 -1
View File
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Släpp din säkerhetskopia ZIP här",
"description": "Accepterar .zip-filer från en Homarr SQLite-säkerhetskopia (max 256 MB)"
"description": "Accepterar .zip-filer från en Homarr SQLite-säkerhetskopia (max {maxSize})"
},
"analyzing": "Analyserar säkerhetskopia...",
"changeFile": "Byt fil",
+5 -5
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Bilgi",
"processor": "İşlemci: {cpuModelName}",
"memory": "Bellek: {memory}GiB",
"memoryAvailable": "Kullanılabilir: {memoryAvailable} GiB ({percent}%)",
"memory": "Bellek: {memory}",
"memoryAvailable": "Kullanılabilir: {memoryAvailable} ({percent}%)",
"version": "Sürüm: {version}",
"uptime": "Çalışma süresi: {months} Ay, {days} Gün, {hours} Saat, {minutes} Dakika",
"loadAverage": "Ortalama yük:",
@@ -2699,7 +2699,7 @@
"label": "Tamamlanmış olarak işaretlenmiş çeşitli girişleri göster"
},
"activeTorrentThreshold": {
"label": "Tamamlanan torrent'i bu eşik değerinin altına gizle (kiB/s cinsinden)"
"label": "Tamamlanan torrent'i bu eşik değerinin altına gizle"
},
"categoryFilter": {
"label": "Filtrelenecek kategoriler/etiketler"
@@ -3426,7 +3426,7 @@
"label": "Yüzde (ör. %76)"
},
"absolute": {
"label": "Mutlak değerler (ör. 800 GB / 1 TB)"
"label": "Mutlak değerler"
},
"free": {
"label": "Boş alan yüzdesi (ör. %24 boş)"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Yedekleme ZIP dosyanızı buraya bırakın",
"description": "Homarr SQLite yedeklemesinden .zip dosyalarını kabul eder (maks 256 MB)"
"description": "Homarr SQLite yedeklemesinden .zip dosyalarını kabul eder (maks {maxSize})"
},
"analyzing": "Yedekleme analiz ediliyor...",
"changeFile": "Dosyayı değiştir",
+4 -4
View File
@@ -2150,8 +2150,8 @@
"popover": {
"information": "Інформація",
"processor": "Процесор: {cpuModelName}",
"memory": "Пам'ять: {memory} ГБ",
"memoryAvailable": "Доступно: {memoryAvailable} ГБ ({percent}%)",
"memory": "Пам'ять: {memory}",
"memoryAvailable": "Доступно: {memoryAvailable} ({percent}%)",
"version": "Версія: {version}",
"uptime": "Час безперебійної роботи: {months} ​​Місяців, {days} Днів, {hours} Годин, {minutes} Хвилин",
"loadAverage": "Середнє навантаження:",
@@ -2709,7 +2709,7 @@
"label": "Відображати різні записи, як завершені"
},
"activeTorrentThreshold": {
"label": "Приховувати завершені торенти нижче за цей поріг (у КіБ/с)"
"label": "Приховувати завершені торенти нижче за цей поріг"
},
"categoryFilter": {
"label": "Категорії/мітки для фільтру"
@@ -3436,7 +3436,7 @@
"label": "Відсоток (напр., 76%)"
},
"absolute": {
"label": "Абсолютні значення (напр., 800GB / 1TB)"
"label": "Абсолютні значення"
},
"free": {
"label": "Відсоток вільного простору (напр., 24% вільно)"
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "Thông tin",
"processor": "Bộ xử lý: {cpuModelName}",
"memory": "Bộ nhớ: {memory}GiB",
"memoryAvailable": "Khả dụng: {memoryAvailable}GiB ({percent}%)",
"memory": "Bộ nhớ: {memory}",
"memoryAvailable": "Khả dụng: {memoryAvailable} ({percent}%)",
"version": "Phiên bản: {version}",
"uptime": "",
"loadAverage": "Tải trung bình:",
@@ -2886,7 +2886,7 @@
"label": ""
},
"activeTorrentThreshold": {
"label": "Ẩn torrent đã hoàn thành dưới ngưỡng này (kiB/s)"
"label": "Ẩn torrent đã hoàn thành dưới ngưỡng này"
},
"categoryFilter": {
"label": "Danh mục/nhãn để lọc"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "Kéo tệp ZIP sao lưu vào đây",
"description": "Chấp nhận tệp .zip từ bản sao lưu SQLite của Homarr (tối đa 256 MB)"
"description": "Chấp nhận tệp .zip từ bản sao lưu SQLite của Homarr (tối đa {maxSize})"
},
"analyzing": "Đang phân tích bản sao lưu...",
"changeFile": "Thay đổi tập tin",
+4 -4
View File
@@ -2140,8 +2140,8 @@
"popover": {
"information": "訊息",
"processor": "處理器:{cpuModelName}",
"memory": "記憶體:{memory} GiB",
"memoryAvailable": "可用:{memoryAvailable} Gib ({percent}%)",
"memory": "記憶體:{memory}",
"memoryAvailable": "可用:{memoryAvailable} ({percent}%)",
"version": "版本:{version}",
"uptime": "運行時間:{months} 月,{days} 天,{hours} 時,{minutes} 分",
"loadAverage": "平均負載:",
@@ -2699,7 +2699,7 @@
"label": "顯示標記為已完成的雜項條目"
},
"activeTorrentThreshold": {
"label": "隱藏在此閥值下完成的 Torrent (kiB/s)"
"label": "隱藏在此閥值下完成的 Torrent"
},
"categoryFilter": {
"label": "要過濾的分類/標籤"
@@ -4953,7 +4953,7 @@
"restore": {
"dropzone": {
"title": "將備份 ZIP 拖曳至此處",
"description": "接受來自 Homarr SQLite 備份的 .zip 檔案(最大 256 MB)"
"description": "接受來自 Homarr SQLite 備份的 .zip 檔案(最大 {maxSize})"
},
"analyzing": "正在分析備份……",
"changeFile": "更換檔案",
+19 -1
View File
@@ -3,10 +3,12 @@
import type { ChangeEvent } from "react";
import { useCallback, useEffect, useState } from "react";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { Loader, TextInput } from "@mantine/core";
import { Input, Loader, TextInput } from "@mantine/core";
import { useDebouncedCallback } from "@mantine/hooks";
import { IconSearch } from "@tabler/icons-react";
import { useI18n } from "@homarr/translation/client";
interface SearchInputProps {
defaultValue?: string;
placeholder: string;
@@ -18,6 +20,7 @@ export const SearchInput = ({ placeholder, ariaLabel, defaultValue, flexExpand =
const router = useRouter();
const pathName = usePathname();
const searchParams = useSearchParams();
const t = useI18n("common.action");
const [loading, setLoading] = useState(false);
const [value, setValue] = useState(defaultValue ?? "");
useEffect(() => {
@@ -47,11 +50,26 @@ export const SearchInput = ({ placeholder, ariaLabel, defaultValue, flexExpand =
[setLoading, handleSearchDebounced],
);
const clearSearch = useCallback(() => {
setValue("");
setLoading(true);
handleSearchDebounced("");
handleSearchDebounced.flush();
}, [handleSearchDebounced]);
return (
<TextInput
leftSection={<LeftSection loading={loading} />}
rightSection={value ? <Input.ClearButton aria-label={t("clearSearch")} onClick={clearSearch} /> : undefined}
rightSectionPointerEvents="all"
value={value}
onChange={handleSearch}
onKeyDown={(event) => {
if (event.key !== "Escape" || !value) return;
event.preventDefault();
clearSearch();
}}
placeholder={placeholder}
aria-label={ariaLabel}
style={{ flex: flexExpand ? "1" : undefined }}
@@ -18,7 +18,7 @@ export const TablePagination = ({ total }: TablePaginationProps) => {
const pathName = usePathname();
const searchParams = useSearchParams();
const t = useI18n("common.pagination");
const current = Number(searchParams.get("page")) || 1;
const current = parsePage(searchParams.getAll("page"));
const getItemProps = useCallback(
(page: number) => {
@@ -62,6 +62,18 @@ export const TablePagination = ({ total }: TablePaginationProps) => {
);
};
const parsePage = (pageValues: string[]) => {
if (pageValues.length !== 1) return 1;
const [pageValue] = pageValues;
if (!pageValue || !/^[1-9]\d*$/u.test(pageValue)) return 1;
const page = Number(pageValue);
if (!Number.isSafeInteger(page)) return 1;
return page;
};
type ControlType = Parameters<Exclude<PaginationProps["getControlProps"], undefined>>[0];
const calculatePageFor = (type: ControlType, current: number, total: number) => {
switch (type) {
+1 -1
View File
@@ -35,7 +35,7 @@ export const checkCertificateFile: z.core.CheckFn<File> = (context) => {
code: "custom",
params: createCustomErrorParams({
key: "fileTooLarge",
params: { maxSize: "1 MB" },
params: { maxSize: "1 MiB" },
}),
input: context.value.size,
});
+2 -2
View File
@@ -2,7 +2,7 @@ import { z } from "zod/v4";
export const paginatedSchema = z.object({
search: z.string().optional(),
pageSize: z.number().int().positive().default(10),
pageSize: z.number().int().positive().max(100).default(10),
page: z.number().int().positive().default(1),
});
@@ -12,5 +12,5 @@ export const byIdSchema = z.object({
export const searchSchema = z.object({
query: z.string(),
limit: z.number().int().positive().default(10),
limit: z.number().int().positive().max(100).default(10),
});
+1 -1
View File
@@ -27,7 +27,7 @@ export const mediaUploadSchema = zfd.formData({
code: "custom",
params: createCustomErrorParams({
key: "fileTooLarge",
params: { maxSize: "32 MB" },
params: { maxSize: "32 MiB" },
}),
input: context.value.size,
});
Loaded 100 of 295 files, more files were not shown because too many files have changed in this diff. Show more