Compare commits
99
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8203ca0c63 | ||
|
|
5e5492818a | ||
|
|
a6ec5f789d | ||
|
|
dade477b32 | ||
|
|
79f88dc3b8 | ||
|
|
4a12f8be61 | ||
|
|
044ad9edf9 | ||
|
|
57d2c6a7e1 | ||
|
|
46f6301fdd | ||
|
|
c3f300d87d | ||
|
|
1de558dd51 | ||
|
|
2711f3db13 | ||
|
|
ff3933b335 | ||
|
|
fa737638a8 | ||
|
|
97b7c417ab | ||
|
|
58d8005d38 | ||
|
|
507ac5181f | ||
|
|
b0cdb81533 | ||
|
|
fc0367a32f | ||
|
|
7cd30b640c | ||
|
|
a9855fe8d3 | ||
|
|
7a1272146c | ||
|
|
db61b6f390 | ||
|
|
887c294191 | ||
|
|
2f2a6291a2 | ||
|
|
1b3353118d | ||
|
|
e03f56ac31 | ||
|
|
d571a7f75e | ||
|
|
e3b765b9bd | ||
|
|
4da313826d | ||
|
|
948ed7a7fa | ||
|
|
f7fc64ebc4 | ||
|
|
b7f51d6f5c | ||
|
|
e185eeb6d7 | ||
|
|
90d703b870 | ||
|
|
75640f21e0 | ||
|
|
4aa43ae27a | ||
|
|
6b67671e29 | ||
|
|
220f361b69 | ||
|
|
a1d6457ced | ||
|
|
f7ade3c676 | ||
|
|
f656d9ca2d | ||
|
|
cefd90385d | ||
|
|
e5021b1d78 | ||
|
|
f0bd5132a3 | ||
|
|
d356fa41a0 | ||
|
|
a9e9ac1cfa | ||
|
|
1b3e720701 | ||
|
|
2461363d4f | ||
|
|
f29e74b6f4 | ||
|
|
89dfe82fe9 | ||
|
|
48a0f75c31 | ||
|
|
37103cf414 | ||
|
|
dec34916b2 | ||
|
|
64a4c196c0 | ||
|
|
41d596a1c9 | ||
|
|
bac0bc7b84 | ||
|
|
1ac6774821 | ||
|
|
7adb21ca59 | ||
|
|
4daf2729e5 | ||
|
|
1942c32128 | ||
|
|
b061a59433 | ||
|
|
ab867a9e50 | ||
|
|
968338aa97 | ||
|
|
b34102a973 | ||
|
|
378d1e1f1f | ||
|
|
3a8abe4415 | ||
|
|
6feb37dfd4 | ||
|
|
8042a18dc1 | ||
|
|
c78bf05fc3 | ||
|
|
4635c51fe1 | ||
|
|
5cc0f97aa2 | ||
|
|
b581f9b11a | ||
|
|
756e8d1724 | ||
|
|
7c64de5cbc | ||
|
|
56af6bcaf0 | ||
|
|
84b269a80d | ||
|
|
4d30a2e8c4 | ||
|
|
2d15b3d407 | ||
|
|
44a2973b1a | ||
|
|
00a055283e | ||
|
|
a474dcd961 | ||
|
|
69fe180968 | ||
|
|
c83fdb2a6e | ||
|
|
81fdd90e7a | ||
|
|
5ee84f8cf4 | ||
|
|
80d18bb10d | ||
|
|
2bb0f61da7 | ||
|
|
24386656fd | ||
|
|
453360fe61 | ||
|
|
beac1ed780 | ||
|
|
aa1b3810f1 | ||
|
|
ce3c1b6cc1 | ||
|
|
3f6b830f9b | ||
|
|
f0cb79799a | ||
|
|
7561462594 | ||
|
|
bfa8566284 | ||
|
|
a1aa5505a3 | ||
|
|
e77b9bb3d2 |
No files matched your search
+5
-1
@@ -9,4 +9,8 @@ README.md
|
||||
.git
|
||||
dev
|
||||
.build
|
||||
e2e
|
||||
e2e
|
||||
apps/nextjs/.next
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
+14
-4
@@ -12,10 +12,6 @@ AUTH_SECRET="supersecret"
|
||||
# or starting the project without any (which will show a randomly generated one).
|
||||
SECRET_ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
# Cron job API key is generated every time the container starts as it is required for communication between nextjs-api and tasks-api
|
||||
# export CRON_JOB_API_KEY=$(openssl rand -base64 32)
|
||||
# CRON_JOB_API_KEY="your-generated-api-key"
|
||||
|
||||
LOG_LEVEL='info'
|
||||
|
||||
# This is how you can use the sqlite driver:
|
||||
@@ -45,6 +41,20 @@ DB_URL='FULL_PATH_TO_YOUR_SQLITE_DB_FILE'
|
||||
|
||||
TURBO_TELEMETRY_DISABLED=1
|
||||
|
||||
# Turborepo remote cache (optional, for faster CI/local builds)
|
||||
# Uncomment and fill in to enable remote caching locally.
|
||||
# CI uses GitHub secrets for these values automatically.
|
||||
# TURBO_API=https://your-cache-worker.workers.dev
|
||||
# TURBO_TEAM=team_your_team
|
||||
# TURBO_TOKEN=your-turbo-token
|
||||
# TURBO_REMOTE_CACHE_SIGNATURE_KEY=your-signature-key
|
||||
|
||||
# Comma-separated paths to Docker-compatible Unix sockets.
|
||||
# Useful for connecting to multiple runtimes (Docker + Podman) simultaneously.
|
||||
# When unset and no TCP hosts configured, defaults to /var/run/docker.sock.
|
||||
# Example: DOCKER_SOCKET_PATHS=/var/run/docker.sock,/run/user/1000/podman/podman.sock
|
||||
# DOCKER_SOCKET_PATHS=
|
||||
|
||||
# Enable kubernetes tool
|
||||
# ENABLE_KUBERNETES=true
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ body:
|
||||
options:
|
||||
# The below comment is used to insert a new version with on-release.yml
|
||||
#NEXT_VERSION#
|
||||
- 1.61.0
|
||||
- 1.60.1-beta.1
|
||||
- 1.60.0
|
||||
- 1.59.3
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
automerge: true,
|
||||
},
|
||||
{
|
||||
// disallow automerge for dependencies requiring postinstall scripts
|
||||
// disallow automerge for onlyBuiltDependencies
|
||||
matchPackageNames: [
|
||||
"@tree-sitter-grammars/tree-sitter-yaml",
|
||||
"bcrypt",
|
||||
@@ -39,7 +39,7 @@
|
||||
],
|
||||
// Updates lockfile for prebuilt-debian after if package.json is updated, otherwise only root lockfile is updated
|
||||
postUpgradeTasks: {
|
||||
commands: ["cd deployments/prebuilt-debian && pnpm install --lockfile-only"],
|
||||
commands: ["cd deployments/prebuilt-debian && pnpm install --ignore-workspace --lockfile-only"],
|
||||
fileFilters: ["deployments/prebuilt-debian/pnpm-lock.yaml"],
|
||||
executionMode: "update",
|
||||
},
|
||||
|
||||
@@ -15,6 +15,13 @@ concurrency:
|
||||
|
||||
env:
|
||||
FORCE_COLOR: 3
|
||||
SKIP_ENV_VALIDATION: true
|
||||
TURBO_API: ${{ secrets.TURBO_API }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_REMOTE_CACHE_SIGNATURE_KEY: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
|
||||
TURBO_SCM_BASE: ${{ github.event.pull_request.base.sha || github.event.before || 'HEAD~1' }}
|
||||
TURBO_SCM_HEAD: ${{ github.sha }}
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
@@ -22,6 +29,8 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup
|
||||
uses: ./tooling/github/setup
|
||||
@@ -31,31 +40,35 @@ jobs:
|
||||
run: cp .env.example .env
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint && pnpm lint:ws
|
||||
run: pnpm turbo lint --affected && pnpm lint:ws
|
||||
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup
|
||||
uses: ./tooling/github/setup
|
||||
|
||||
- name: Format
|
||||
run: pnpm format
|
||||
run: pnpm turbo format --affected --continue -- --cache --cache-location node_modules/.cache/.prettiercache
|
||||
|
||||
typecheck:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup
|
||||
uses: ./tooling/github/setup
|
||||
|
||||
- name: Typecheck
|
||||
run: pnpm typecheck
|
||||
run: pnpm turbo typecheck --affected
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -78,11 +91,12 @@ jobs:
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Setup
|
||||
uses: ./tooling/github/setup
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
- name: Build docker image
|
||||
id: build-docker-image
|
||||
uses: docker/build-push-action@v7
|
||||
@@ -90,8 +104,11 @@ jobs:
|
||||
platforms: linux/amd64
|
||||
context: .
|
||||
push: false
|
||||
load: true
|
||||
tags: homarr-e2e
|
||||
network: host
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
env:
|
||||
SKIP_ENV_VALIDATION: true
|
||||
- name: Install playwright browsers
|
||||
@@ -105,10 +122,12 @@ jobs:
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup
|
||||
uses: ./tooling/github/setup
|
||||
- name: Copy env
|
||||
shell: bash
|
||||
run: cp .env.example .env
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
run: pnpm turbo build --affected
|
||||
@@ -5,6 +5,7 @@ on:
|
||||
branches:
|
||||
- main
|
||||
- beta
|
||||
- next
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
@@ -34,7 +35,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
env:
|
||||
SKIP_RELEASE: ${{ github.event_name == 'workflow_dispatch' || github.ref_name == 'dev' }}
|
||||
SKIP_RELEASE: ${{ github.event_name == 'workflow_dispatch' || github.ref_name == 'dev' || github.ref_name == 'next' }}
|
||||
outputs:
|
||||
version: ${{ steps.read-semver.outputs.version || steps.version-fallback.outputs.version }}
|
||||
git_ref: ${{ steps.read-git-ref.outputs.ref || github.ref }}
|
||||
@@ -54,7 +55,7 @@ jobs:
|
||||
with:
|
||||
private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }}
|
||||
client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
|
||||
permission-contents: write # required to commit package.json & changelog changes, merge them to dev and publish the release
|
||||
permission-contents: write # required to commit package.json & changelog changes, merge them to dev / next and publish the release
|
||||
|
||||
- uses: actions/checkout@v6
|
||||
if: env.SKIP_RELEASE == 'false'
|
||||
@@ -66,7 +67,7 @@ jobs:
|
||||
if: env.SKIP_RELEASE == 'false'
|
||||
with:
|
||||
node-version: 24.15.0
|
||||
cache: "pnpm"
|
||||
package-manager-cache: false
|
||||
- run: npm i -g pnpm
|
||||
if: env.SKIP_RELEASE == 'false'
|
||||
- name: Install dependencies
|
||||
@@ -95,20 +96,21 @@ jobs:
|
||||
id: read-git-ref
|
||||
run: |
|
||||
echo "ref=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
|
||||
- name: Update dev branch
|
||||
- name: Update dev / next branch
|
||||
if: env.SKIP_RELEASE == 'false'
|
||||
continue-on-error: true # Prevent pipeline from failing when merge fails
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.obtainToken.outputs.token }}
|
||||
UPSTREAM_BRANCH: ${{ github.ref_name == 'main' && 'dev' || 'next' }}
|
||||
run: |
|
||||
git config user.name "Releases Homarr"
|
||||
git config user.email "175486441+homarr-releases[bot]@users.noreply.github.com"
|
||||
git remote set-url origin https://x-access-token:${{ steps.obtainToken.outputs.token }}@github.com/${{ github.repository }}.git
|
||||
git fetch origin dev
|
||||
git checkout dev
|
||||
git pull origin dev
|
||||
git fetch origin ${{ env.UPSTREAM_BRANCH }}
|
||||
git checkout ${{ env.UPSTREAM_BRANCH }}
|
||||
git pull origin ${{ env.UPSTREAM_BRANCH }}
|
||||
git rebase ${{ github.ref_name }}
|
||||
git push origin dev
|
||||
git push origin ${{ env.UPSTREAM_BRANCH }}
|
||||
build-amd64:
|
||||
name: Build docker image for amd64
|
||||
needs: release
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Expo doesn't play nice with pnpm by default.
|
||||
# The symbolic links of pnpm break the rules of Expo monorepos.
|
||||
# @link https://docs.expo.dev/guides/monorepos/#common-issues
|
||||
node-linker=hoisted
|
||||
strict-peer-dependencies=false
|
||||
engine-strict=true
|
||||
+3875
-3831
File diff suppressed because it is too large.
Load diff
@@ -3,7 +3,11 @@
|
||||
|
||||
# Exempt Renovate‑managed files (no owners)
|
||||
package.json
|
||||
**/package.json
|
||||
package-lock.json
|
||||
**/package-lock.json
|
||||
pnpm-lock.yaml
|
||||
**/pnpm-lock.yaml
|
||||
pnpm-workspace.yaml
|
||||
Dockerfile
|
||||
docker-compose.yml
|
||||
@@ -43,8 +43,6 @@ RUN mkdir -p /var/cache/nginx && \
|
||||
COPY --from=builder /app/apps/nextjs/next.config.ts .
|
||||
COPY --from=builder /app/apps/nextjs/package.json .
|
||||
|
||||
COPY --from=builder /app/apps/tasks/tasks.cjs ./apps/tasks/tasks.cjs
|
||||
COPY --from=builder /app/apps/websocket/wssServer.cjs ./apps/websocket/wssServer.cjs
|
||||
COPY --from=builder /app/node_modules/better-sqlite3/build/Release/better_sqlite3.node /app/build/better_sqlite3.node
|
||||
|
||||
COPY --from=builder /app/packages/db/migrations ./db/migrations
|
||||
|
||||
@@ -6,7 +6,6 @@ import "@homarr/core/infrastructure/logs/env";
|
||||
import "@homarr/docker/env";
|
||||
|
||||
import type { NextConfig } from "next";
|
||||
import MillionLint from "@million/lint";
|
||||
import createNextIntlPlugin from "next-intl/plugin";
|
||||
|
||||
// Package path does not work... so we need to use relative path
|
||||
@@ -32,6 +31,8 @@ const nextConfig: NextConfig = {
|
||||
experimental: {
|
||||
optimizePackageImports: ["@mantine/core", "@mantine/hooks", "@tabler/icons-react"],
|
||||
turbopackFileSystemCacheForDev: true,
|
||||
preloadEntriesOnStart: false,
|
||||
webpackMemoryOptimizations: true,
|
||||
},
|
||||
transpilePackages: ["@homarr/ui", "@homarr/notifications", "@homarr/modals", "@homarr/spotlight", "@homarr/widgets"],
|
||||
images: {
|
||||
@@ -83,8 +84,4 @@ const nextConfig: NextConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
// Skip transform is used because of webpack loader, without it for example 'Tooltip.Floating' will not work and show an error
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const withMillionLint = MillionLint.next({ rsc: true, skipTransform: true, telemetry: false });
|
||||
|
||||
export default withNextIntl(nextConfig);
|
||||
@@ -44,9 +44,11 @@
|
||||
"@homarr/server-settings": "workspace:^0.1.0",
|
||||
"@homarr/settings": "workspace:^0.1.0",
|
||||
"@homarr/spotlight": "workspace:^0.1.0",
|
||||
"@homarr/tasks": "workspace:^0.1.0",
|
||||
"@homarr/translation": "workspace:^0.1.0",
|
||||
"@homarr/ui": "workspace:^0.1.0",
|
||||
"@homarr/validation": "workspace:^0.1.0",
|
||||
"@homarr/websocket": "workspace:^0.1.0",
|
||||
"@homarr/widgets": "workspace:^0.1.0",
|
||||
"@mantine/colors-generator": "catalog:",
|
||||
"@mantine/core": "catalog:",
|
||||
@@ -54,7 +56,6 @@
|
||||
"@mantine/hooks": "catalog:",
|
||||
"@mantine/modals": "catalog:",
|
||||
"@mantine/tiptap": "catalog:",
|
||||
"@million/lint": "catalog:",
|
||||
"@tabler/icons-react": "catalog:",
|
||||
"@tanstack/react-query": "catalog:",
|
||||
"@tanstack/react-query-devtools": "catalog:",
|
||||
|
||||
@@ -58,6 +58,18 @@ const createColumns = (
|
||||
return <ContainerStateBadge state={cell.row.original.state} />;
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "host",
|
||||
header: t("docker.field.host.label"),
|
||||
size: 140,
|
||||
Cell({ row }) {
|
||||
return (
|
||||
<Text truncate="end" title={row.original.host}>
|
||||
{row.original.host}
|
||||
</Text>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
accessorKey: "image",
|
||||
header: t("docker.field.containerImage.label"),
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export async function register() {
|
||||
if (process.env.NEXT_RUNTIME === "nodejs") {
|
||||
await import("@homarr/tasks");
|
||||
await import("@homarr/websocket");
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,11 @@
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
".": "./src/main.ts"
|
||||
},
|
||||
"main": "./src/main.ts",
|
||||
"types": "./src/main.ts",
|
||||
"scripts": {
|
||||
"build": "esbuild src/main.ts --bundle --platform=node --loader:.scss=text --external:*.node --external:@opentelemetry/api --external:deasync --external:bcrypt --outfile=tasks.cjs",
|
||||
"clean": "rm -rf .turbo node_modules",
|
||||
"dev": "pnpm with-env tsx ./src/main.ts",
|
||||
"format": "prettier --check . --ignore-path ../../.gitignore",
|
||||
@@ -24,7 +23,6 @@
|
||||
"@homarr/auth": "workspace:^0.1.0",
|
||||
"@homarr/common": "workspace:^0.1.0",
|
||||
"@homarr/core": "workspace:^",
|
||||
"@homarr/cron-job-api": "workspace:^0.1.0",
|
||||
"@homarr/cron-jobs": "workspace:^0.1.0",
|
||||
"@homarr/cron-jobs-core": "workspace:^0.1.0",
|
||||
"@homarr/db": "workspace:^0.1.0",
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
||||
|
||||
import { handshakeAsync } from "@homarr/redis";
|
||||
|
||||
import { waitForRedisAsync } from "./main";
|
||||
|
||||
const { mockLogger } = vi.hoisted(() => ({
|
||||
mockLogger: {
|
||||
info: vi.fn(),
|
||||
warn: vi.fn(),
|
||||
error: vi.fn(),
|
||||
debug: vi.fn(),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("./overrides", () => ({}));
|
||||
|
||||
vi.mock("@homarr/core/infrastructure/logs", () => ({
|
||||
createLogger: () => mockLogger,
|
||||
}));
|
||||
|
||||
vi.mock("@homarr/redis", () => ({
|
||||
handshakeAsync: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@homarr/cron-jobs", () => ({
|
||||
jobGroup: {
|
||||
initializeAsync: vi.fn().mockResolvedValue(undefined),
|
||||
startAllAsync: vi.fn().mockResolvedValue(undefined),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("./on-start", () => ({
|
||||
onStartAsync: vi.fn().mockResolvedValue(undefined),
|
||||
}));
|
||||
|
||||
describe("waitForRedisAsync", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
test("succeeds on first attempt", async () => {
|
||||
vi.mocked(handshakeAsync).mockResolvedValueOnce(undefined);
|
||||
|
||||
await waitForRedisAsync();
|
||||
|
||||
expect(handshakeAsync).toHaveBeenCalledOnce();
|
||||
expect(mockLogger.info).toHaveBeenCalledWith("Redis connection established");
|
||||
});
|
||||
|
||||
test("retries on failure then succeeds", async () => {
|
||||
vi.mocked(handshakeAsync)
|
||||
.mockRejectedValueOnce(new Error("ECONNREFUSED"))
|
||||
.mockRejectedValueOnce(new Error("ECONNREFUSED"))
|
||||
.mockResolvedValueOnce(undefined);
|
||||
|
||||
const promise = waitForRedisAsync();
|
||||
|
||||
await vi.advanceTimersByTimeAsync(500);
|
||||
await vi.advanceTimersByTimeAsync(500);
|
||||
await promise;
|
||||
|
||||
expect(handshakeAsync).toHaveBeenCalledTimes(3);
|
||||
expect(mockLogger.warn).toHaveBeenCalledTimes(2);
|
||||
expect(mockLogger.info).toHaveBeenCalledWith("Redis connection established");
|
||||
});
|
||||
|
||||
test("logs error and proceeds after max retries exhausted", async () => {
|
||||
vi.mocked(handshakeAsync).mockRejectedValue(new Error("ECONNREFUSED"));
|
||||
|
||||
const promise = waitForRedisAsync();
|
||||
|
||||
for (let index = 0; index < 10; index++) {
|
||||
await vi.advanceTimersByTimeAsync(500);
|
||||
}
|
||||
await promise;
|
||||
|
||||
expect(handshakeAsync).toHaveBeenCalledTimes(10);
|
||||
expect(mockLogger.error).toHaveBeenCalledWith("Redis did not become ready after retries, proceeding anyway");
|
||||
expect(mockLogger.info).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("warns with attempt count on each retry", async () => {
|
||||
vi.mocked(handshakeAsync).mockRejectedValueOnce(new Error("fail")).mockResolvedValueOnce(undefined);
|
||||
|
||||
const promise = waitForRedisAsync();
|
||||
|
||||
await vi.advanceTimersByTimeAsync(500);
|
||||
await promise;
|
||||
|
||||
expect(mockLogger.warn).toHaveBeenCalledWith("Redis not ready, retrying (1/10)...");
|
||||
});
|
||||
|
||||
test("does not retry after success", async () => {
|
||||
vi.mocked(handshakeAsync).mockResolvedValueOnce(undefined);
|
||||
|
||||
await waitForRedisAsync();
|
||||
|
||||
expect(handshakeAsync).toHaveBeenCalledOnce();
|
||||
expect(mockLogger.warn).not.toHaveBeenCalled();
|
||||
expect(mockLogger.error).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
+19
-37
@@ -1,52 +1,34 @@
|
||||
// This import has to be the first import in the file so that the agent is overridden before any other modules are imported.
|
||||
import "./overrides";
|
||||
|
||||
import type { FastifyTRPCPluginOptions } from "@trpc/server/adapters/fastify";
|
||||
import { fastifyTRPCPlugin } from "@trpc/server/adapters/fastify";
|
||||
import fastify from "fastify";
|
||||
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
|
||||
import type { JobRouter } from "@homarr/cron-job-api";
|
||||
import { jobRouter } from "@homarr/cron-job-api";
|
||||
import { CRON_JOB_API_KEY_HEADER, CRON_JOB_API_PATH, CRON_JOB_API_PORT } from "@homarr/cron-job-api/constants";
|
||||
import { jobGroup } from "@homarr/cron-jobs";
|
||||
import { db } from "@homarr/db";
|
||||
import { handshakeAsync } from "@homarr/redis";
|
||||
|
||||
import { JobManager } from "./job-manager";
|
||||
import { onStartAsync } from "./on-start";
|
||||
|
||||
const logger = createLogger({ module: "tasksMain" });
|
||||
const logger = createLogger({ module: "tasks" });
|
||||
|
||||
const server = fastify({
|
||||
maxParamLength: 5000,
|
||||
});
|
||||
server.register(fastifyTRPCPlugin, {
|
||||
prefix: CRON_JOB_API_PATH,
|
||||
trpcOptions: {
|
||||
router: jobRouter,
|
||||
createContext: ({ req }) => ({
|
||||
manager: new JobManager(db, jobGroup),
|
||||
apiKey: req.headers[CRON_JOB_API_KEY_HEADER] as string | undefined,
|
||||
}),
|
||||
onError({ path, error }) {
|
||||
logger.error(new ErrorWithMetadata("Error in tasks tRPC handler", { path }, { cause: error }));
|
||||
},
|
||||
} satisfies FastifyTRPCPluginOptions<JobRouter>["trpcOptions"],
|
||||
});
|
||||
const MAX_RETRIES = 10;
|
||||
const RETRY_DELAY_MS = 500;
|
||||
|
||||
export const waitForRedisAsync = async () => {
|
||||
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
||||
try {
|
||||
await handshakeAsync();
|
||||
logger.info("Redis connection established");
|
||||
return;
|
||||
} catch {
|
||||
logger.warn(`Redis not ready, retrying (${attempt}/${MAX_RETRIES})...`);
|
||||
await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS));
|
||||
}
|
||||
}
|
||||
logger.error("Redis did not become ready after retries, proceeding anyway");
|
||||
};
|
||||
|
||||
void (async () => {
|
||||
await waitForRedisAsync();
|
||||
await onStartAsync();
|
||||
await jobGroup.initializeAsync();
|
||||
await jobGroup.startAllAsync();
|
||||
|
||||
try {
|
||||
await server.listen({ port: CRON_JOB_API_PORT });
|
||||
logger.info("Tasks web server started successfully", { port: CRON_JOB_API_PORT });
|
||||
} catch (err) {
|
||||
logger.error(
|
||||
new ErrorWithMetadata("Failed to start tasks web server", { port: CRON_JOB_API_PORT }, { cause: err }),
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
@@ -9,5 +9,5 @@
|
||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
||||
},
|
||||
"include": ["."],
|
||||
"exclude": ["node_modules"]
|
||||
"exclude": ["node_modules", "*.cjs", "*.css"]
|
||||
}
|
||||
@@ -4,10 +4,12 @@
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/main.ts"
|
||||
},
|
||||
"main": "./src/main.ts",
|
||||
"types": "./src/main.ts",
|
||||
"scripts": {
|
||||
"build": "esbuild src/main.ts --bundle --platform=node --outfile=wssServer.cjs --external:bcrypt --external:@opentelemetry/api --external:deasync --external:cpu-features --loader:.html=text --loader:.scss=text --loader:.node=text",
|
||||
"clean": "rm -rf .turbo node_modules",
|
||||
"dev": "pnpm with-env tsx ./src/main.ts",
|
||||
"format": "prettier --check . --ignore-path ../../.gitignore",
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
||||
},
|
||||
"include": ["."],
|
||||
"exclude": ["node_modules"]
|
||||
"exclude": ["node_modules", "*.cjs", "*.css"]
|
||||
}
|
||||
@@ -2,6 +2,5 @@ FROM node:24.15.0-trixie AS base
|
||||
WORKDIR /app
|
||||
COPY package.json .
|
||||
COPY pnpm-lock.yaml .
|
||||
COPY pnpm-workspace.yaml .
|
||||
RUN corepack enable pnpm && pnpm install --frozen-lockfile
|
||||
CMD ["sleep", "60s"]
|
||||
@@ -2,11 +2,16 @@
|
||||
"name": "homarr-prebuilt-debian",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^12.9.0"
|
||||
"better-sqlite3": "^12.10.0"
|
||||
},
|
||||
"packageManager": "pnpm@11.0.4",
|
||||
"packageManager": "pnpm@10.33.4",
|
||||
"engines": {
|
||||
"node": ">=24.15.0",
|
||||
"pnpm": ">=11.0.4"
|
||||
"pnpm": ">=10.33.4"
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"better-sqlite3"
|
||||
]
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -9,17 +9,17 @@ importers:
|
||||
.:
|
||||
dependencies:
|
||||
better-sqlite3:
|
||||
specifier: ^12.9.0
|
||||
version: 12.9.0
|
||||
specifier: ^12.10.0
|
||||
version: 12.10.0
|
||||
|
||||
packages:
|
||||
|
||||
base64-js@1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
|
||||
better-sqlite3@12.9.0:
|
||||
resolution: {integrity: sha512-wqUv4Gm3toFpHDQmaKD4QhZm3g1DjUBI0yzS4UBl6lElUmXFYdTQmmEDpAFa5o8FiFiymURypEnfVHzILKaxqQ==}
|
||||
engines: {node: 20.x || 22.x || 23.x || 24.x || 25.x}
|
||||
better-sqlite3@12.10.0:
|
||||
resolution: {integrity: sha512-CyzaZRQKyHkB2ZInfTTl2nvT33EbDpjkLEbE8/Zck3Ll6O0qqvuGdrJ45HgtH+HykRg88ITY3AdreBGN70aBSQ==}
|
||||
engines: {node: 20.x || 22.x || 23.x || 24.x || 25.x || 26.x}
|
||||
|
||||
bindings@1.5.0:
|
||||
resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==}
|
||||
@@ -148,7 +148,7 @@ snapshots:
|
||||
|
||||
base64-js@1.5.1: {}
|
||||
|
||||
better-sqlite3@12.9.0:
|
||||
better-sqlite3@12.10.0:
|
||||
dependencies:
|
||||
bindings: 1.5.0
|
||||
prebuild-install: 7.1.3
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
allowBuilds:
|
||||
better-sqlite3: true
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { chromium } from "playwright";
|
||||
import { chromium } from "@playwright/test";
|
||||
import { GenericContainer } from "testcontainers";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { chromium } from "playwright";
|
||||
import { chromium } from "@playwright/test";
|
||||
import { describe, test } from "vitest";
|
||||
|
||||
import { OnboardingActions } from "./shared/actions/onboarding-actions";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createId } from "@paralleldrive/cuid2";
|
||||
import type { Page } from "playwright";
|
||||
import type { Page } from "@playwright/test";
|
||||
|
||||
import * as sqliteSchema from "../../../packages/db/schema/sqlite";
|
||||
import type { SqliteDatabase } from "../e2e-db";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import { eq } from "drizzle-orm";
|
||||
import type { Page } from "playwright";
|
||||
import { expect } from "vitest";
|
||||
|
||||
import * as sqliteSchema from "../../../packages/db/schema/sqlite";
|
||||
|
||||
+51
-6
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "homarr",
|
||||
"version": "1.60.0",
|
||||
"version": "1.61.1-beta.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "cross-env CI=true turbo build",
|
||||
@@ -15,7 +15,7 @@
|
||||
"db:migration:sqlite:run": "pnpm -F db migration:sqlite:run",
|
||||
"db:push": "pnpm -F db push:sqlite",
|
||||
"db:studio": "pnpm -F db studio",
|
||||
"dev": "turbo dev --parallel",
|
||||
"dev": "pnpm -F nextjs dev",
|
||||
"docker:dev": "docker compose -f ./development/development.docker-compose.yml up",
|
||||
"format": "turbo format --continue -- --cache --cache-location node_modules/.cache/.prettiercache",
|
||||
"format:fix": "turbo format --continue -- --write --cache --cache-location node_modules/.cache/.prettiercache",
|
||||
@@ -36,6 +36,7 @@
|
||||
"prettier": "@homarr/prettier-config",
|
||||
"devDependencies": {
|
||||
"@homarr/prettier-config": "workspace:^0.1.0",
|
||||
"@playwright/test": "catalog:",
|
||||
"@semantic-release/changelog": "catalog:",
|
||||
"@semantic-release/commit-analyzer": "catalog:",
|
||||
"@semantic-release/git": "catalog:",
|
||||
@@ -57,12 +58,56 @@
|
||||
"turbo": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vite-tsconfig-paths": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
"yaml": "catalog:"
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"packageManager": "pnpm@11.0.4",
|
||||
"packageManager": "pnpm@10.33.4",
|
||||
"engines": {
|
||||
"node": ">=24.15.0",
|
||||
"pnpm": ">=11.0.4"
|
||||
"pnpm": ">=10.33.4"
|
||||
},
|
||||
"pnpm": {
|
||||
"onlyBuiltDependencies": [
|
||||
"@tree-sitter-grammars/tree-sitter-yaml",
|
||||
"bcrypt",
|
||||
"better-sqlite3",
|
||||
"cpu-features",
|
||||
"esbuild",
|
||||
"sharp",
|
||||
"ssh2",
|
||||
"tree-sitter",
|
||||
"tree-sitter-json"
|
||||
],
|
||||
"overrides": {
|
||||
"@babel/helpers@<7.26.10": ">=7.29.2",
|
||||
"@babel/runtime@<7.26.10": ">=7.29.2",
|
||||
"axios@>=1.0.0 <1.8.2": ">=1.16.1",
|
||||
"brace-expansion@>=2.0.0 <=2.0.1": ">=5.0.6",
|
||||
"brace-expansion@>=1.0.0 <=1.1.11": ">=5.0.6",
|
||||
"esbuild@<=0.24.2": ">=0.28.0",
|
||||
"form-data@>=4.0.0 <4.0.4": ">=4.0.5",
|
||||
"hono@<4.6.5": ">=4.12.19",
|
||||
"linkifyjs@<4.3.2": ">=4.3.3",
|
||||
"nanoid@>=4.0.0 <5.0.9": ">=5.1.11",
|
||||
"prismjs@<1.30.0": ">=1.30.0",
|
||||
"proxmox-api>undici": "7.24.6",
|
||||
"react-is": "^19.2.6",
|
||||
"rollup@>=4.0.0 <4.22.4": ">=4.60.4",
|
||||
"sha.js@<=2.4.11": ">=2.4.12",
|
||||
"tar-fs@>=3.0.0 <3.0.9": ">=3.1.2",
|
||||
"tar-fs@>=2.0.0 <2.1.3": ">=3.1.2",
|
||||
"tmp@<=0.2.3": ">=0.2.5",
|
||||
"vite@>=5.0.0 <=5.4.18": ">=8.0.13"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"@types/node-unifi": "patches/@types__node-unifi.patch",
|
||||
"trpc-to-openapi": "patches/trpc-to-openapi.patch"
|
||||
},
|
||||
"allowUnusedPatches": true,
|
||||
"ignoredBuiltDependencies": [
|
||||
"@scarf/scarf",
|
||||
"@swc/core",
|
||||
"core-js-pure",
|
||||
"protobufjs"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@
|
||||
"@homarr/auth": "workspace:^0.1.0",
|
||||
"@homarr/common": "workspace:^0.1.0",
|
||||
"@homarr/core": "workspace:^0.1.0",
|
||||
"@homarr/cron-job-api": "workspace:^0.1.0",
|
||||
"@homarr/cron-job-status": "workspace:^0.1.0",
|
||||
"@homarr/cron-jobs": "workspace:^0.1.0",
|
||||
"@homarr/db": "workspace:^0.1.0",
|
||||
|
||||
@@ -2,33 +2,36 @@ import { observable } from "@trpc/server/observable";
|
||||
import z from "zod/v4";
|
||||
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import { jobGroupKeys, jobNameSchema } from "@homarr/cron-job-api";
|
||||
import { cronJobApi } from "@homarr/cron-job-api/client";
|
||||
import type { TaskStatus } from "@homarr/cron-job-status";
|
||||
import { createCronJobStatusChannel } from "@homarr/cron-job-status";
|
||||
import { jobGroup } from "@homarr/cron-jobs";
|
||||
import { JobManager } from "@homarr/cron-jobs/job-manager";
|
||||
|
||||
import { createTRPCRouter, permissionRequiredProcedure } from "../trpc";
|
||||
|
||||
const jobGroupKeys = jobGroup.getKeys();
|
||||
const jobNameSchema = z.enum(jobGroup.getKeys());
|
||||
|
||||
const logger = createLogger({ module: "cronJobsRouter" });
|
||||
|
||||
export const cronJobsRouter = createTRPCRouter({
|
||||
triggerJob: permissionRequiredProcedure
|
||||
.requiresPermission("admin")
|
||||
.input(jobNameSchema)
|
||||
.mutation(async ({ input }) => {
|
||||
await cronJobApi.trigger.mutate(input);
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
await new JobManager(ctx.db, jobGroup).triggerAsync(input);
|
||||
}),
|
||||
startJob: permissionRequiredProcedure
|
||||
.requiresPermission("admin")
|
||||
.input(jobNameSchema)
|
||||
.mutation(async ({ input }) => {
|
||||
await cronJobApi.start.mutate(input);
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
await new JobManager(ctx.db, jobGroup).startAsync(input);
|
||||
}),
|
||||
stopJob: permissionRequiredProcedure
|
||||
.requiresPermission("admin")
|
||||
.input(jobNameSchema)
|
||||
.mutation(async ({ input }) => {
|
||||
await cronJobApi.stop.mutate(input);
|
||||
.mutation(({ input, ctx }) => {
|
||||
new JobManager(ctx.db, jobGroup).stop(input);
|
||||
}),
|
||||
updateJobInterval: permissionRequiredProcedure
|
||||
.requiresPermission("admin")
|
||||
@@ -38,23 +41,23 @@ export const cronJobsRouter = createTRPCRouter({
|
||||
cron: z.string(),
|
||||
}),
|
||||
)
|
||||
.mutation(async ({ input }) => {
|
||||
await cronJobApi.updateInterval.mutate(input);
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
await new JobManager(ctx.db, jobGroup).updateIntervalAsync(input.name, input.cron);
|
||||
}),
|
||||
disableJob: permissionRequiredProcedure
|
||||
.requiresPermission("admin")
|
||||
.input(jobNameSchema)
|
||||
.mutation(async ({ input }) => {
|
||||
await cronJobApi.disable.mutate(input);
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
await new JobManager(ctx.db, jobGroup).disableAsync(input);
|
||||
}),
|
||||
enableJob: permissionRequiredProcedure
|
||||
.requiresPermission("admin")
|
||||
.input(jobNameSchema)
|
||||
.mutation(async ({ input }) => {
|
||||
await cronJobApi.enable.mutate(input);
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
await new JobManager(ctx.db, jobGroup).enableAsync(input);
|
||||
}),
|
||||
getJobs: permissionRequiredProcedure.requiresPermission("admin").query(async () => {
|
||||
return await cronJobApi.getAll.query();
|
||||
getJobs: permissionRequiredProcedure.requiresPermission("admin").query(async ({ ctx }) => {
|
||||
return await new JobManager(ctx.db, jobGroup).getAllAsync();
|
||||
}),
|
||||
subscribeToStatusUpdates: permissionRequiredProcedure.requiresPermission("admin").subscription(() => {
|
||||
return observable<TaskStatus>((emit) => {
|
||||
|
||||
@@ -138,6 +138,7 @@ const getContainerOrThrowAsync = async (id: string) => {
|
||||
interface DockerContainer {
|
||||
name: string;
|
||||
id: string;
|
||||
host: string;
|
||||
state: ContainerState;
|
||||
image: string;
|
||||
ports: Port[] | undefined;
|
||||
|
||||
@@ -5,3 +5,26 @@ export const capitalize = <T extends string>(str: T) => {
|
||||
export const isNullOrWhitespace = (value: string | null): value is null => {
|
||||
return value == null || value.trim() === "";
|
||||
};
|
||||
|
||||
export const bestMatch = <TItem extends Record<string, unknown>>(
|
||||
search: string,
|
||||
options: TItem[],
|
||||
by: (item: TItem) => string,
|
||||
) => {
|
||||
if (options.length === 0) return null;
|
||||
|
||||
const normalizedSearch = search.toLowerCase().trim();
|
||||
|
||||
return options.reduce<TItem | null>((best, current) => {
|
||||
const currentMatchIndex = by(current).toLowerCase().indexOf(normalizedSearch);
|
||||
|
||||
if (currentMatchIndex === -1) return best;
|
||||
if (best === null) return current;
|
||||
|
||||
const bestMatchIndex = by(best).toLowerCase().indexOf(normalizedSearch);
|
||||
|
||||
if (currentMatchIndex < bestMatchIndex) return current;
|
||||
if (by(current).length < by(best).length && currentMatchIndex === bestMatchIndex) return current;
|
||||
return best;
|
||||
}, null);
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { capitalize } from "../string";
|
||||
import { bestMatch, capitalize } from "../string";
|
||||
|
||||
const capitalizeTestCases = [
|
||||
["hello", "Hello"],
|
||||
@@ -12,8 +12,45 @@ const capitalizeTestCases = [
|
||||
|
||||
describe("capitalize should capitalize the first letter of a string", () => {
|
||||
capitalizeTestCases.forEach(([input, expected]) => {
|
||||
it(`should capitalize ${input} to ${expected}`, () => {
|
||||
test(`should capitalize ${input} to ${expected}`, () => {
|
||||
expect(capitalize(input)).toEqual(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("bestMatch should find the best match in an array of options", () => {
|
||||
test("should find exact match for 'nginx'", () => {
|
||||
const options = [
|
||||
{ name: "my-nginx" },
|
||||
{ name: "nginx-proxy" },
|
||||
{ name: "nginx" },
|
||||
{ name: "redis" },
|
||||
{ name: "postgres" },
|
||||
];
|
||||
|
||||
const result = bestMatch("nginx", options, ({ name }) => name);
|
||||
|
||||
expect(result).toEqual({ name: "nginx" });
|
||||
});
|
||||
test("should find closest match for 'nginx' when exact match is not available", () => {
|
||||
const options = [{ name: "redis" }, { name: "nginx-proxy" }, { name: "my-nginx" }, { name: "postgres" }];
|
||||
|
||||
const result = bestMatch("nginx", options, ({ name }) => name);
|
||||
|
||||
expect(result).toEqual({ name: "nginx-proxy" });
|
||||
});
|
||||
test("should return null if no match is found", () => {
|
||||
const options = [{ name: "redis" }, { name: "postgres" }];
|
||||
|
||||
const result = bestMatch("nginx", options, ({ name }) => name);
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
test("should return null if options array is empty", () => {
|
||||
const options: { name: string }[] = [];
|
||||
|
||||
const result = bestMatch("nginx", options, ({ name }) => name);
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { getPortFromUrl } from "../url";
|
||||
import { getPortFromUrl, isAbsoluteUrl } from "../url.js";
|
||||
|
||||
describe("getPortFromUrl", () => {
|
||||
test.each([
|
||||
@@ -38,3 +38,21 @@ describe("getPortFromUrl", () => {
|
||||
expect(act).toThrowError("Unsupported protocol: ftp:");
|
||||
});
|
||||
});
|
||||
|
||||
describe("isAbsoluteUrl", () => {
|
||||
test.each([
|
||||
["http://example.com", true],
|
||||
["https://example.com", true],
|
||||
["ftp://example.com", true],
|
||||
["file:///path/to/file", true],
|
||||
["mailto:johndoe@example.com", true],
|
||||
["/relative/path", false],
|
||||
["relative/path", false],
|
||||
])("should return %s for URL: %s", (urlString, expected) => {
|
||||
// Act
|
||||
const result = isAbsoluteUrl(urlString);
|
||||
|
||||
// Assert
|
||||
expect(result).toBe(expected);
|
||||
});
|
||||
});
|
||||
@@ -38,3 +38,9 @@ export const getPortFromUrl = (url: URL): number => {
|
||||
|
||||
throw new Error(`Unsupported protocol: ${url.protocol}`);
|
||||
};
|
||||
|
||||
const absoluteUrlRegex = /^[a-z]+:(\/\/)?/;
|
||||
|
||||
export const isAbsoluteUrl = (urlOrPath: string): boolean => {
|
||||
return absoluteUrlRegex.test(urlOrPath.toLowerCase());
|
||||
};
|
||||
@@ -5,6 +5,7 @@ import { redisEnv } from "./env";
|
||||
|
||||
const defaultRedisOptions = {
|
||||
connectionName: "homarr",
|
||||
lazyConnect: true,
|
||||
} satisfies RedisOptions;
|
||||
|
||||
export type { Redis as RedisClient } from "ioredis";
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import baseConfig from "@homarr/eslint-config/base";
|
||||
|
||||
/** @type {import('typescript-eslint').Config} */
|
||||
export default [
|
||||
{
|
||||
ignores: [],
|
||||
},
|
||||
...baseConfig,
|
||||
];
|
||||
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"name": "@homarr/cron-job-api",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./env": "./src/env.ts",
|
||||
"./constants": "./src/constants.ts",
|
||||
"./client": "./src/client.ts"
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
"*": [
|
||||
"src/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rm -rf .turbo node_modules",
|
||||
"format": "prettier --check . --ignore-path ../../.gitignore",
|
||||
"lint": "eslint",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"prettier": "@homarr/prettier-config",
|
||||
"dependencies": {
|
||||
"@homarr/common": "workspace:^0.1.0",
|
||||
"@homarr/core": "workspace:^0.1.0",
|
||||
"@homarr/cron-jobs": "workspace:^0.1.0",
|
||||
"@tanstack/react-query": "catalog:",
|
||||
"@trpc/client": "catalog:",
|
||||
"@trpc/server": "catalog:",
|
||||
"@trpc/tanstack-react-query": "catalog:",
|
||||
"react": "catalog:",
|
||||
"zod": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@homarr/eslint-config": "workspace:^0.2.0",
|
||||
"@homarr/prettier-config": "workspace:^0.1.0",
|
||||
"@homarr/tsconfig": "workspace:^0.1.0",
|
||||
"@types/react": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { createTRPCClient, httpLink } from "@trpc/client";
|
||||
|
||||
import type { JobRouter } from ".";
|
||||
import { CRON_JOB_API_KEY_HEADER, CRON_JOB_API_PATH, CRON_JOB_API_PORT } from "./constants";
|
||||
import { env } from "./env";
|
||||
|
||||
export const cronJobApi = createTRPCClient<JobRouter>({
|
||||
links: [
|
||||
httpLink({
|
||||
url: `${getBaseUrl()}${CRON_JOB_API_PATH}`,
|
||||
headers: {
|
||||
[CRON_JOB_API_KEY_HEADER]: env.CRON_JOB_API_KEY,
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
function getBaseUrl() {
|
||||
return `http://localhost:${CRON_JOB_API_PORT}`;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export const CRON_JOB_API_PORT = 3002;
|
||||
export const CRON_JOB_API_PATH = "/trpc";
|
||||
export const CRON_JOB_API_KEY_HEADER = "cron-job-api-key";
|
||||
@@ -1,11 +0,0 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
import { env as commonEnv } from "@homarr/common/env";
|
||||
import { createEnv } from "@homarr/core/infrastructure/env";
|
||||
|
||||
export const env = createEnv({
|
||||
server: {
|
||||
CRON_JOB_API_KEY: commonEnv.NODE_ENV === "development" ? z.string().default("test") : z.string(),
|
||||
},
|
||||
experimental__runtimeEnv: process.env,
|
||||
});
|
||||
@@ -1,85 +0,0 @@
|
||||
import { initTRPC, TRPCError } from "@trpc/server";
|
||||
import { z } from "zod/v4";
|
||||
|
||||
import type { JobGroupKeys } from "@homarr/cron-jobs";
|
||||
import { jobGroup } from "@homarr/cron-jobs";
|
||||
|
||||
import { env } from "./env";
|
||||
|
||||
export const jobGroupKeys = jobGroup.getKeys();
|
||||
export const jobNameSchema = z.enum(jobGroup.getKeys());
|
||||
|
||||
export interface IJobManager {
|
||||
startAsync(name: JobGroupKeys): Promise<void>;
|
||||
triggerAsync(name: JobGroupKeys): Promise<void>;
|
||||
stop(name: JobGroupKeys): void;
|
||||
updateIntervalAsync(name: JobGroupKeys, cron: string): Promise<void>;
|
||||
disableAsync(name: JobGroupKeys): Promise<void>;
|
||||
enableAsync(name: JobGroupKeys): Promise<void>;
|
||||
getAllAsync(): Promise<
|
||||
{
|
||||
name: JobGroupKeys;
|
||||
cron: string;
|
||||
preventManualExecution: boolean;
|
||||
preventCustomInterval: boolean;
|
||||
isEnabled: boolean;
|
||||
}[]
|
||||
>;
|
||||
}
|
||||
|
||||
const t = initTRPC
|
||||
.context<{
|
||||
manager: IJobManager;
|
||||
apiKey?: string;
|
||||
}>()
|
||||
.create();
|
||||
|
||||
const createTrpcRouter = t.router;
|
||||
const apiKeyProcedure = t.procedure.use(({ ctx, next }) => {
|
||||
if (ctx.apiKey !== env.CRON_JOB_API_KEY) {
|
||||
throw new TRPCError({
|
||||
code: "FORBIDDEN",
|
||||
message: "Missing or invalid API key",
|
||||
});
|
||||
}
|
||||
|
||||
return next({
|
||||
ctx: {
|
||||
...ctx,
|
||||
apiKey: undefined, // Clear the API key after checking
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
export const jobRouter = createTrpcRouter({
|
||||
start: apiKeyProcedure.input(jobNameSchema).mutation(async ({ input, ctx }) => {
|
||||
await ctx.manager.startAsync(input);
|
||||
}),
|
||||
trigger: apiKeyProcedure.input(jobNameSchema).mutation(async ({ input, ctx }) => {
|
||||
await ctx.manager.triggerAsync(input);
|
||||
}),
|
||||
stop: apiKeyProcedure.input(jobNameSchema).mutation(({ input, ctx }) => {
|
||||
ctx.manager.stop(input);
|
||||
}),
|
||||
updateInterval: apiKeyProcedure
|
||||
.input(
|
||||
z.object({
|
||||
name: jobNameSchema,
|
||||
cron: z.string(),
|
||||
}),
|
||||
)
|
||||
.mutation(async ({ input, ctx }) => {
|
||||
await ctx.manager.updateIntervalAsync(input.name, input.cron);
|
||||
}),
|
||||
disable: apiKeyProcedure.input(jobNameSchema).mutation(async ({ input, ctx }) => {
|
||||
await ctx.manager.disableAsync(input);
|
||||
}),
|
||||
enable: apiKeyProcedure.input(jobNameSchema).mutation(async ({ input, ctx }) => {
|
||||
await ctx.manager.enableAsync(input);
|
||||
}),
|
||||
getAll: apiKeyProcedure.query(({ ctx }) => {
|
||||
return ctx.manager.getAllAsync();
|
||||
}),
|
||||
});
|
||||
|
||||
export type JobRouter = typeof jobRouter;
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "@homarr/tsconfig/base.json",
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
||||
},
|
||||
"include": ["*.ts", "src"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -5,7 +5,8 @@
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./index.ts"
|
||||
".": "./index.ts",
|
||||
"./job-manager": "./src/job-manager.ts"
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
@@ -38,7 +39,8 @@
|
||||
"@homarr/server-settings": "workspace:^0.1.0",
|
||||
"@homarr/translation": "workspace:^0.1.0",
|
||||
"@homarr/validation": "workspace:^0.1.0",
|
||||
"semver-parser": "catalog:"
|
||||
"semver-parser": "catalog:",
|
||||
"zod": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@homarr/eslint-config": "workspace:^0.2.0",
|
||||
|
||||
@@ -28,34 +28,45 @@ import { updateCheckerJob } from "./jobs/update-checker";
|
||||
import { weatherJob } from "./jobs/weather";
|
||||
import { createCronJobGroup } from "./lib";
|
||||
|
||||
export const jobGroup = createCronJobGroup({
|
||||
analytics: analyticsJob,
|
||||
iconsUpdater: iconsUpdaterJob,
|
||||
ping: pingJob,
|
||||
smartHomeEntityState: smartHomeEntityStateJob,
|
||||
mediaServer: mediaServerJob,
|
||||
mediaOrganizer: mediaOrganizerJob,
|
||||
downloads: downloadsJob,
|
||||
dnsHole: dnsHoleJob,
|
||||
mediaRequestStats: mediaRequestStatsJob,
|
||||
mediaRequestList: mediaRequestListJob,
|
||||
rssFeeds: rssFeedsJob,
|
||||
indexerManager: indexerManagerJob,
|
||||
healthMonitoring: healthMonitoringJob,
|
||||
updateChecker: updateCheckerJob,
|
||||
mediaTranscoding: mediaTranscodingJob,
|
||||
minecraftServerStatus: minecraftServerStatusJob,
|
||||
dockerContainers: dockerContainersJob,
|
||||
networkController: networkControllerJob,
|
||||
firewallCpu: firewallCpuJob,
|
||||
firewallMemory: firewallMemoryJob,
|
||||
firewallVersion: firewallVersionJob,
|
||||
firewallInterfaces: firewallInterfacesJob,
|
||||
refreshNotifications: refreshNotificationsJob,
|
||||
weather: weatherJob,
|
||||
timetable: timetableJob,
|
||||
tracearr: tracearrJob,
|
||||
umamiActiveVisitors: umamiActiveVisitorsJob,
|
||||
});
|
||||
const getJobGroup = () => {
|
||||
return createCronJobGroup({
|
||||
analytics: analyticsJob,
|
||||
iconsUpdater: iconsUpdaterJob,
|
||||
ping: pingJob,
|
||||
smartHomeEntityState: smartHomeEntityStateJob,
|
||||
mediaServer: mediaServerJob,
|
||||
mediaOrganizer: mediaOrganizerJob,
|
||||
downloads: downloadsJob,
|
||||
dnsHole: dnsHoleJob,
|
||||
mediaRequestStats: mediaRequestStatsJob,
|
||||
mediaRequestList: mediaRequestListJob,
|
||||
rssFeeds: rssFeedsJob,
|
||||
indexerManager: indexerManagerJob,
|
||||
healthMonitoring: healthMonitoringJob,
|
||||
updateChecker: updateCheckerJob,
|
||||
mediaTranscoding: mediaTranscodingJob,
|
||||
minecraftServerStatus: minecraftServerStatusJob,
|
||||
dockerContainers: dockerContainersJob,
|
||||
networkController: networkControllerJob,
|
||||
firewallCpu: firewallCpuJob,
|
||||
firewallMemory: firewallMemoryJob,
|
||||
firewallVersion: firewallVersionJob,
|
||||
firewallInterfaces: firewallInterfacesJob,
|
||||
refreshNotifications: refreshNotificationsJob,
|
||||
weather: weatherJob,
|
||||
timetable: timetableJob,
|
||||
tracearr: tracearrJob,
|
||||
umamiActiveVisitors: umamiActiveVisitorsJob,
|
||||
});
|
||||
};
|
||||
|
||||
// Add global type augmentation for homarr
|
||||
declare global {
|
||||
var cronJobs: ReturnType<typeof getJobGroup> | undefined;
|
||||
}
|
||||
|
||||
global.cronJobs ??= getJobGroup();
|
||||
|
||||
export const jobGroup = global.cronJobs;
|
||||
|
||||
export type JobGroupKeys = ReturnType<(typeof jobGroup)["getKeys"]>[number];
|
||||
@@ -1,7 +1,6 @@
|
||||
import { Cron } from "croner";
|
||||
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import type { IJobManager } from "@homarr/cron-job-api";
|
||||
import type { jobGroup as cronJobGroup, JobGroupKeys } from "@homarr/cron-jobs";
|
||||
import type { Database, InferInsertModel } from "@homarr/db";
|
||||
import { eq } from "@homarr/db";
|
||||
@@ -9,7 +8,7 @@ import { cronJobConfigurations } from "@homarr/db/schema";
|
||||
|
||||
const logger = createLogger({ module: "jobManager" });
|
||||
|
||||
export class JobManager implements IJobManager {
|
||||
export class JobManager {
|
||||
constructor(
|
||||
private db: Database,
|
||||
private jobGroup: typeof cronJobGroup,
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createId, objectKeys } from "@homarr/common";
|
||||
import {
|
||||
createDocumentationLink,
|
||||
credentialsAdminGroup,
|
||||
everyoneGroup,
|
||||
getIntegrationDefaultUrl,
|
||||
getIntegrationName,
|
||||
@@ -11,12 +12,24 @@ import { defaultServerSettings, defaultServerSettingsKeys } from "@homarr/server
|
||||
|
||||
import type { Database } from "..";
|
||||
import { eq } from "..";
|
||||
import { getMaxGroupPositionAsync } from "../queries";
|
||||
import {
|
||||
getServerSettingByKeyAsync,
|
||||
insertServerSettingByKeyAsync,
|
||||
updateServerSettingByKeyAsync,
|
||||
} from "../queries/server-setting";
|
||||
import { groups, integrations, onboarding, searchEngines } from "../schema";
|
||||
import {
|
||||
boards,
|
||||
groupMembers,
|
||||
groupPermissions,
|
||||
groups,
|
||||
integrations,
|
||||
layouts,
|
||||
onboarding,
|
||||
searchEngines,
|
||||
sections,
|
||||
users,
|
||||
} from "../schema";
|
||||
import type { Integration } from "../schema";
|
||||
|
||||
export const seedDataAsync = async (db: Database) => {
|
||||
@@ -25,6 +38,10 @@ export const seedDataAsync = async (db: Database) => {
|
||||
await seedServerSettingsAsync(db);
|
||||
await seedDefaultSearchEnginesAsync(db);
|
||||
await seedDefaultIntegrationsAsync(db);
|
||||
|
||||
if (process.env.DEMO_MODE === "true") {
|
||||
await seedDemoUserAsync(db);
|
||||
}
|
||||
};
|
||||
|
||||
const seedEveryoneGroupAsync = async (db: Database) => {
|
||||
@@ -191,3 +208,72 @@ const seedDefaultIntegrationsAsync = async (db: Database) => {
|
||||
|
||||
console.log(`Created ${createdCount} default integrations through seeding process`);
|
||||
};
|
||||
|
||||
const seedDemoUserAsync = async (db: Database) => {
|
||||
const existingUser = await db.query.users.findFirst({
|
||||
where: eq(users.name, "demo"),
|
||||
});
|
||||
|
||||
if (existingUser) {
|
||||
console.log("Skipping seeding of demo user as it already exists");
|
||||
return;
|
||||
}
|
||||
|
||||
const userId = createId();
|
||||
|
||||
await db.insert(users).values({
|
||||
id: userId,
|
||||
name: "demo",
|
||||
email: "demo@example.com",
|
||||
password: "$2b$10$c5AaQb0oj32/bui5Z55PyOb7pY.iEkXYqgdD8MjS9LjSjLMeOkZu2",
|
||||
});
|
||||
|
||||
const maxPosition = await getMaxGroupPositionAsync(db);
|
||||
const groupId = createId();
|
||||
await db.insert(groups).values({
|
||||
id: groupId,
|
||||
name: credentialsAdminGroup,
|
||||
ownerId: userId,
|
||||
position: maxPosition + 1,
|
||||
});
|
||||
await db.insert(groupPermissions).values({
|
||||
groupId,
|
||||
permission: "admin",
|
||||
});
|
||||
await db.insert(groupMembers).values({
|
||||
groupId,
|
||||
userId,
|
||||
});
|
||||
|
||||
await db.update(onboarding).set({
|
||||
step: "finish",
|
||||
previousStep: "settings",
|
||||
});
|
||||
|
||||
const boardId = createId();
|
||||
await db.insert(boards).values({
|
||||
id: boardId,
|
||||
name: "default",
|
||||
isPublic: false,
|
||||
creatorId: userId,
|
||||
});
|
||||
await db.insert(sections).values({
|
||||
id: createId(),
|
||||
kind: "empty",
|
||||
xOffset: 0,
|
||||
yOffset: 0,
|
||||
boardId,
|
||||
});
|
||||
await db.insert(layouts).values({
|
||||
id: createId(),
|
||||
name: "Base",
|
||||
columnCount: 12,
|
||||
breakpoint: 0,
|
||||
boardId,
|
||||
});
|
||||
await db.update(users).set({ homeBoardId: boardId }).where(eq(users.id, userId));
|
||||
|
||||
console.log(
|
||||
"Your instance has enabled demo mode. Homarr therefore created example data for your demo. You can disable demo mode anytime by setting the env 'DEMO_MODE' to 'false' or unset it.",
|
||||
);
|
||||
};
|
||||
@@ -93,6 +93,7 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/tags/roles"
|
||||
| "/docs/tags/search"
|
||||
| "/docs/tags/search-engines"
|
||||
| "/docs/tags/secrets"
|
||||
| "/docs/tags/security"
|
||||
| "/docs/tags/self-signed"
|
||||
| "/docs/tags/seo"
|
||||
@@ -198,6 +199,7 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/integrations/tracearr"
|
||||
| "/docs/integrations/transmission"
|
||||
| "/docs/integrations/truenas"
|
||||
| "/docs/integrations/umami"
|
||||
| "/docs/integrations/unifi-controller"
|
||||
| "/docs/integrations/unraid"
|
||||
| "/docs/management/api"
|
||||
@@ -244,6 +246,7 @@ export type HomarrDocumentationPath =
|
||||
| "/docs/widgets/system-resources"
|
||||
| "/docs/widgets/timetable"
|
||||
| "/docs/widgets/tracearr"
|
||||
| "/docs/widgets/umami"
|
||||
| "/docs/widgets/video"
|
||||
| "/docs/widgets/weather"
|
||||
| ""
|
||||
|
||||
@@ -61,7 +61,7 @@ export const integrationDefs = {
|
||||
},
|
||||
qBittorrent: {
|
||||
name: "qBittorrent",
|
||||
secretKinds: [["username", "password"]],
|
||||
secretKinds: [["apiKey"], ["username", "password"]],
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/qbittorrent.svg",
|
||||
category: ["downloadClient", "torrent"],
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/q-bittorent"),
|
||||
@@ -376,7 +376,6 @@ export const integrationDefs = {
|
||||
iconUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons@master/svg/umami.svg",
|
||||
category: ["analytics"],
|
||||
defaultUrl: "https://api.umami.is/v1",
|
||||
// @ts-expect-error - docs page will be created when integration is merged
|
||||
documentationUrl: createDocumentationLink("/docs/integrations/umami"),
|
||||
},
|
||||
// This integration only returns mock data, it is used during development (but can also be used in production by directly going to the create page)
|
||||
|
||||
@@ -4,9 +4,11 @@ import { createBooleanSchema, createEnv } from "@homarr/core/infrastructure/env"
|
||||
|
||||
export const env = createEnv({
|
||||
server: {
|
||||
// Comma separated list of docker hostnames that can be used to connect to query the docker endpoints (localhost:2375,host.docker.internal:2375, ...)
|
||||
// Comma separated list of docker hostnames that can be used to connect to query the docker endpoints (localhost,host.docker.internal, ...)
|
||||
DOCKER_HOSTNAMES: z.string().optional(),
|
||||
DOCKER_PORTS: z.string().optional(),
|
||||
// Comma separated paths to Docker-compatible Unix sockets (e.g., /var/run/docker.sock,/run/user/1000/podman/podman.sock)
|
||||
DOCKER_SOCKET_PATHS: z.string().optional(),
|
||||
ENABLE_DOCKER: createBooleanSchema(true),
|
||||
ENABLE_KUBERNETES: createBooleanSchema(false),
|
||||
},
|
||||
|
||||
@@ -11,31 +11,43 @@ export class DockerSingleton {
|
||||
private static instances: DockerInstance[] | null = null;
|
||||
|
||||
private createInstances() {
|
||||
const socketPaths = env.DOCKER_SOCKET_PATHS;
|
||||
const hostVariable = env.DOCKER_HOSTNAMES;
|
||||
const portVariable = env.DOCKER_PORTS;
|
||||
if (hostVariable === undefined || portVariable === undefined) {
|
||||
|
||||
// Socket instances from DOCKER_SOCKET_PATHS
|
||||
const socketInstances: DockerInstance[] = socketPaths
|
||||
? socketPaths.split(",").map((socketPath) => ({
|
||||
host: socketPath,
|
||||
instance: new Docker({ socketPath }),
|
||||
}))
|
||||
: [];
|
||||
|
||||
// TCP instances from existing DOCKER_HOSTNAMES/DOCKER_PORTS
|
||||
let tcpInstances: DockerInstance[] = [];
|
||||
if (hostVariable !== undefined && portVariable !== undefined) {
|
||||
const hostnames = hostVariable.split(",");
|
||||
const ports = portVariable.split(",");
|
||||
|
||||
if (hostnames.length !== ports.length) {
|
||||
throw new Error("The number of hosts and ports must match");
|
||||
}
|
||||
|
||||
tcpInstances = hostnames.map((host, i) => ({
|
||||
host: `${host}:${ports[i]}`,
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
instance: new Docker({ host, port: parseInt(ports[i]!, 10) }),
|
||||
}));
|
||||
}
|
||||
|
||||
const instances = [...socketInstances, ...tcpInstances];
|
||||
|
||||
// Default: local socket if nothing else configured
|
||||
if (instances.length === 0) {
|
||||
return [{ host: "socket", instance: new Docker() }];
|
||||
}
|
||||
const hostnames = hostVariable.split(",");
|
||||
const ports = portVariable.split(",");
|
||||
|
||||
if (hostnames.length !== ports.length) {
|
||||
throw new Error("The number of hosts and ports must match");
|
||||
}
|
||||
|
||||
return hostnames.map((host, i) => {
|
||||
// Check above ensures that ports[i] is not undefined
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const port = ports[i]!;
|
||||
|
||||
return {
|
||||
host: `${host}:${port}`,
|
||||
instance: new Docker({
|
||||
host,
|
||||
port: parseInt(port, 10),
|
||||
}),
|
||||
};
|
||||
});
|
||||
return instances;
|
||||
}
|
||||
|
||||
public static findInstance(host: string): DockerInstance | undefined {
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
import { beforeEach, describe, expect, test, vi } from "vitest";
|
||||
|
||||
import { DockerSingleton } from "../singleton";
|
||||
|
||||
const mockEnv = vi.hoisted(() => ({
|
||||
DOCKER_SOCKET_PATHS: undefined as string | undefined,
|
||||
DOCKER_HOSTNAMES: undefined as string | undefined,
|
||||
DOCKER_PORTS: undefined as string | undefined,
|
||||
ENABLE_DOCKER: true,
|
||||
ENABLE_KUBERNETES: false,
|
||||
}));
|
||||
|
||||
vi.mock("dockerode", () => {
|
||||
return {
|
||||
default: class MockDocker {
|
||||
constructor(public opts?: Record<string, unknown>) {}
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
vi.mock("../env", () => ({
|
||||
env: mockEnv,
|
||||
}));
|
||||
|
||||
describe("DockerSingleton", () => {
|
||||
beforeEach(() => {
|
||||
// Reset singleton cache between tests
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
||||
(DockerSingleton as any).instances = null;
|
||||
|
||||
// Reset env to defaults
|
||||
mockEnv.DOCKER_SOCKET_PATHS = undefined;
|
||||
mockEnv.DOCKER_HOSTNAMES = undefined;
|
||||
mockEnv.DOCKER_PORTS = undefined;
|
||||
});
|
||||
|
||||
test("should return default socket when no env vars set", () => {
|
||||
const instances = DockerSingleton.getInstances();
|
||||
|
||||
expect(instances).toHaveLength(1);
|
||||
expect(instances[0]?.host).toBe("socket");
|
||||
});
|
||||
|
||||
test("should return TCP instances only when DOCKER_HOSTNAMES and DOCKER_PORTS set", () => {
|
||||
mockEnv.DOCKER_HOSTNAMES = "remote-host";
|
||||
mockEnv.DOCKER_PORTS = "2375";
|
||||
|
||||
const instances = DockerSingleton.getInstances();
|
||||
|
||||
expect(instances).toHaveLength(1);
|
||||
expect(instances[0]?.host).toBe("remote-host:2375");
|
||||
});
|
||||
|
||||
test("should return multiple TCP instances", () => {
|
||||
mockEnv.DOCKER_HOSTNAMES = "host1,host2";
|
||||
mockEnv.DOCKER_PORTS = "2375,2376";
|
||||
|
||||
const instances = DockerSingleton.getInstances();
|
||||
|
||||
expect(instances).toHaveLength(2);
|
||||
expect(instances[0]?.host).toBe("host1:2375");
|
||||
expect(instances[1]?.host).toBe("host2:2376");
|
||||
});
|
||||
|
||||
test("should throw when hostname and port counts do not match", () => {
|
||||
mockEnv.DOCKER_HOSTNAMES = "host1,host2";
|
||||
mockEnv.DOCKER_PORTS = "2375";
|
||||
|
||||
expect(() => DockerSingleton.getInstances()).toThrow("The number of hosts and ports must match");
|
||||
});
|
||||
|
||||
test("should return socket instances when DOCKER_SOCKET_PATHS set", () => {
|
||||
mockEnv.DOCKER_SOCKET_PATHS = "/var/run/docker.sock";
|
||||
|
||||
const instances = DockerSingleton.getInstances();
|
||||
|
||||
expect(instances).toHaveLength(1);
|
||||
expect(instances[0]?.host).toBe("/var/run/docker.sock");
|
||||
});
|
||||
|
||||
test("should return multiple socket instances", () => {
|
||||
mockEnv.DOCKER_SOCKET_PATHS = "/var/run/docker.sock,/run/user/1000/podman/podman.sock";
|
||||
|
||||
const instances = DockerSingleton.getInstances();
|
||||
|
||||
expect(instances).toHaveLength(2);
|
||||
expect(instances[0]?.host).toBe("/var/run/docker.sock");
|
||||
expect(instances[1]?.host).toBe("/run/user/1000/podman/podman.sock");
|
||||
});
|
||||
|
||||
test("should combine socket and TCP instances", () => {
|
||||
mockEnv.DOCKER_SOCKET_PATHS = "/var/run/docker.sock,/run/user/1000/podman/podman.sock";
|
||||
mockEnv.DOCKER_HOSTNAMES = "remote-host";
|
||||
mockEnv.DOCKER_PORTS = "2375";
|
||||
|
||||
const instances = DockerSingleton.getInstances();
|
||||
|
||||
expect(instances).toHaveLength(3);
|
||||
expect(instances[0]?.host).toBe("/var/run/docker.sock");
|
||||
expect(instances[1]?.host).toBe("/run/user/1000/podman/podman.sock");
|
||||
expect(instances[2]?.host).toBe("remote-host:2375");
|
||||
});
|
||||
|
||||
test("should cache instances on subsequent calls", () => {
|
||||
const first = DockerSingleton.getInstances();
|
||||
const second = DockerSingleton.getInstances();
|
||||
|
||||
expect(first).toBe(second);
|
||||
});
|
||||
});
|
||||
@@ -90,10 +90,18 @@ export class QBitTorrentIntegration extends Integration implements IDownloadClie
|
||||
}
|
||||
|
||||
private async getClientAsync(dispatcher?: Dispatcher) {
|
||||
const credentials = this.hasSecretValue("apiKey")
|
||||
? {
|
||||
apiKey: this.getSecretValue("apiKey"),
|
||||
}
|
||||
: {
|
||||
username: this.getSecretValue("username"),
|
||||
password: this.getSecretValue("password"),
|
||||
};
|
||||
|
||||
return new QBittorrent({
|
||||
...credentials,
|
||||
baseUrl: this.url("/").toString(),
|
||||
username: this.getSecretValue("username"),
|
||||
password: this.getSecretValue("password"),
|
||||
dispatcher: dispatcher ?? (await createCertificateAgentAsync()),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { isAbsoluteUrl } from "@homarr/common";
|
||||
import { ResponseError } from "@homarr/common/server";
|
||||
import { fetchWithTrustedCertificatesAsync } from "@homarr/core/infrastructure/http";
|
||||
import { ImageProxy } from "@homarr/image-proxy";
|
||||
@@ -85,10 +86,10 @@ export class TracearrIntegration extends Integration {
|
||||
data: await Promise.all(
|
||||
json.data.map(async (stream) => {
|
||||
if (stream.userAvatarUrl) {
|
||||
stream.userAvatarUrl = await this.proxyImageAsync(imageProxy, stream.userAvatarUrl, stream.id, "avatar");
|
||||
stream.userAvatarUrl = await this.proxyImageAsync(imageProxy, stream.userAvatarUrl);
|
||||
}
|
||||
if (stream.posterUrl) {
|
||||
stream.posterUrl = await this.proxyImageAsync(imageProxy, stream.posterUrl, stream.id, "poster");
|
||||
stream.posterUrl = await this.proxyImageAsync(imageProxy, stream.posterUrl);
|
||||
}
|
||||
return stream;
|
||||
}),
|
||||
@@ -120,12 +121,7 @@ export class TracearrIntegration extends Integration {
|
||||
...json,
|
||||
data: await Promise.all(
|
||||
json.data.map(async (violation) => {
|
||||
violation.user.avatarUrl = await this.proxyImageAsync(
|
||||
imageProxy,
|
||||
violation.user.avatarUrl,
|
||||
violation.user.id,
|
||||
"avatar",
|
||||
);
|
||||
violation.user.avatarUrl = await this.proxyImageAsync(imageProxy, violation.user.avatarUrl);
|
||||
return violation;
|
||||
}),
|
||||
),
|
||||
@@ -156,12 +152,7 @@ export class TracearrIntegration extends Integration {
|
||||
...json,
|
||||
data: await Promise.all(
|
||||
json.data.map(async (session) => {
|
||||
session.user.avatarUrl = await this.proxyImageAsync(
|
||||
imageProxy,
|
||||
session.user.avatarUrl,
|
||||
session.user.id,
|
||||
"avatar",
|
||||
);
|
||||
session.user.avatarUrl = await this.proxyImageAsync(imageProxy, session.user.avatarUrl);
|
||||
return session;
|
||||
}),
|
||||
),
|
||||
@@ -194,23 +185,12 @@ export class TracearrIntegration extends Integration {
|
||||
};
|
||||
}
|
||||
|
||||
private async proxyImageAsync(
|
||||
imageProxy: ImageProxy,
|
||||
url: string | null | undefined,
|
||||
uniqueId: string,
|
||||
discriminator: string,
|
||||
): Promise<string | null> {
|
||||
if (!url) return null;
|
||||
private async proxyImageAsync(imageProxy: ImageProxy, urlOrPath: string | null | undefined): Promise<string | null> {
|
||||
if (!urlOrPath) return null;
|
||||
try {
|
||||
// ImageProxy doesn't support fallback urls so we need to remove them
|
||||
const cleanUrl = url.replace(/&fallback=[^&]+/, "").replace(/\?fallback=[^&]+&?/, "?");
|
||||
// Build the full URL, then inject _uid as the FIRST query param.
|
||||
// This is critical because ImageProxy uses bcrypt which truncates at 72 bytes.
|
||||
// Without this, all long avatar/poster URLs from the same session hash identically
|
||||
// since they share the same first 72+ bytes.
|
||||
const baseUrl = this.url(cleanUrl as `/${string}`).toString();
|
||||
const prefix = `_uid=${discriminator}_${uniqueId}&`;
|
||||
const fullUrl = baseUrl.includes("?") ? baseUrl.replace("?", `?${prefix}`) : `${baseUrl}?${prefix}`;
|
||||
const cleanUrl = urlOrPath.replace(/&fallback=[^&]+/, "").replace(/\?fallback=[^&]+&?/, "?");
|
||||
const fullUrl = isAbsoluteUrl(urlOrPath) ? cleanUrl : this.url(cleanUrl as `/${string}`).toString();
|
||||
|
||||
return await imageProxy.createImageAsync(fullUrl, this.getAuthHeaders());
|
||||
} catch {
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
import { beforeEach, describe, expect, test, vi } from "vitest";
|
||||
|
||||
import { ChannelSubscriptionTracker } from "./channel-subscription-tracker";
|
||||
import { createRedisConnection } from "./connection";
|
||||
|
||||
const mockRedisClient = {
|
||||
subscribe: vi.fn().mockResolvedValue("OK"),
|
||||
unsubscribe: vi.fn().mockResolvedValue("OK"),
|
||||
on: vi.fn(),
|
||||
};
|
||||
|
||||
vi.mock("@homarr/core/infrastructure/logs", () => ({
|
||||
createLogger: () => ({ debug: vi.fn(), warn: vi.fn() }),
|
||||
}));
|
||||
|
||||
vi.mock("./connection", () => ({
|
||||
createRedisConnection: vi.fn(() => mockRedisClient),
|
||||
}));
|
||||
|
||||
describe("ChannelSubscriptionTracker", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
// Reset static state between tests
|
||||
// @ts-expect-error accessing private static for test reset
|
||||
ChannelSubscriptionTracker.subscriptions = new Map();
|
||||
// @ts-expect-error accessing private static for test reset
|
||||
ChannelSubscriptionTracker._redis = undefined;
|
||||
// @ts-expect-error accessing private static for test reset
|
||||
ChannelSubscriptionTracker.listenerActive = false;
|
||||
});
|
||||
|
||||
test("redis client is lazily created on first subscribe", () => {
|
||||
vi.mocked(createRedisConnection).mockClear();
|
||||
|
||||
ChannelSubscriptionTracker.subscribe("channel-1", vi.fn());
|
||||
|
||||
expect(createRedisConnection).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test("redis client is reused across multiple subscribes", () => {
|
||||
vi.mocked(createRedisConnection).mockClear();
|
||||
|
||||
ChannelSubscriptionTracker.subscribe("channel-1", vi.fn());
|
||||
ChannelSubscriptionTracker.subscribe("channel-2", vi.fn());
|
||||
|
||||
expect(createRedisConnection).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test("subscribes to redis channel on first callback for a channel", () => {
|
||||
ChannelSubscriptionTracker.subscribe("test-channel", vi.fn());
|
||||
|
||||
expect(mockRedisClient.subscribe).toHaveBeenCalledWith("test-channel");
|
||||
});
|
||||
|
||||
test("does not re-subscribe when adding second callback to same channel", () => {
|
||||
ChannelSubscriptionTracker.subscribe("test-channel", vi.fn());
|
||||
mockRedisClient.subscribe.mockClear();
|
||||
|
||||
ChannelSubscriptionTracker.subscribe("test-channel", vi.fn());
|
||||
|
||||
expect(mockRedisClient.subscribe).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("unsubscribe function removes the callback", () => {
|
||||
const unsubscribe = ChannelSubscriptionTracker.subscribe("test-channel", vi.fn());
|
||||
|
||||
unsubscribe();
|
||||
|
||||
expect(mockRedisClient.unsubscribe).toHaveBeenCalledWith("test-channel");
|
||||
});
|
||||
|
||||
test("does not unsubscribe from redis if other callbacks remain", () => {
|
||||
ChannelSubscriptionTracker.subscribe("test-channel", vi.fn());
|
||||
const unsubscribe = ChannelSubscriptionTracker.subscribe("test-channel", vi.fn());
|
||||
|
||||
unsubscribe();
|
||||
|
||||
expect(mockRedisClient.unsubscribe).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("activates message listener only once", () => {
|
||||
ChannelSubscriptionTracker.subscribe("ch-1", vi.fn());
|
||||
ChannelSubscriptionTracker.subscribe("ch-2", vi.fn());
|
||||
|
||||
expect(mockRedisClient.on).toHaveBeenCalledTimes(1);
|
||||
expect(mockRedisClient.on).toHaveBeenCalledWith("message", expect.any(Function));
|
||||
});
|
||||
|
||||
test("message listener dispatches to correct channel callbacks", () => {
|
||||
const callback1 = vi.fn();
|
||||
const callback2 = vi.fn();
|
||||
ChannelSubscriptionTracker.subscribe("channel-a", callback1);
|
||||
ChannelSubscriptionTracker.subscribe("channel-b", callback2);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const messageHandler = mockRedisClient.on.mock.calls[0]![1] as (channel: string, message: string) => void;
|
||||
messageHandler("channel-a", "test-message");
|
||||
|
||||
expect(callback1).toHaveBeenCalledWith("test-message");
|
||||
expect(callback2).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
@@ -2,6 +2,7 @@ import { randomUUID } from "crypto";
|
||||
|
||||
import type { MaybePromise } from "@homarr/common/types";
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import type { RedisClient } from "@homarr/core/infrastructure/redis";
|
||||
|
||||
import { createRedisConnection } from "./connection";
|
||||
|
||||
@@ -18,7 +19,10 @@ type SubscriptionCallback = (message: string) => MaybePromise<void>;
|
||||
*/
|
||||
export class ChannelSubscriptionTracker {
|
||||
private static subscriptions = new Map<string, Map<string, SubscriptionCallback>>();
|
||||
private static redis = createRedisConnection();
|
||||
private static _redis: RedisClient | undefined;
|
||||
private static get redis() {
|
||||
return (this._redis ??= createRedisConnection());
|
||||
}
|
||||
private static listenerActive = false;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
import { beforeEach, describe, expect, test, vi } from "vitest";
|
||||
|
||||
import {
|
||||
createCacheChannel,
|
||||
createGetSetChannel,
|
||||
createListChannel,
|
||||
createSubPubChannel,
|
||||
handshakeAsync,
|
||||
} from "./channel";
|
||||
import { createRedisConnection } from "./connection";
|
||||
|
||||
const mockRedisClient = {
|
||||
get: vi.fn().mockResolvedValue(null),
|
||||
set: vi.fn().mockResolvedValue("OK"),
|
||||
del: vi.fn().mockResolvedValue(1),
|
||||
publish: vi.fn().mockResolvedValue(1),
|
||||
lrange: vi.fn().mockResolvedValue([]),
|
||||
lrem: vi.fn().mockResolvedValue(0),
|
||||
lpush: vi.fn().mockResolvedValue(1),
|
||||
ltrim: vi.fn().mockResolvedValue("OK"),
|
||||
llen: vi.fn().mockResolvedValue(0),
|
||||
hello: vi.fn().mockResolvedValue({}),
|
||||
subscribe: vi.fn().mockResolvedValue("OK"),
|
||||
on: vi.fn(),
|
||||
};
|
||||
|
||||
vi.mock("@homarr/core/infrastructure/logs", () => ({
|
||||
createLogger: () => ({ debug: vi.fn(), warn: vi.fn(), error: vi.fn(), info: vi.fn() }),
|
||||
}));
|
||||
|
||||
vi.mock("./connection", () => ({
|
||||
createRedisConnection: vi.fn(() => mockRedisClient),
|
||||
}));
|
||||
|
||||
vi.mock("./channel-subscription-tracker", () => ({
|
||||
ChannelSubscriptionTracker: {
|
||||
subscribe: vi.fn(() => vi.fn()),
|
||||
},
|
||||
}));
|
||||
|
||||
describe("channel lazy initialization", () => {
|
||||
beforeEach(() => {
|
||||
vi.mocked(createRedisConnection).mockClear();
|
||||
});
|
||||
|
||||
test("getSetClient is lazily created on first channel operation", async () => {
|
||||
vi.mocked(createRedisConnection).mockClear();
|
||||
|
||||
const channel = createGetSetChannel<string>("test-lazy");
|
||||
expect(createRedisConnection).not.toHaveBeenCalled();
|
||||
|
||||
await channel.getAsync();
|
||||
|
||||
expect(createRedisConnection).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("publisher is lazily created on first publish", async () => {
|
||||
const channel = createSubPubChannel<string>("test-pub", { persist: false });
|
||||
|
||||
const callsBefore = vi.mocked(createRedisConnection).mock.calls.length;
|
||||
await channel.publishAsync("hello");
|
||||
|
||||
expect(vi.mocked(createRedisConnection).mock.calls.length).toBeGreaterThan(callsBefore);
|
||||
});
|
||||
|
||||
test("handshakeAsync creates a client and calls hello", async () => {
|
||||
await handshakeAsync();
|
||||
|
||||
expect(mockRedisClient.hello).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
|
||||
describe("createSubPubChannel", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test("publishAsync persists data and publishes", async () => {
|
||||
const channel = createSubPubChannel<{ value: number }>("test-channel");
|
||||
|
||||
await channel.publishAsync({ value: 42 });
|
||||
|
||||
expect(mockRedisClient.set).toHaveBeenCalledOnce();
|
||||
expect(mockRedisClient.publish).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test("publishAsync with persist:false skips set", async () => {
|
||||
const channel = createSubPubChannel<string>("no-persist", { persist: false });
|
||||
|
||||
await channel.publishAsync("data");
|
||||
|
||||
expect(mockRedisClient.set).not.toHaveBeenCalled();
|
||||
expect(mockRedisClient.publish).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test("getLastDataAsync returns null when no data", async () => {
|
||||
const channel = createSubPubChannel<string>("empty");
|
||||
|
||||
const result = await channel.getLastDataAsync();
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("createListChannel", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test("addAsync pushes to list", async () => {
|
||||
const channel = createListChannel<string>("test-list");
|
||||
|
||||
await channel.addAsync("item1");
|
||||
|
||||
expect(mockRedisClient.lpush).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
test("clearAsync deletes the list", async () => {
|
||||
const channel = createListChannel<string>("test-list");
|
||||
|
||||
await channel.clearAsync();
|
||||
|
||||
expect(mockRedisClient.del).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
|
||||
describe("createCacheChannel", () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test("invalidateAsync deletes the cache key", async () => {
|
||||
const channel = createCacheChannel<string>("test-cache");
|
||||
|
||||
await channel.invalidateAsync();
|
||||
|
||||
expect(mockRedisClient.del).toHaveBeenCalledWith("cache:test-cache");
|
||||
});
|
||||
|
||||
test("getAsync returns null when no cached data", async () => {
|
||||
const channel = createCacheChannel<string>("test-cache");
|
||||
|
||||
const result = await channel.getAsync();
|
||||
|
||||
expect(result).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -2,6 +2,7 @@ import superjson from "superjson";
|
||||
|
||||
import { createId, hashObjectBase64 } from "@homarr/common";
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import type { RedisClient } from "@homarr/core/infrastructure/redis";
|
||||
import type { WidgetKind } from "@homarr/definitions";
|
||||
|
||||
import { ChannelSubscriptionTracker } from "./channel-subscription-tracker";
|
||||
@@ -9,8 +10,11 @@ import { createRedisConnection } from "./connection";
|
||||
|
||||
const logger = createLogger({ module: "redisChannel" });
|
||||
|
||||
const publisher = createRedisConnection();
|
||||
const lastDataClient = createRedisConnection();
|
||||
let _publisher: RedisClient | undefined;
|
||||
const getPublisher = () => (_publisher ??= createRedisConnection());
|
||||
|
||||
let _lastDataClient: RedisClient | undefined;
|
||||
const getLastDataClient = () => (_lastDataClient ??= createRedisConnection());
|
||||
|
||||
/**
|
||||
* Creates a new pub/sub channel.
|
||||
@@ -27,34 +31,33 @@ export const createSubPubChannel = <TData>(name: string, { persist }: { persist:
|
||||
*/
|
||||
subscribe: (callback: (data: TData) => void) => {
|
||||
if (persist) {
|
||||
void lastDataClient.get(lastChannelName).then((data) => {
|
||||
if (data) {
|
||||
callback(superjson.parse(data));
|
||||
}
|
||||
});
|
||||
void getLastDataClient()
|
||||
.get(lastChannelName)
|
||||
.then((data) => {
|
||||
if (data) {
|
||||
callback(superjson.parse(data));
|
||||
}
|
||||
});
|
||||
}
|
||||
return ChannelSubscriptionTracker.subscribe(channelName, (message) => {
|
||||
callback(superjson.parse(message));
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Publish data to the channel with last data saved.
|
||||
* @param data data to be published
|
||||
*/
|
||||
publishAsync: async (data: TData) => {
|
||||
if (persist) {
|
||||
await lastDataClient.set(lastChannelName, superjson.stringify(data));
|
||||
await getLastDataClient().set(lastChannelName, superjson.stringify(data));
|
||||
}
|
||||
await publisher.publish(channelName, superjson.stringify(data));
|
||||
await getPublisher().publish(channelName, superjson.stringify(data));
|
||||
},
|
||||
getLastDataAsync: async () => {
|
||||
const data = await lastDataClient.get(lastChannelName);
|
||||
const data = await getLastDataClient().get(lastChannelName);
|
||||
return data ? superjson.parse<TData>(data) : null;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const getSetClient = createRedisConnection();
|
||||
let _getSetClient: RedisClient | undefined;
|
||||
const getSetClient = () => (_getSetClient ??= createRedisConnection());
|
||||
|
||||
/**
|
||||
* Creates a new redis channel for a list
|
||||
@@ -69,7 +72,7 @@ export const createListChannel = <TItem>(name: string) => {
|
||||
* @returns an array of all items
|
||||
*/
|
||||
getAllAsync: async () => {
|
||||
const items = await getSetClient.lrange(listChannelName, 0, -1);
|
||||
const items = await getSetClient().lrange(listChannelName, 0, -1);
|
||||
return items.map((item) => superjson.parse<TItem>(item));
|
||||
},
|
||||
/**
|
||||
@@ -77,20 +80,20 @@ export const createListChannel = <TItem>(name: string) => {
|
||||
* @param item item to remove
|
||||
*/
|
||||
removeAsync: async (item: TItem) => {
|
||||
await getSetClient.lrem(listChannelName, 0, superjson.stringify(item));
|
||||
await getSetClient().lrem(listChannelName, 0, superjson.stringify(item));
|
||||
},
|
||||
/**
|
||||
* Clear all items from the channels list
|
||||
*/
|
||||
clearAsync: async () => {
|
||||
await getSetClient.del(listChannelName);
|
||||
await getSetClient().del(listChannelName);
|
||||
},
|
||||
/**
|
||||
* Add an item to the channels list
|
||||
* @param item item to add
|
||||
*/
|
||||
addAsync: async (item: TItem) => {
|
||||
await getSetClient.lpush(listChannelName, superjson.stringify(item));
|
||||
await getSetClient().lpush(listChannelName, superjson.stringify(item));
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -106,7 +109,7 @@ export const createGetSetChannel = <TData>(name: string) => {
|
||||
* @returns data or null if not found
|
||||
*/
|
||||
getAsync: async () => {
|
||||
const data = await getSetClient.get(name);
|
||||
const data = await getSetClient().get(name);
|
||||
return data ? superjson.parse<TData>(data) : null;
|
||||
},
|
||||
/**
|
||||
@@ -114,13 +117,13 @@ export const createGetSetChannel = <TData>(name: string) => {
|
||||
* @param data data to be stored in the channel
|
||||
*/
|
||||
setAsync: async (data: TData) => {
|
||||
await getSetClient.set(name, superjson.stringify(data));
|
||||
await getSetClient().set(name, superjson.stringify(data));
|
||||
},
|
||||
/**
|
||||
* Remove data from the channel
|
||||
*/
|
||||
removeAsync: async () => {
|
||||
await getSetClient.del(name);
|
||||
await getSetClient().del(name);
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -140,7 +143,7 @@ export const createCacheChannel = <TData>(name: string, cacheDurationMs: number
|
||||
* @returns data or null if not found or expired
|
||||
*/
|
||||
getAsync: async () => {
|
||||
const data = await getSetClient.get(cacheChannelName);
|
||||
const data = await getSetClient().get(cacheChannelName);
|
||||
if (!data) return null;
|
||||
|
||||
const parsedData = superjson.parse<{ data: TData; timestamp: Date }>(data);
|
||||
@@ -156,13 +159,13 @@ export const createCacheChannel = <TData>(name: string, cacheDurationMs: number
|
||||
* @returns data or new data if not present or expired
|
||||
*/
|
||||
consumeAsync: async (callback: () => Promise<TData>) => {
|
||||
const data = await getSetClient.get(cacheChannelName);
|
||||
const data = await getSetClient().get(cacheChannelName);
|
||||
|
||||
const getNewDataAsync = async () => {
|
||||
logger.debug(`Cache miss for channel '${cacheChannelName}'`);
|
||||
const newData = await callback();
|
||||
const result = { data: newData, timestamp: new Date() };
|
||||
await getSetClient.set(cacheChannelName, superjson.stringify(result));
|
||||
await getSetClient().set(cacheChannelName, superjson.stringify(result));
|
||||
logger.debug(`Cache updated for channel '${cacheChannelName}'`);
|
||||
return result;
|
||||
};
|
||||
@@ -187,14 +190,14 @@ export const createCacheChannel = <TData>(name: string, cacheDurationMs: number
|
||||
* Invalidate the cache channels data.
|
||||
*/
|
||||
invalidateAsync: async () => {
|
||||
await getSetClient.del(cacheChannelName);
|
||||
await getSetClient().del(cacheChannelName);
|
||||
},
|
||||
/**
|
||||
* Set the data in the cache channel.
|
||||
* @param data data to be stored in the cache channel
|
||||
*/
|
||||
setAsync: async (data: TData) => {
|
||||
await getSetClient.set(cacheChannelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await getSetClient().set(cacheChannelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -236,12 +239,12 @@ export const createChannelEventHistory = <TData>(channelName: string, maxElement
|
||||
});
|
||||
},
|
||||
pushAsync: async (data: TData, options = { publish: false }) => {
|
||||
if (options.publish) await publisher.publish(channelName, superjson.stringify(data));
|
||||
await getSetClient.lpush(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await getSetClient.ltrim(channelName, 0, maxElements);
|
||||
if (options.publish) await getPublisher().publish(channelName, superjson.stringify(data));
|
||||
await getSetClient().lpush(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await getSetClient().ltrim(channelName, 0, maxElements);
|
||||
},
|
||||
clearAsync: async () => {
|
||||
await getSetClient.del(channelName);
|
||||
await getSetClient().del(channelName);
|
||||
},
|
||||
/**
|
||||
* Returns a slice of the available data in the channel.
|
||||
@@ -250,17 +253,17 @@ export const createChannelEventHistory = <TData>(channelName: string, maxElement
|
||||
* @param endIndex End index of the slice, negative values are counted from the end, defaults at end of range.
|
||||
*/
|
||||
getSliceAsync: async (startIndex = 0, endIndex = -1) => {
|
||||
const range = await getSetClient.lrange(channelName, startIndex, endIndex);
|
||||
const range = await getSetClient().lrange(channelName, startIndex, endIndex);
|
||||
return range.map((item) => superjson.parse<{ data: TData; timestamp: Date }>(item));
|
||||
},
|
||||
getSliceUntilTimeAsync: async (time: Date) => {
|
||||
const itemsInCollection = await getSetClient.lrange(channelName, 0, -1);
|
||||
const itemsInCollection = await getSetClient().lrange(channelName, 0, -1);
|
||||
return itemsInCollection
|
||||
.map((item) => superjson.parse<{ data: TData; timestamp: Date }>(item))
|
||||
.filter((item) => item.timestamp < time);
|
||||
},
|
||||
getLengthAsync: async () => {
|
||||
return await getSetClient.llen(channelName);
|
||||
return await getSetClient().llen(channelName);
|
||||
},
|
||||
name: channelName,
|
||||
};
|
||||
@@ -271,11 +274,11 @@ export const createChannelEventHistory = <TData>(channelName: string, maxElement
|
||||
*/
|
||||
export const createChannelEventHistoryOld = <TData>(channelName: string, maxElements = 15) => {
|
||||
const popElementsOverMaxAsync = async () => {
|
||||
const length = await getSetClient.llen(channelName);
|
||||
const length = await getSetClient().llen(channelName);
|
||||
if (length <= maxElements) {
|
||||
return;
|
||||
}
|
||||
await getSetClient.ltrim(channelName, 0, maxElements - 1);
|
||||
await getSetClient().ltrim(channelName, 0, maxElements - 1);
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -285,33 +288,33 @@ export const createChannelEventHistoryOld = <TData>(channelName: string, maxElem
|
||||
});
|
||||
},
|
||||
publishAndPushAsync: async (data: TData) => {
|
||||
await publisher.publish(channelName, superjson.stringify(data));
|
||||
await getSetClient.lpush(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await getPublisher().publish(channelName, superjson.stringify(data));
|
||||
await getSetClient().lpush(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await popElementsOverMaxAsync();
|
||||
},
|
||||
pushAsync: async (data: TData) => {
|
||||
await getSetClient.lpush(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await getSetClient().lpush(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await popElementsOverMaxAsync();
|
||||
},
|
||||
clearAsync: async () => {
|
||||
await getSetClient.del(channelName);
|
||||
await getSetClient().del(channelName);
|
||||
},
|
||||
getLastAsync: async () => {
|
||||
const length = await getSetClient.llen(channelName);
|
||||
const data = await getSetClient.lrange(channelName, length - 1, length);
|
||||
const length = await getSetClient().llen(channelName);
|
||||
const data = await getSetClient().lrange(channelName, length - 1, length);
|
||||
if (data.length !== 1) return null;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
return superjson.parse<{ data: TData; timestamp: Date }>(data[0]!);
|
||||
},
|
||||
getSliceAsync: async (startIndex: number, endIndex: number) => {
|
||||
const range = await getSetClient.lrange(channelName, startIndex, endIndex);
|
||||
const range = await getSetClient().lrange(channelName, startIndex, endIndex);
|
||||
return range.map((item) => superjson.parse<{ data: TData; timestamp: Date }>(item));
|
||||
},
|
||||
getSliceUntilTimeAsync: async (time: Date) => {
|
||||
const length = await getSetClient.llen(channelName);
|
||||
const length = await getSetClient().llen(channelName);
|
||||
const items: TData[] = [];
|
||||
const itemsInCollection = await getSetClient.lrange(channelName, 0, length - 1);
|
||||
const itemsInCollection = await getSetClient().lrange(channelName, 0, length - 1);
|
||||
|
||||
for (let i = 0; i < length - 1; i++) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
@@ -324,7 +327,7 @@ export const createChannelEventHistoryOld = <TData>(channelName: string, maxElem
|
||||
return items;
|
||||
},
|
||||
getLengthAsync: async () => {
|
||||
return await getSetClient.llen(channelName);
|
||||
return await getSetClient().llen(channelName);
|
||||
},
|
||||
name: channelName,
|
||||
};
|
||||
@@ -338,14 +341,14 @@ export const createChannelWithLatestAndEvents = <TData>(channelName: string) =>
|
||||
});
|
||||
},
|
||||
publishAndUpdateLastStateAsync: async (data: TData) => {
|
||||
await publisher.publish(channelName, superjson.stringify(data));
|
||||
await getSetClient.set(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await getPublisher().publish(channelName, superjson.stringify(data));
|
||||
await getSetClient().set(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
},
|
||||
setAsync: async (data: TData) => {
|
||||
await getSetClient.set(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
await getSetClient().set(channelName, superjson.stringify({ data, timestamp: new Date() }));
|
||||
},
|
||||
getAsync: async () => {
|
||||
const data = await getSetClient.get(channelName);
|
||||
const data = await getSetClient().get(channelName);
|
||||
if (!data) return null;
|
||||
|
||||
return superjson.parse<{ data: TData; timestamp: Date }>(data);
|
||||
@@ -354,7 +357,8 @@ export const createChannelWithLatestAndEvents = <TData>(channelName: string) =>
|
||||
};
|
||||
};
|
||||
|
||||
const queueClient = createRedisConnection();
|
||||
let _queueClient: RedisClient | undefined;
|
||||
const getQueueClient = () => (_queueClient ??= createRedisConnection());
|
||||
|
||||
type WithId<TItem> = TItem & { _id: string };
|
||||
|
||||
@@ -366,11 +370,11 @@ type WithId<TItem> = TItem & { _id: string };
|
||||
export const createQueueChannel = <TItem>(name: string) => {
|
||||
const queueChannelName = `queue:${name}`;
|
||||
const getDataAsync = async () => {
|
||||
const data = await queueClient.get(queueChannelName);
|
||||
const data = await getQueueClient().get(queueChannelName);
|
||||
return data ? superjson.parse<WithId<TItem>[]>(data) : [];
|
||||
};
|
||||
const setDataAsync = async (data: WithId<TItem>[]) => {
|
||||
await queueClient.set(queueChannelName, superjson.stringify(data));
|
||||
await getQueueClient().set(queueChannelName, superjson.stringify(data));
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -417,5 +421,5 @@ export const createQueueChannel = <TItem>(name: string) => {
|
||||
};
|
||||
|
||||
export const handshakeAsync = async () => {
|
||||
await getSetClient.hello();
|
||||
await getSetClient().hello();
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
import { describe, expect, test, vi } from "vitest";
|
||||
|
||||
import { createRedisClient } from "@homarr/core/infrastructure/redis";
|
||||
|
||||
import { createRedisConnection } from "./connection";
|
||||
|
||||
const mockRedisInstance = { ping: vi.fn() };
|
||||
|
||||
vi.mock("@homarr/core/infrastructure/redis", () => ({
|
||||
createRedisClient: vi.fn(() => mockRedisInstance),
|
||||
}));
|
||||
|
||||
describe("createRedisConnection", () => {
|
||||
test("returns a redis client regardless of CI env", () => {
|
||||
const original = process.env.CI;
|
||||
process.env.CI = "true";
|
||||
|
||||
const client = createRedisConnection();
|
||||
|
||||
expect(client).toBe(mockRedisInstance);
|
||||
expect(client).not.toBeNull();
|
||||
|
||||
process.env.CI = original;
|
||||
});
|
||||
|
||||
test("returns a redis client when DISABLE_REDIS_LOGS is set", () => {
|
||||
const original = process.env.DISABLE_REDIS_LOGS;
|
||||
process.env.DISABLE_REDIS_LOGS = "true";
|
||||
|
||||
const client = createRedisConnection();
|
||||
|
||||
expect(client).toBe(mockRedisInstance);
|
||||
expect(client).not.toBeNull();
|
||||
|
||||
process.env.DISABLE_REDIS_LOGS = original;
|
||||
});
|
||||
|
||||
test("always delegates to createRedisClient", () => {
|
||||
vi.mocked(createRedisClient).mockClear();
|
||||
|
||||
createRedisConnection();
|
||||
|
||||
expect(createRedisClient).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
@@ -1,15 +1,3 @@
|
||||
import type { RedisClient } from "@homarr/core/infrastructure/redis";
|
||||
import { createRedisClient } from "@homarr/core/infrastructure/redis";
|
||||
|
||||
/**
|
||||
* Creates a new Redis connection
|
||||
* @returns redis client
|
||||
*/
|
||||
export const createRedisConnection = () => {
|
||||
if (Boolean(process.env.CI) || Boolean(process.env.DISABLE_REDIS_LOGS)) {
|
||||
// Return null if we are in CI as we don't want to connect to Redis
|
||||
return null as unknown as RedisClient;
|
||||
}
|
||||
|
||||
return createRedisClient();
|
||||
};
|
||||
export const createRedisConnection = () => createRedisClient();
|
||||
@@ -2,6 +2,9 @@ import dayjs from "dayjs";
|
||||
import type { ContainerInfo, ContainerStats } from "dockerode";
|
||||
import type Dockerode from "dockerode";
|
||||
|
||||
import { bestMatch } from "@homarr/common";
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
|
||||
import { db, like, or } from "@homarr/db";
|
||||
import { icons } from "@homarr/db/schema";
|
||||
import type { ContainerState } from "@homarr/docker";
|
||||
@@ -9,6 +12,8 @@ import { dockerLabels, DockerSingleton } from "@homarr/docker";
|
||||
|
||||
import { createCachedWidgetRequestHandler } from "./lib/cached-widget-request-handler";
|
||||
|
||||
const logger = createLogger({ module: "dockerRequestHandler" });
|
||||
|
||||
export const dockerContainersRequestHandler = createCachedWidgetRequestHandler({
|
||||
queryKey: "dockerContainersResult",
|
||||
widgetKind: "dockerContainers",
|
||||
@@ -18,19 +23,34 @@ export const dockerContainersRequestHandler = createCachedWidgetRequestHandler({
|
||||
cacheDuration: dayjs.duration(20, "seconds"),
|
||||
});
|
||||
|
||||
const dockerInstances = DockerSingleton.getInstances();
|
||||
|
||||
const extractImage = (container: ContainerInfo) => container.Image.split("/").at(-1)?.split(":").at(0) ?? "";
|
||||
|
||||
async function getContainersWithStatsAsync() {
|
||||
const containers = await Promise.all(
|
||||
const dockerInstances = DockerSingleton.getInstances();
|
||||
const results = await Promise.allSettled(
|
||||
dockerInstances.map(async ({ instance, host }) => {
|
||||
const instanceContainers = await instance.listContainers({ all: true });
|
||||
return instanceContainers
|
||||
.filter((container) => !(dockerLabels.hide in container.Labels))
|
||||
.map((container) => ({ ...container, instance: host }));
|
||||
}),
|
||||
).then((res) => res.flat());
|
||||
);
|
||||
|
||||
const containers = results.flatMap((result, index) => {
|
||||
if (result.status === "fulfilled") return result.value;
|
||||
logger.warn(
|
||||
new ErrorWithMetadata(
|
||||
"Failed to list containers from Docker host",
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
host: dockerInstances[index]!.host,
|
||||
},
|
||||
{ cause: result.reason },
|
||||
),
|
||||
);
|
||||
|
||||
return [];
|
||||
});
|
||||
const likeQueries = containers.map((container) => like(icons.name, `%${extractImage(container)}%`));
|
||||
|
||||
const dbIcons =
|
||||
@@ -44,8 +64,6 @@ async function getContainersWithStatsAsync() {
|
||||
const instance = dockerInstances.find(({ host }) => host === container.instance)?.instance;
|
||||
if (!instance) return null;
|
||||
|
||||
// Get stats, falling back to an empty stats object if fetch fails
|
||||
// calculateCpuUsage and calculateMemoryUsage will return 0 for invalid/missing stats
|
||||
const stats = await instance
|
||||
.getContainer(container.Id)
|
||||
.stats({ stream: false, "one-shot": true })
|
||||
@@ -63,13 +81,9 @@ async function getContainersWithStatsAsync() {
|
||||
return {
|
||||
id: container.Id,
|
||||
name: container.Names[0]?.split("/")[1] ?? "Unknown",
|
||||
host: container.instance,
|
||||
state: container.State as ContainerState,
|
||||
iconUrl:
|
||||
dbIcons.find((icon) => {
|
||||
const extractedImage = extractImage(container);
|
||||
if (!extractedImage) return false;
|
||||
return icon.name.toLowerCase().includes(extractedImage.toLowerCase());
|
||||
})?.url ?? null,
|
||||
iconUrl: bestMatch(extractImage(container), dbIcons, (icon) => icon.name)?.url ?? null,
|
||||
cpuUsage,
|
||||
memoryUsage,
|
||||
image: container.Image,
|
||||
@@ -80,9 +94,10 @@ async function getContainersWithStatsAsync() {
|
||||
return (await Promise.all(containerStatsPromises)).filter((container) => container !== null);
|
||||
}
|
||||
|
||||
function calculateCpuUsage(stats: ContainerStats): number {
|
||||
// Handle containers with missing or invalid stats (e.g., exited, dead containers)
|
||||
if (!stats.cpu_stats.online_cpus || stats.cpu_stats.online_cpus === 0 || !stats.cpu_stats.cpu_usage.total_usage) {
|
||||
export function calculateCpuUsage(stats: ContainerStats): number {
|
||||
// Handle containers with missing or invalid stats (e.g., exited, dead containers, Podman responses)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!stats.cpu_stats?.online_cpus || stats.cpu_stats.online_cpus === 0 || !stats.cpu_stats.cpu_usage?.total_usage) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -95,9 +110,10 @@ function calculateCpuUsage(stats: ContainerStats): number {
|
||||
return (stats.cpu_stats.cpu_usage.total_usage / usage) * numberOfCpus * 100;
|
||||
}
|
||||
|
||||
function calculateMemoryUsage(stats: ContainerStats): number {
|
||||
// Handle containers with missing or invalid stats (e.g., exited, dead containers)
|
||||
if (!stats.memory_stats.usage) {
|
||||
export function calculateMemoryUsage(stats: ContainerStats): number {
|
||||
// Handle containers with missing or invalid stats (e.g., exited, dead containers, Podman responses)
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!stats.memory_stats?.usage) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
import type { ContainerStats } from "dockerode";
|
||||
import { describe, expect, test, vi } from "vitest";
|
||||
|
||||
import { createDb } from "@homarr/db/test";
|
||||
|
||||
import { calculateCpuUsage, calculateMemoryUsage } from "../docker";
|
||||
|
||||
vi.mock("@homarr/db", async (importActual) => {
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||
const actual = await importActual<typeof import("@homarr/db")>();
|
||||
return {
|
||||
...actual,
|
||||
db: createDb(),
|
||||
};
|
||||
});
|
||||
|
||||
// Helper to create a partial stats object, cast to ContainerStats.
|
||||
// This mirrors what Podman and other Docker-compatible runtimes may return
|
||||
// at runtime, even though @types/dockerode declares all fields as required.
|
||||
const createStats = (overrides: Record<string, unknown> = {}) => overrides as unknown as ContainerStats;
|
||||
|
||||
describe("calculateCpuUsage", () => {
|
||||
test("should return 0 when cpu_stats is undefined (Podman)", () => {
|
||||
const stats = createStats({ cpu_stats: undefined });
|
||||
expect(calculateCpuUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should return 0 when online_cpus is 0", () => {
|
||||
const stats = createStats({
|
||||
cpu_stats: { online_cpus: 0, cpu_usage: { total_usage: 1000 }, system_cpu_usage: 5000 },
|
||||
});
|
||||
expect(calculateCpuUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should return 0 when online_cpus is undefined", () => {
|
||||
const stats = createStats({
|
||||
cpu_stats: { cpu_usage: { total_usage: 1000 }, system_cpu_usage: 5000 },
|
||||
});
|
||||
expect(calculateCpuUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should return 0 when cpu_usage is undefined", () => {
|
||||
const stats = createStats({
|
||||
cpu_stats: { online_cpus: 4, system_cpu_usage: 5000 },
|
||||
});
|
||||
expect(calculateCpuUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should return 0 when total_usage is 0", () => {
|
||||
const stats = createStats({
|
||||
cpu_stats: { online_cpus: 4, cpu_usage: { total_usage: 0 }, system_cpu_usage: 5000 },
|
||||
});
|
||||
expect(calculateCpuUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should return 0 when system_cpu_usage is 0", () => {
|
||||
const stats = createStats({
|
||||
cpu_stats: { online_cpus: 4, cpu_usage: { total_usage: 1000 }, system_cpu_usage: 0 },
|
||||
});
|
||||
expect(calculateCpuUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should calculate correct CPU percentage for valid stats", () => {
|
||||
const stats = createStats({
|
||||
cpu_stats: { online_cpus: 4, cpu_usage: { total_usage: 2000 }, system_cpu_usage: 10000 },
|
||||
});
|
||||
// (2000 / 10000) * 4 * 100 = 80
|
||||
expect(calculateCpuUsage(stats)).toBe(80);
|
||||
});
|
||||
|
||||
test("should handle fractional CPU usage", () => {
|
||||
const stats = createStats({
|
||||
cpu_stats: { online_cpus: 2, cpu_usage: { total_usage: 500 }, system_cpu_usage: 100000 },
|
||||
});
|
||||
// (500 / 100000) * 2 * 100 = 1
|
||||
expect(calculateCpuUsage(stats)).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("calculateMemoryUsage", () => {
|
||||
test("should return 0 when memory_stats is undefined (Podman)", () => {
|
||||
const stats = createStats({ memory_stats: undefined });
|
||||
expect(calculateMemoryUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should return 0 when memory_stats.usage is 0", () => {
|
||||
const stats = createStats({ memory_stats: { usage: 0 } });
|
||||
expect(calculateMemoryUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should return 0 when memory_stats.usage is undefined", () => {
|
||||
const stats = createStats({ memory_stats: {} });
|
||||
expect(calculateMemoryUsage(stats)).toBe(0);
|
||||
});
|
||||
|
||||
test("should subtract cache from usage", () => {
|
||||
const stats = createStats({
|
||||
memory_stats: { usage: 1000, stats: { cache: 200 } },
|
||||
});
|
||||
expect(calculateMemoryUsage(stats)).toBe(800);
|
||||
});
|
||||
|
||||
test("should use total_inactive_file when cache is absent", () => {
|
||||
const stats = createStats({
|
||||
memory_stats: { usage: 1000, stats: { total_inactive_file: 300 } },
|
||||
});
|
||||
expect(calculateMemoryUsage(stats)).toBe(700);
|
||||
});
|
||||
|
||||
test("should use inactive_file as last fallback", () => {
|
||||
const stats = createStats({
|
||||
memory_stats: { usage: 1000, stats: { inactive_file: 150 } },
|
||||
});
|
||||
expect(calculateMemoryUsage(stats)).toBe(850);
|
||||
});
|
||||
|
||||
test("should return raw usage when memory_stats.stats is undefined", () => {
|
||||
const stats = createStats({ memory_stats: { usage: 512 } });
|
||||
expect(calculateMemoryUsage(stats)).toBe(512);
|
||||
});
|
||||
});
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": ""
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
"label": "在新标签页中打开搜索结果"
|
||||
},
|
||||
"ddgBangs": {
|
||||
"label": ""
|
||||
"label": "启用 DuckDuckGo bangs"
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
@@ -252,10 +252,10 @@
|
||||
"changeDdgBangs": {
|
||||
"notification": {
|
||||
"success": {
|
||||
"message": ""
|
||||
"message": "DuckDuckGo bangs 切换成功"
|
||||
},
|
||||
"error": {
|
||||
"message": ""
|
||||
"message": "无法切换 DuckDuckGo bangs"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1093,7 +1093,7 @@
|
||||
},
|
||||
"colorScheme": {
|
||||
"options": {
|
||||
"auto": "",
|
||||
"auto": "自动",
|
||||
"light": "日间",
|
||||
"dark": "暗黑"
|
||||
}
|
||||
@@ -1540,13 +1540,13 @@
|
||||
}
|
||||
},
|
||||
"timetable": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"title": "",
|
||||
"noStation": "",
|
||||
"name": "时刻表",
|
||||
"description": "显示车站的出发时间",
|
||||
"title": "出发时间 {station}",
|
||||
"noStation": "未选择车站",
|
||||
"option": {
|
||||
"station": {
|
||||
"label": ""
|
||||
"label": "车站"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1621,11 +1621,11 @@
|
||||
}
|
||||
},
|
||||
"anchorNote": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"name": "锚点笔记",
|
||||
"description": "显示来自锚点的所选笔记",
|
||||
"option": {
|
||||
"noteId": {
|
||||
"label": ""
|
||||
"label": "笔记"
|
||||
},
|
||||
"showTitle": {
|
||||
"label": "显示标题"
|
||||
@@ -1637,16 +1637,16 @@
|
||||
"empty": "选择要显示的笔记",
|
||||
"emptyContent": "此笔记没有内容",
|
||||
"notFound": "未找到笔记",
|
||||
"noNotes": "",
|
||||
"integrationRequired": "",
|
||||
"noNotes": "未找到笔记",
|
||||
"integrationRequired": "请先选择锚点集成",
|
||||
"updatedAt": "更新时间:{date}",
|
||||
"untitled": "未命名",
|
||||
"edit": "编辑",
|
||||
"save": "保存",
|
||||
"cancel": "取消",
|
||||
"readOnlyViewer": "",
|
||||
"saveForbidden": "",
|
||||
"saveFailed": ""
|
||||
"readOnlyViewer": "您对该笔记只有查看权限,编辑已禁用。",
|
||||
"saveForbidden": "您没有编辑此笔记的权限。",
|
||||
"saveFailed": "保存此笔记失败,请重试。"
|
||||
},
|
||||
"iframe": {
|
||||
"name": "iFrame",
|
||||
@@ -1680,7 +1680,7 @@
|
||||
"label": "允许地理位置"
|
||||
},
|
||||
"allowModals": {
|
||||
"label": ""
|
||||
"label": "允许弹窗"
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
@@ -2056,156 +2056,156 @@
|
||||
}
|
||||
},
|
||||
"tracearr": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"name": "Tracearr",
|
||||
"description": "增强型媒体服务器监控,提供详细的流与转码数据",
|
||||
"option": {
|
||||
"showStreams": {
|
||||
"label": ""
|
||||
"label": "显示活跃流"
|
||||
},
|
||||
"showStats": {
|
||||
"label": ""
|
||||
"label": "显示统计摘要"
|
||||
},
|
||||
"showRecentActivity": {
|
||||
"label": ""
|
||||
"label": "显示近期活动"
|
||||
},
|
||||
"showViolations": {
|
||||
"label": ""
|
||||
"label": "显示违规记录"
|
||||
}
|
||||
},
|
||||
"stats": {
|
||||
"activeStreams": "",
|
||||
"totalUsers": "",
|
||||
"transcodes": "",
|
||||
"bandwidth": ""
|
||||
"activeStreams": "活跃流",
|
||||
"totalUsers": "总用户数",
|
||||
"transcodes": "转码数",
|
||||
"bandwidth": "带宽"
|
||||
},
|
||||
"streams": {
|
||||
"empty": "",
|
||||
"user": "",
|
||||
"media": "",
|
||||
"state": "",
|
||||
"quality": "",
|
||||
"device": "",
|
||||
"progress": "",
|
||||
"empty": "无活跃流",
|
||||
"user": "用户",
|
||||
"media": "媒体",
|
||||
"state": "状态",
|
||||
"quality": "画质",
|
||||
"device": "设备",
|
||||
"progress": "进度",
|
||||
"videoDecision": {
|
||||
"directPlay": "",
|
||||
"transcode": "",
|
||||
"directStream": ""
|
||||
"directPlay": "直接播放",
|
||||
"transcode": "转码",
|
||||
"directStream": "直接串流"
|
||||
}
|
||||
},
|
||||
"recentActivity": {
|
||||
"title": "",
|
||||
"empty": "",
|
||||
"watched": "",
|
||||
"partial": ""
|
||||
"title": "近期活动",
|
||||
"empty": "暂无近期活动",
|
||||
"watched": "已观看",
|
||||
"partial": "部分观看"
|
||||
},
|
||||
"violations": {
|
||||
"title": "",
|
||||
"empty": "",
|
||||
"rule": "",
|
||||
"user": ""
|
||||
"title": "违规记录",
|
||||
"empty": "暂无近期违规",
|
||||
"rule": "规则",
|
||||
"user": "用户"
|
||||
},
|
||||
"noSectionsEnabled": "",
|
||||
"noSectionsEnabled": "未启用任何分区",
|
||||
"error": {
|
||||
"noIntegration": "",
|
||||
"internalServerError": ""
|
||||
"noIntegration": "未配置 Tracearr 集成",
|
||||
"internalServerError": "获取 Tracearr 数据失败"
|
||||
}
|
||||
},
|
||||
"umami": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"visitors": "",
|
||||
"active": "",
|
||||
"pageviews": "",
|
||||
"visits": "",
|
||||
"bounceRate": "",
|
||||
"avgDuration": "",
|
||||
"name": "Umami 分析",
|
||||
"description": "显示来自 Umami 分析实例的访客统计",
|
||||
"visitors": "访客",
|
||||
"active": "活跃",
|
||||
"pageviews": "浏览量",
|
||||
"visits": "访问数",
|
||||
"bounceRate": "跳出率",
|
||||
"avgDuration": "平均",
|
||||
"option": {
|
||||
"websiteId": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noWebsites": "",
|
||||
"configureIntegrationFirst": ""
|
||||
"label": "网站",
|
||||
"description": "选择您的 Umami 实例所追踪的网站",
|
||||
"placeholder": "选择一个网站",
|
||||
"loading": "正在加载网站……",
|
||||
"noWebsites": "未找到网站",
|
||||
"configureIntegrationFirst": "请先添加 Umami 集成"
|
||||
},
|
||||
"timeFrame": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "时间范围",
|
||||
"description": "用于展示访客数据的时间段",
|
||||
"option": {
|
||||
"today": "",
|
||||
"24h": "",
|
||||
"7d": "",
|
||||
"30d": "",
|
||||
"month": "",
|
||||
"lastMonth": ""
|
||||
"today": "今天",
|
||||
"24h": "过去 24 小时",
|
||||
"7d": "过去 7 天",
|
||||
"30d": "过去 30 天",
|
||||
"month": "本月",
|
||||
"lastMonth": "上月"
|
||||
}
|
||||
},
|
||||
"eventName": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noEvents": "",
|
||||
"none": "",
|
||||
"configureWebsiteFirst": ""
|
||||
"label": "事件",
|
||||
"description": "显示特定事件的总发生次数",
|
||||
"placeholder": "选择一个事件",
|
||||
"loading": "正在加载事件……",
|
||||
"noEvents": "未找到事件",
|
||||
"none": "无事件",
|
||||
"configureWebsiteFirst": "请先选择网站以加载事件"
|
||||
},
|
||||
"chartType": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "图表类型",
|
||||
"description": "图表的显示样式",
|
||||
"option": {
|
||||
"bar": "",
|
||||
"sparkline": ""
|
||||
"bar": "条形图",
|
||||
"sparkline": "迷你趋势图"
|
||||
}
|
||||
},
|
||||
"chartStyle": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "图表样式",
|
||||
"description": "如何在图表中显示事件序列",
|
||||
"option": {
|
||||
"grouped": "",
|
||||
"overlay": ""
|
||||
"grouped": "并排",
|
||||
"overlay": "叠加(子集)"
|
||||
}
|
||||
},
|
||||
"viewMode": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "视图",
|
||||
"description": "组件主体中要显示的内容",
|
||||
"option": {
|
||||
"chart": "",
|
||||
"events": "",
|
||||
"topPages": "",
|
||||
"topReferrers": ""
|
||||
"chart": "图表",
|
||||
"events": "事件图表",
|
||||
"topPages": "热门页面",
|
||||
"topReferrers": "热门来源"
|
||||
}
|
||||
},
|
||||
"eventNames": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noEvents": "",
|
||||
"configureWebsiteFirst": ""
|
||||
"label": "事件",
|
||||
"description": "选择一个或多个要图表化的事件",
|
||||
"placeholder": "选择事件……",
|
||||
"loading": "正在加载事件……",
|
||||
"noEvents": "未找到事件",
|
||||
"configureWebsiteFirst": "请先选择网站以加载事件"
|
||||
},
|
||||
"topCount": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "显示数量",
|
||||
"description": "要显示的热门项目数量(最大 500)"
|
||||
}
|
||||
},
|
||||
"event": {
|
||||
"occurrences": "",
|
||||
"label": ""
|
||||
"occurrences": "事件",
|
||||
"label": "事件"
|
||||
},
|
||||
"topPages": {
|
||||
"direct": ""
|
||||
"direct": "直接"
|
||||
},
|
||||
"topReferrers": {
|
||||
"direct": ""
|
||||
"direct": "直接"
|
||||
},
|
||||
"events": {
|
||||
"selectPrompt": ""
|
||||
"selectPrompt": "选择要图表化的事件"
|
||||
},
|
||||
"error": {
|
||||
"noIntegration": "",
|
||||
"noWebsite": "",
|
||||
"noData": "",
|
||||
"internalServerError": ""
|
||||
"noIntegration": "未配置 Umami 集成",
|
||||
"noWebsite": "未配置网站",
|
||||
"noData": "无可用数据",
|
||||
"internalServerError": "获取 Umami 数据失败"
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
@@ -2304,50 +2304,50 @@
|
||||
}
|
||||
},
|
||||
"immich-serverStats": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"name": "Immich 服务器统计",
|
||||
"description": "有关您的 Immich 实例的信息",
|
||||
"option": {
|
||||
"showUsers": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "显示用户",
|
||||
"description": "显示实例上的用户数量"
|
||||
},
|
||||
"showPhotos": {
|
||||
"label": "显示图片",
|
||||
"description": ""
|
||||
"description": "显示实例上的照片数量"
|
||||
},
|
||||
"showVideos": {
|
||||
"label": "显示视频",
|
||||
"description": ""
|
||||
"description": "显示实例上的视频数量"
|
||||
},
|
||||
"showStorage": {
|
||||
"label": "显示存储",
|
||||
"description": ""
|
||||
"description": "显示已使用的总存储空间"
|
||||
}
|
||||
},
|
||||
"users": "",
|
||||
"photos": "",
|
||||
"videos": "",
|
||||
"storage": ""
|
||||
"users": "用户",
|
||||
"photos": "照片",
|
||||
"videos": "视频",
|
||||
"storage": "已用存储"
|
||||
},
|
||||
"immich-albumCarousel": {
|
||||
"name": "",
|
||||
"name": "Immich 相册",
|
||||
"option": {
|
||||
"albumId": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "相册ID",
|
||||
"description": "这是一个唯一标识符,用于指向您的 Immich 相册。您可以通过打开相册并从 URL 中复制那段唯一字符串来找到该 ID,例如:'a21aca09-9f05-47dc-b1a1-7b53c547226e'"
|
||||
},
|
||||
"rotationIntervalSeconds": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "间隔(秒)",
|
||||
"description": "每 X 秒切换一次相册中的图片。最小为 1,最大不得超过 3600。"
|
||||
},
|
||||
"showPhotoInfo": {
|
||||
"label": "显示图片信息",
|
||||
"description": ""
|
||||
"description": "在幻灯片底部显示图片日期和当前索引"
|
||||
}
|
||||
},
|
||||
"description": "",
|
||||
"noAlbumSelected": "",
|
||||
"noPhotos": ""
|
||||
"description": "Immich 相册图片幻灯片",
|
||||
"noAlbumSelected": "未选择相册,请编辑组件并选择一个相册",
|
||||
"noPhotos": "此相册中没有照片"
|
||||
},
|
||||
"downloads": {
|
||||
"name": "下载客户端",
|
||||
@@ -2658,7 +2658,7 @@
|
||||
"label": "隐藏描述"
|
||||
},
|
||||
"showPosterImage": {
|
||||
"label": ""
|
||||
"label": "显示封面图"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2873,28 +2873,28 @@
|
||||
"option": {}
|
||||
},
|
||||
"speedtestTracker": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"name": "网速测试追踪器",
|
||||
"description": "显示 网速测试追踪器 实例中的测速结果。",
|
||||
"option": {
|
||||
"showLatestResult": {
|
||||
"label": ""
|
||||
"label": "显示最新结果"
|
||||
},
|
||||
"showStats": {
|
||||
"label": ""
|
||||
"label": "显示平均值"
|
||||
},
|
||||
"showRecentResults": {
|
||||
"label": ""
|
||||
"label": "显示近期结果"
|
||||
},
|
||||
"showPingGraph": {
|
||||
"label": ""
|
||||
"label": "显示 Ping 图表"
|
||||
}
|
||||
},
|
||||
"latestResult": "",
|
||||
"averages": "",
|
||||
"tests": "",
|
||||
"recentResults": "",
|
||||
"recentResultsSpeed": "",
|
||||
"recentResultsPing": "",
|
||||
"latestResult": "最新结果",
|
||||
"averages": "平均值",
|
||||
"tests": "{count}次测试",
|
||||
"recentResults": "近期结果",
|
||||
"recentResultsSpeed": "速度",
|
||||
"recentResultsPing": "Ping",
|
||||
"download": "下载",
|
||||
"upload": "上传",
|
||||
"ping": "Ping",
|
||||
@@ -2902,13 +2902,13 @@
|
||||
"avgDownload": "平均下载",
|
||||
"avgUpload": "平均上传",
|
||||
"avgPing": "平均Ping",
|
||||
"healthy": "",
|
||||
"unhealthy": "",
|
||||
"ok": "",
|
||||
"healthy": "健康",
|
||||
"unhealthy": "不健康",
|
||||
"ok": "正常",
|
||||
"fail": "失败",
|
||||
"noSectionsEnabled": "",
|
||||
"noSectionsEnabled": "请在组件选项中至少启用一个模块。",
|
||||
"error": {
|
||||
"internalServerError": ""
|
||||
"internalServerError": "获取测速数据失败"
|
||||
}
|
||||
},
|
||||
"systemResources": {
|
||||
@@ -3680,7 +3680,7 @@
|
||||
"defaultColorScheme": {
|
||||
"label": "默认配色方案",
|
||||
"options": {
|
||||
"auto": "",
|
||||
"auto": "自动",
|
||||
"light": "日间",
|
||||
"dark": "暗黑"
|
||||
}
|
||||
@@ -3708,7 +3708,7 @@
|
||||
"label": "Minecraft 服务状态"
|
||||
},
|
||||
"timetable": {
|
||||
"label": ""
|
||||
"label": "时刻表"
|
||||
},
|
||||
"iconsUpdater": {
|
||||
"label": "图标更新"
|
||||
@@ -3780,10 +3780,10 @@
|
||||
"label": "天气"
|
||||
},
|
||||
"tracearr": {
|
||||
"label": ""
|
||||
"label": "Tracearr"
|
||||
},
|
||||
"umamiActiveVisitors": {
|
||||
"label": ""
|
||||
"label": "Umami 活跃访客"
|
||||
}
|
||||
},
|
||||
"interval": {
|
||||
@@ -3907,8 +3907,8 @@
|
||||
"subtitle": "在许多语言中,有{count}人贡献了翻译"
|
||||
},
|
||||
"sponsors": {
|
||||
"title": "",
|
||||
"subtitle": ""
|
||||
"title": "赞助商",
|
||||
"subtitle": "{count}人通过财务方式支持该项目"
|
||||
},
|
||||
"libraries": {
|
||||
"title": "相关的库",
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "端口"
|
||||
},
|
||||
"host": {
|
||||
"label": "宿主机"
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
@@ -4496,7 +4499,7 @@
|
||||
"title": "全局命令",
|
||||
"option": {
|
||||
"colorScheme": {
|
||||
"auto": "",
|
||||
"auto": "切换外观模式",
|
||||
"light": "切换到日间模式",
|
||||
"dark": "切换到暗黑模式"
|
||||
},
|
||||
@@ -4548,13 +4551,13 @@
|
||||
"group": {
|
||||
"searchEngine": {
|
||||
"title": "搜索引擎",
|
||||
"tipDdgBangs": "",
|
||||
"tipDdgBangs": "提示:你也可以在此使用任何 DuckDuckGo Bangs,例如 !something",
|
||||
"bang": {
|
||||
"searchWithQuery": "",
|
||||
"pressEnterToOpen": "",
|
||||
"engineSelected": "",
|
||||
"typeQueryToContinue": "",
|
||||
"emptyBangHint": ""
|
||||
"searchWithQuery": "使用“‘’{query}”搜索“{label}”",
|
||||
"pressEnterToOpen": "按 Enter 键打开",
|
||||
"engineSelected": "已选择{label}({bang})",
|
||||
"typeQueryToContinue": "输入搜索查询以继续",
|
||||
"emptyBangHint": "输入 bang,例如 !yt,然后按空格键进行选择"
|
||||
},
|
||||
"children": {
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "crwdns1920:0crwdne1920:0"
|
||||
},
|
||||
"host": {
|
||||
"label": "crwdns4249:0crwdne4249:0"
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Porty"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Porte"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": ""
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Ports"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Θύρες"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": ""
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Ports"
|
||||
},
|
||||
"host": {
|
||||
"label": "Host"
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Puertos"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": ""
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Ports"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "יציאות"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Portovi"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
"label": "Nyissa meg a keresési eredményeket új ablakban"
|
||||
},
|
||||
"ddgBangs": {
|
||||
"label": ""
|
||||
"label": "DuckDuckGo parancsok engedélyezése"
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
@@ -252,10 +252,10 @@
|
||||
"changeDdgBangs": {
|
||||
"notification": {
|
||||
"success": {
|
||||
"message": ""
|
||||
"message": "DuckDuckGo parancsok sikeresen bekapcsolódott"
|
||||
},
|
||||
"error": {
|
||||
"message": ""
|
||||
"message": "DuckDuckGo parancsokkat nem sikerült bekapcsolni"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1093,7 +1093,7 @@
|
||||
},
|
||||
"colorScheme": {
|
||||
"options": {
|
||||
"auto": "",
|
||||
"auto": "Automatikus",
|
||||
"light": "Világos",
|
||||
"dark": "Sötét"
|
||||
}
|
||||
@@ -2111,101 +2111,101 @@
|
||||
}
|
||||
},
|
||||
"umami": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"visitors": "",
|
||||
"active": "",
|
||||
"pageviews": "",
|
||||
"visits": "",
|
||||
"bounceRate": "",
|
||||
"avgDuration": "",
|
||||
"name": "Umami Analitika",
|
||||
"description": "Umami elemzési rendszeréből származó látogatói statisztikák megjelenítése",
|
||||
"visitors": "látogatók",
|
||||
"active": "aktív",
|
||||
"pageviews": "oldalletöltések",
|
||||
"visits": "látogatások",
|
||||
"bounceRate": "visszapattan",
|
||||
"avgDuration": "átl",
|
||||
"option": {
|
||||
"websiteId": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noWebsites": "",
|
||||
"configureIntegrationFirst": ""
|
||||
"label": "Honlap",
|
||||
"description": "Válasszon ki egy olyan webhelyet, amelyet az Ön Umami-példánya követ",
|
||||
"placeholder": "Válasszon ki egy weboldalt",
|
||||
"loading": "Weboldalak betöltése...",
|
||||
"noWebsites": "Nem található weboldal",
|
||||
"configureIntegrationFirst": "Először csatlakoztassa az Umami integrációt"
|
||||
},
|
||||
"timeFrame": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Időkeret",
|
||||
"description": "Látogatói adatok megjelenítésének időtartama",
|
||||
"option": {
|
||||
"today": "",
|
||||
"24h": "",
|
||||
"7d": "",
|
||||
"30d": "",
|
||||
"month": "",
|
||||
"lastMonth": ""
|
||||
"today": "Ma",
|
||||
"24h": "Elmúlt 24 óra",
|
||||
"7d": "Elmúlt 7 nap",
|
||||
"30d": "Elmúlt 30 nap",
|
||||
"month": "Ez a hónap",
|
||||
"lastMonth": "Előző hónap"
|
||||
}
|
||||
},
|
||||
"eventName": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noEvents": "",
|
||||
"none": "",
|
||||
"configureWebsiteFirst": ""
|
||||
"label": "Esemény",
|
||||
"description": "Egy adott esemény összes előfordulásának megjelenítése",
|
||||
"placeholder": "Válasszon ki egy eseményt",
|
||||
"loading": "Események betöltése...",
|
||||
"noEvents": "Nem található esemény",
|
||||
"none": "Nincs esemény",
|
||||
"configureWebsiteFirst": "Először válasszon ki egy weboldalt az események betöltéséhez"
|
||||
},
|
||||
"chartType": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Diagramtípus",
|
||||
"description": "A diagram megjelenítési stílusa",
|
||||
"option": {
|
||||
"bar": "",
|
||||
"sparkline": ""
|
||||
"bar": "Oszlopdiagram",
|
||||
"sparkline": "Mikrodiagram"
|
||||
}
|
||||
},
|
||||
"chartStyle": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Diagramstílus",
|
||||
"description": "Hogyan jeleníthetjük meg az eseménysorozatot a diagramon",
|
||||
"option": {
|
||||
"grouped": "",
|
||||
"overlay": ""
|
||||
"grouped": "Egymás mellett",
|
||||
"overlay": "Átfedés (részhalmaz)"
|
||||
}
|
||||
},
|
||||
"viewMode": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Megtekintés",
|
||||
"description": "Mit jelenítsen meg a widget törzse",
|
||||
"option": {
|
||||
"chart": "",
|
||||
"events": "",
|
||||
"topPages": "",
|
||||
"topReferrers": ""
|
||||
"chart": "Ábra",
|
||||
"events": "Eseménynaptár",
|
||||
"topPages": "Legnépszerűbb oldalak",
|
||||
"topReferrers": "Legjobb hivatkozások"
|
||||
}
|
||||
},
|
||||
"eventNames": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noEvents": "",
|
||||
"configureWebsiteFirst": ""
|
||||
"label": "Események",
|
||||
"description": "Válasszon ki egy vagy több eseményt a grafikonhoz",
|
||||
"placeholder": "Események kiválasztása...",
|
||||
"loading": "Események betöltése...",
|
||||
"noEvents": "Nem található esemény",
|
||||
"configureWebsiteFirst": "Először válasszon ki egy weboldalt az események betöltéséhez"
|
||||
},
|
||||
"topCount": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "Items to show",
|
||||
"description": "Megjelenítendő legnépszerűbb elemek száma (max. 500)"
|
||||
}
|
||||
},
|
||||
"event": {
|
||||
"occurrences": "",
|
||||
"label": ""
|
||||
"occurrences": "események",
|
||||
"label": "események"
|
||||
},
|
||||
"topPages": {
|
||||
"direct": ""
|
||||
"direct": "Közvetlen"
|
||||
},
|
||||
"topReferrers": {
|
||||
"direct": ""
|
||||
"direct": "Közvetlen"
|
||||
},
|
||||
"events": {
|
||||
"selectPrompt": ""
|
||||
"selectPrompt": "Válassza ki a grafikonra felveendő eseményeket"
|
||||
},
|
||||
"error": {
|
||||
"noIntegration": "",
|
||||
"noWebsite": "",
|
||||
"noData": "",
|
||||
"internalServerError": ""
|
||||
"noIntegration": "Nincs beállítva az Umami-integráció",
|
||||
"noWebsite": "Nincs beállított webhely",
|
||||
"noData": "Nincs elérhető adat",
|
||||
"internalServerError": "Umami-adatok letöltése nem sikerült"
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
@@ -2745,15 +2745,15 @@
|
||||
}
|
||||
},
|
||||
"importForm": {
|
||||
"title": ""
|
||||
"title": "Importálás a Docker-ből"
|
||||
},
|
||||
"example": {
|
||||
"label": ""
|
||||
"label": "Példa"
|
||||
},
|
||||
"invalid": "",
|
||||
"invalid": "A tároló meghatározása érvénytelen, kérjük, ellenőrizze az értékeket",
|
||||
"noProvider": {
|
||||
"label": "",
|
||||
"tooltip": ""
|
||||
"label": "Nincs Szolgáltató",
|
||||
"tooltip": "A szolgáltató adatai nem értelmezhetők; kérjük, az importálás után állítsa be azokat manuálisan"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2826,34 +2826,34 @@
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
"integrationsDisconnected": "",
|
||||
"unknownContentOption": ""
|
||||
"integrationsDisconnected": "Nincs elérhető adat, az összes integráció le van választva",
|
||||
"unknownContentOption": "A hálózati állapot-widget ismeretlen tartalmi beállítása: "
|
||||
},
|
||||
"name": "",
|
||||
"description": ""
|
||||
"name": "Hálózat állapota",
|
||||
"description": "A hálózathoz csatlakozó eszközök megjelenítése"
|
||||
},
|
||||
"networkController": {
|
||||
"error": {
|
||||
"internalServerError": ""
|
||||
"internalServerError": "A hálózati vezérlő összefoglalójának letöltése nem sikerült"
|
||||
}
|
||||
},
|
||||
"firewall": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"name": "Tűzfal-felügyelet",
|
||||
"description": "Megjeleníti a tűzfalak összefoglalóját",
|
||||
"tab": {
|
||||
"system": "",
|
||||
"interfaces": ""
|
||||
"system": "Rendszer",
|
||||
"interfaces": "Interfészek"
|
||||
},
|
||||
"error": {
|
||||
"internalServerError": ""
|
||||
"internalServerError": "Nem sikerült adatokat lekérni a tűzfalról"
|
||||
},
|
||||
"option": {
|
||||
"interfaces": ""
|
||||
"interfaces": "Megjelenítendő hálózati interfészek"
|
||||
},
|
||||
"widget": {
|
||||
"fwname": "",
|
||||
"version": "",
|
||||
"versiontitle": "",
|
||||
"fwname": "Név",
|
||||
"version": "Verzió",
|
||||
"versiontitle": "Verziók",
|
||||
"cputitle": "CPU használat",
|
||||
"memorytitle": "Memória használat",
|
||||
"cpu": "CPU",
|
||||
@@ -2942,63 +2942,63 @@
|
||||
"cpu": "CPU",
|
||||
"memory": "RAM",
|
||||
"gpu": "GPU",
|
||||
"network": "",
|
||||
"up": "",
|
||||
"down": ""
|
||||
"network": "NET",
|
||||
"up": "FÖNN",
|
||||
"down": "LENN"
|
||||
}
|
||||
},
|
||||
"systemDisks": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"name": "Rendszer lemezek",
|
||||
"description": "A rendszer lemezhasználata",
|
||||
"option": {
|
||||
"showTemperatureIfAvailable": {
|
||||
"label": ""
|
||||
"label": "Ha elérhető, mutassa a hőmérsékletet"
|
||||
},
|
||||
"displayMode": {
|
||||
"label": "",
|
||||
"label": "Megjelenítési mód",
|
||||
"option": {
|
||||
"percentage": {
|
||||
"label": ""
|
||||
"label": "Százalék (pl: 76%)"
|
||||
},
|
||||
"absolute": {
|
||||
"label": ""
|
||||
"label": "Abszolút értékek (pl. 800 Gb / 1 Tb)"
|
||||
},
|
||||
"free": {
|
||||
"label": ""
|
||||
"label": "A szabad hely aránya (pl. 24% szabad)"
|
||||
}
|
||||
}
|
||||
},
|
||||
"showBackgroundBar": {
|
||||
"label": ""
|
||||
"label": "Háttérhasználati sáv megjelenítése"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"unhealthy": ""
|
||||
"unhealthy": "Hibás"
|
||||
}
|
||||
}
|
||||
},
|
||||
"widgetPreview": {
|
||||
"toggle": {
|
||||
"enabled": "",
|
||||
"disabled": ""
|
||||
"enabled": "Szerkesztési mód engedélyezve",
|
||||
"disabled": "Szerkesztési mód tiltva"
|
||||
},
|
||||
"dimensions": {
|
||||
"title": ""
|
||||
"title": "Dimenzió váltása"
|
||||
}
|
||||
},
|
||||
"board": {
|
||||
"action": {
|
||||
"duplicate": {
|
||||
"title": "",
|
||||
"message": "",
|
||||
"title": "Tábla duplikálása",
|
||||
"message": "Ezzel a {name} tábla teljes tartalmával együtt duplikálódik. Ha a widgetek olyan integrációkra hivatkoznak, amelyek használata nem engedélyezett, azok eltávolításra kerülnek.",
|
||||
"notification": {
|
||||
"success": {
|
||||
"title": "",
|
||||
"message": ""
|
||||
"title": "Tábla duplikálva",
|
||||
"message": "A tábla sikeresen duplikálódott"
|
||||
},
|
||||
"error": {
|
||||
"title": "",
|
||||
"message": ""
|
||||
"title": "Nem lehet duplikálni a táblát",
|
||||
"message": "Nem tudtam duplikálni a táblát"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -3006,44 +3006,44 @@
|
||||
"notification": {
|
||||
"success": {
|
||||
"title": "A módosítások sikeresen alkalmazva",
|
||||
"message": ""
|
||||
"message": "A tábla sikeresen elmentve"
|
||||
},
|
||||
"error": {
|
||||
"title": "Nem sikerült alkalmazni a változtatásokat",
|
||||
"message": ""
|
||||
"message": "A táblát nem sikerült elmenteni"
|
||||
}
|
||||
},
|
||||
"confirmLeave": {
|
||||
"title": "",
|
||||
"message": ""
|
||||
"title": "Mentetlen változtatások",
|
||||
"message": "Nem mentett változtatásai vannak, biztosan el akarja hagyni az oldalt?"
|
||||
}
|
||||
},
|
||||
"oldImport": {
|
||||
"label": "",
|
||||
"label": "Importálás a homarr 1.0.0 előtti verzióból",
|
||||
"notification": {
|
||||
"success": {
|
||||
"title": "",
|
||||
"message": ""
|
||||
"title": "Sikeres importálás",
|
||||
"message": "A tábla sikeresen importálva"
|
||||
},
|
||||
"error": {
|
||||
"title": "",
|
||||
"message": ""
|
||||
"title": "Importálás nem sikerült",
|
||||
"message": "Táblát nem sikerült importálni; további részletekért nézd meg a naplófájlokat"
|
||||
}
|
||||
},
|
||||
"form": {
|
||||
"file": {
|
||||
"label": "",
|
||||
"invalidError": ""
|
||||
"label": "JSON fájl kiválasztása",
|
||||
"invalidError": "Érvénytelen konfigurációs fájl"
|
||||
},
|
||||
"apps": {
|
||||
"label": "Alkalmazások",
|
||||
"avoidDuplicates": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "Kerülje az ismétlődéseket",
|
||||
"description": "Nem veszi figyelembe azokat az alkalmazásokat, amelyeknél már létezik azonos href-vel rendelkező alkalmazás"
|
||||
},
|
||||
"onlyImportApps": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "Csak alkalmazások importálása",
|
||||
"description": "Csak az alkalmazásokat adja hozzá, a táblát manuálisan kell újra létrehozni"
|
||||
}
|
||||
},
|
||||
"name": {
|
||||
@@ -3272,15 +3272,15 @@
|
||||
"description": ""
|
||||
},
|
||||
"private": {
|
||||
"title": "",
|
||||
"description": ""
|
||||
"title": "Nyilvános tábla készítése",
|
||||
"description": "Biztosan nyilvánossá szeretnéd tenni ezt a fórumot? Ezzel a fórum mindenki számára elérhetővé válik."
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"label": "",
|
||||
"label": "Törölje ezt a táblát",
|
||||
"description": "",
|
||||
"button": "",
|
||||
"button": "Törölje ezt a táblát",
|
||||
"confirm": {
|
||||
"title": "Tábla törlése",
|
||||
"description": ""
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Portok"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
"label": "Apri risultati di ricerca in una nuova scheda"
|
||||
},
|
||||
"ddgBangs": {
|
||||
"label": ""
|
||||
"label": "Abilita bangs DuckDuckGo"
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
@@ -252,10 +252,10 @@
|
||||
"changeDdgBangs": {
|
||||
"notification": {
|
||||
"success": {
|
||||
"message": ""
|
||||
"message": "DuckDuckGo bangs attivato con successo"
|
||||
},
|
||||
"error": {
|
||||
"message": ""
|
||||
"message": "Impossibile attivare i bangs DuckDuckGo"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1093,7 +1093,7 @@
|
||||
},
|
||||
"colorScheme": {
|
||||
"options": {
|
||||
"auto": "",
|
||||
"auto": "Automatico",
|
||||
"light": "Chiaro",
|
||||
"dark": "Scuro"
|
||||
}
|
||||
@@ -2111,101 +2111,101 @@
|
||||
}
|
||||
},
|
||||
"umami": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"visitors": "",
|
||||
"active": "",
|
||||
"pageviews": "",
|
||||
"visits": "",
|
||||
"bounceRate": "",
|
||||
"avgDuration": "",
|
||||
"name": "Umami Analytics",
|
||||
"description": "Visualizza le statistiche dei visitatori dall'istanza Umami analytics",
|
||||
"visitors": "visitatori",
|
||||
"active": "attivo",
|
||||
"pageviews": "pagine viste",
|
||||
"visits": "visite",
|
||||
"bounceRate": "rimbalzo",
|
||||
"avgDuration": "media",
|
||||
"option": {
|
||||
"websiteId": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noWebsites": "",
|
||||
"configureIntegrationFirst": ""
|
||||
"label": "Sito web",
|
||||
"description": "Seleziona un sito web tracciato dalla tua istanza di Umami",
|
||||
"placeholder": "Seleziona un sito web",
|
||||
"loading": "Caricamento siti web...",
|
||||
"noWebsites": "Nessun sito web trovato",
|
||||
"configureIntegrationFirst": "Connetti prima un'integrazione Umami"
|
||||
},
|
||||
"timeFrame": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Intervallo di tempo",
|
||||
"description": "Il periodo di tempo per visualizzare i dati dei visitatori per",
|
||||
"option": {
|
||||
"today": "",
|
||||
"24h": "",
|
||||
"7d": "",
|
||||
"30d": "",
|
||||
"month": "",
|
||||
"lastMonth": ""
|
||||
"today": "Oggi",
|
||||
"24h": "Ultime 24 ore",
|
||||
"7d": "Ultimi 7 giorni",
|
||||
"30d": "Ultimi 30 giorni",
|
||||
"month": "Questo mese",
|
||||
"lastMonth": "Mese precedente"
|
||||
}
|
||||
},
|
||||
"eventName": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noEvents": "",
|
||||
"none": "",
|
||||
"configureWebsiteFirst": ""
|
||||
"label": "Evento",
|
||||
"description": "Mostra le occorrenze totali di un evento specifico",
|
||||
"placeholder": "Seleziona un evento",
|
||||
"loading": "Caricamento eventi...",
|
||||
"noEvents": "Nessun evento trovato",
|
||||
"none": "Nessun evento",
|
||||
"configureWebsiteFirst": "Seleziona un sito web prima di caricare gli eventi"
|
||||
},
|
||||
"chartType": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Tipo di grafico",
|
||||
"description": "Stile di visualizzazione del grafico",
|
||||
"option": {
|
||||
"bar": "",
|
||||
"sparkline": ""
|
||||
"bar": "Grafico a barre",
|
||||
"sparkline": "Grafico a linee compatto"
|
||||
}
|
||||
},
|
||||
"chartStyle": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Stile del grafico",
|
||||
"description": "Come visualizzare la serie di eventi nel grafico",
|
||||
"option": {
|
||||
"grouped": "",
|
||||
"overlay": ""
|
||||
"grouped": "Affiancati",
|
||||
"overlay": "Sovrapponi (subset)"
|
||||
}
|
||||
},
|
||||
"viewMode": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Vista",
|
||||
"description": "Cosa mostrare nel corpo del widget",
|
||||
"option": {
|
||||
"chart": "",
|
||||
"events": "",
|
||||
"topPages": "",
|
||||
"topReferrers": ""
|
||||
"chart": "Grafico",
|
||||
"events": "Grafico degli eventi",
|
||||
"topPages": "Pagine più visitate",
|
||||
"topReferrers": "Referrer principali"
|
||||
}
|
||||
},
|
||||
"eventNames": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noEvents": "",
|
||||
"configureWebsiteFirst": ""
|
||||
"label": "Eventi",
|
||||
"description": "Scegli uno o più eventi per il grafico",
|
||||
"placeholder": "Seleziona eventi...",
|
||||
"loading": "Caricamento eventi...",
|
||||
"noEvents": "Nessun evento trovato",
|
||||
"configureWebsiteFirst": "Seleziona prima un sito web per caricare gli eventi"
|
||||
},
|
||||
"topCount": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "Elementi da mostrare",
|
||||
"description": "Numero di elementi principali da visualizzare (max 500)"
|
||||
}
|
||||
},
|
||||
"event": {
|
||||
"occurrences": "",
|
||||
"label": ""
|
||||
"occurrences": "eventi",
|
||||
"label": "eventi"
|
||||
},
|
||||
"topPages": {
|
||||
"direct": ""
|
||||
"direct": "Diretto"
|
||||
},
|
||||
"topReferrers": {
|
||||
"direct": ""
|
||||
"direct": "Diretto"
|
||||
},
|
||||
"events": {
|
||||
"selectPrompt": ""
|
||||
"selectPrompt": "Seleziona gli eventi per il grafico"
|
||||
},
|
||||
"error": {
|
||||
"noIntegration": "",
|
||||
"noWebsite": "",
|
||||
"noData": "",
|
||||
"internalServerError": ""
|
||||
"noIntegration": "Nessuna integrazione di Umami configurata",
|
||||
"noWebsite": "Nessun sito web configurato",
|
||||
"noData": "Nessun dato disponibile",
|
||||
"internalServerError": "Recupero dati Umami fallito"
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
@@ -3680,7 +3680,7 @@
|
||||
"defaultColorScheme": {
|
||||
"label": "Schema colore predefinito",
|
||||
"options": {
|
||||
"auto": "",
|
||||
"auto": "Automatico",
|
||||
"light": "Chiaro",
|
||||
"dark": "Scuro"
|
||||
}
|
||||
@@ -3783,7 +3783,7 @@
|
||||
"label": "Tracearr"
|
||||
},
|
||||
"umamiActiveVisitors": {
|
||||
"label": ""
|
||||
"label": "Visitatori Attivi Umami"
|
||||
}
|
||||
},
|
||||
"interval": {
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Porte"
|
||||
},
|
||||
"host": {
|
||||
"label": "Host"
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
@@ -4496,7 +4499,7 @@
|
||||
"title": "Comandi generali",
|
||||
"option": {
|
||||
"colorScheme": {
|
||||
"auto": "",
|
||||
"auto": "Attiva/Disattiva modalità aspetto",
|
||||
"light": "Passa al tema chiaro",
|
||||
"dark": "Passa al tema scuro"
|
||||
},
|
||||
@@ -4548,13 +4551,13 @@
|
||||
"group": {
|
||||
"searchEngine": {
|
||||
"title": "Motori di ricerca",
|
||||
"tipDdgBangs": "",
|
||||
"tipDdgBangs": "Suggerimento: puoi usare anche i bang di DuckDuckGo, ad esempio !qualcosa",
|
||||
"bang": {
|
||||
"searchWithQuery": "",
|
||||
"pressEnterToOpen": "",
|
||||
"engineSelected": "",
|
||||
"typeQueryToContinue": "",
|
||||
"emptyBangHint": ""
|
||||
"searchWithQuery": "Cerca \"{query}\" con {label}",
|
||||
"pressEnterToOpen": "Premere Invio per aprire",
|
||||
"engineSelected": "{label} selezionato (!{bang})",
|
||||
"typeQueryToContinue": "Digita la tua query di ricerca per continuare",
|
||||
"emptyBangHint": "Digita un bang, ad es. !yt, poi premi Spazio per selezionare"
|
||||
},
|
||||
"children": {
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "ポート"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "포트"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Prievadai"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": ""
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Poorten"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
"label": "Åpne søkeresultater i ny fane"
|
||||
},
|
||||
"ddgBangs": {
|
||||
"label": ""
|
||||
"label": "Aktiver DuckDuckGo bangs"
|
||||
}
|
||||
},
|
||||
"error": {
|
||||
@@ -252,10 +252,10 @@
|
||||
"changeDdgBangs": {
|
||||
"notification": {
|
||||
"success": {
|
||||
"message": ""
|
||||
"message": "DuckDuckGo bangs er endret vellykket"
|
||||
},
|
||||
"error": {
|
||||
"message": ""
|
||||
"message": "Kan ikke slå av/på DuckDuckGo bangs"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -1093,7 +1093,7 @@
|
||||
},
|
||||
"colorScheme": {
|
||||
"options": {
|
||||
"auto": "",
|
||||
"auto": "Auto",
|
||||
"light": "Lys",
|
||||
"dark": "Mørk"
|
||||
}
|
||||
@@ -2111,101 +2111,101 @@
|
||||
}
|
||||
},
|
||||
"umami": {
|
||||
"name": "",
|
||||
"description": "",
|
||||
"visitors": "",
|
||||
"active": "",
|
||||
"pageviews": "",
|
||||
"visits": "",
|
||||
"bounceRate": "",
|
||||
"avgDuration": "",
|
||||
"name": "Umami Analytics",
|
||||
"description": "Vise besøkende statistikk fra din Umami-analyseinstans",
|
||||
"visitors": "besøkende",
|
||||
"active": "aktiv",
|
||||
"pageviews": "sidevisninger",
|
||||
"visits": "besøk",
|
||||
"bounceRate": "tilbakesende",
|
||||
"avgDuration": "gjennomsnitt",
|
||||
"option": {
|
||||
"websiteId": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noWebsites": "",
|
||||
"configureIntegrationFirst": ""
|
||||
"label": "Nettsted",
|
||||
"description": "Velg et nettsted som spores av Umami-instansen din",
|
||||
"placeholder": "Velg en nettside",
|
||||
"loading": "Laster inn nettsteder...",
|
||||
"noWebsites": "Ingen nettsteder ble funnet",
|
||||
"configureIntegrationFirst": "Koble til en Umami integrasjon først"
|
||||
},
|
||||
"timeFrame": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Tidsramme",
|
||||
"description": "Tidsperiode som skal vise besøkende data for",
|
||||
"option": {
|
||||
"today": "",
|
||||
"24h": "",
|
||||
"7d": "",
|
||||
"30d": "",
|
||||
"month": "",
|
||||
"lastMonth": ""
|
||||
"today": "I dag",
|
||||
"24h": "Siste 24 timer",
|
||||
"7d": "Siste 7 dager",
|
||||
"30d": "Siste 30 dager",
|
||||
"month": "Denne måneden",
|
||||
"lastMonth": "Siste måned"
|
||||
}
|
||||
},
|
||||
"eventName": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noEvents": "",
|
||||
"none": "",
|
||||
"configureWebsiteFirst": ""
|
||||
"label": "Hendelse",
|
||||
"description": "Vis totale forekomster av en bestemt hendelse",
|
||||
"placeholder": "Velg en hendelse",
|
||||
"loading": "Laster inn hendelser...",
|
||||
"noEvents": "Ingen hendelser funnet",
|
||||
"none": "Ingen hendelser",
|
||||
"configureWebsiteFirst": "Velg en nettside først for å laste inn hendelser"
|
||||
},
|
||||
"chartType": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Diagramtype",
|
||||
"description": "Vis stil for diagrammet",
|
||||
"option": {
|
||||
"bar": "",
|
||||
"sparkline": ""
|
||||
"bar": "Søylediagram",
|
||||
"sparkline": "Minigraf"
|
||||
}
|
||||
},
|
||||
"chartStyle": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Diagramtype",
|
||||
"description": "Hvordan vise hendelsesserier i diagrammet",
|
||||
"option": {
|
||||
"grouped": "",
|
||||
"overlay": ""
|
||||
"grouped": "Side om side",
|
||||
"overlay": "Overlegg (delmengde)"
|
||||
}
|
||||
},
|
||||
"viewMode": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"label": "Visning",
|
||||
"description": "Hva skal vises i widgetkroppen",
|
||||
"option": {
|
||||
"chart": "",
|
||||
"events": "",
|
||||
"topPages": "",
|
||||
"topReferrers": ""
|
||||
"chart": "Diagram",
|
||||
"events": "Hendelser diagram",
|
||||
"topPages": "Toppsider",
|
||||
"topReferrers": "Topp referenter"
|
||||
}
|
||||
},
|
||||
"eventNames": {
|
||||
"label": "",
|
||||
"description": "",
|
||||
"placeholder": "",
|
||||
"loading": "",
|
||||
"noEvents": "",
|
||||
"configureWebsiteFirst": ""
|
||||
"label": "Hendelser",
|
||||
"description": "Velg ett eller flere hendelser i diagrammet",
|
||||
"placeholder": "Velg en hendelse...",
|
||||
"loading": "Laster inn hendelser...",
|
||||
"noEvents": "Ingen hendelser funnet",
|
||||
"configureWebsiteFirst": "Velg en nettside først for å laste inn hendelser"
|
||||
},
|
||||
"topCount": {
|
||||
"label": "",
|
||||
"description": ""
|
||||
"label": "Gjenstander å vise",
|
||||
"description": "Antall oppføringer som skal vises (maks 500)"
|
||||
}
|
||||
},
|
||||
"event": {
|
||||
"occurrences": "",
|
||||
"label": ""
|
||||
"occurrences": "hendelser",
|
||||
"label": "hendelser"
|
||||
},
|
||||
"topPages": {
|
||||
"direct": ""
|
||||
"direct": "Direkte"
|
||||
},
|
||||
"topReferrers": {
|
||||
"direct": ""
|
||||
"direct": "Direkte"
|
||||
},
|
||||
"events": {
|
||||
"selectPrompt": ""
|
||||
"selectPrompt": "Velg hendelser for å diagram"
|
||||
},
|
||||
"error": {
|
||||
"noIntegration": "",
|
||||
"noWebsite": "",
|
||||
"noData": "",
|
||||
"internalServerError": ""
|
||||
"noIntegration": "Ingen Umami integrasjon konfigurert",
|
||||
"noWebsite": "Ingen nettsted konfigurert",
|
||||
"noData": "Ingen data tilgjengelig",
|
||||
"internalServerError": "Kunne ikke hente Umami data"
|
||||
}
|
||||
},
|
||||
"common": {
|
||||
@@ -3680,7 +3680,7 @@
|
||||
"defaultColorScheme": {
|
||||
"label": "Standard fargetema",
|
||||
"options": {
|
||||
"auto": "",
|
||||
"auto": "Auto",
|
||||
"light": "Lys",
|
||||
"dark": "Mørk"
|
||||
}
|
||||
@@ -3783,7 +3783,7 @@
|
||||
"label": "Tracearr"
|
||||
},
|
||||
"umamiActiveVisitors": {
|
||||
"label": ""
|
||||
"label": "Umami Aktive Besøkende"
|
||||
}
|
||||
},
|
||||
"interval": {
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Porter"
|
||||
},
|
||||
"host": {
|
||||
"label": "Vert"
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
@@ -4496,7 +4499,7 @@
|
||||
"title": "Globale kommandoer",
|
||||
"option": {
|
||||
"colorScheme": {
|
||||
"auto": "",
|
||||
"auto": "Bytt visningsmodus",
|
||||
"light": "Bytt til lys modus",
|
||||
"dark": "Bytt til mørk modus"
|
||||
},
|
||||
@@ -4548,13 +4551,13 @@
|
||||
"group": {
|
||||
"searchEngine": {
|
||||
"title": "Søkemotorer",
|
||||
"tipDdgBangs": "",
|
||||
"tipDdgBangs": "Tips: Du kan også bruke DuckDuckGo-bangs her, f.eks. !something",
|
||||
"bang": {
|
||||
"searchWithQuery": "",
|
||||
"pressEnterToOpen": "",
|
||||
"engineSelected": "",
|
||||
"typeQueryToContinue": "",
|
||||
"emptyBangHint": ""
|
||||
"searchWithQuery": "Søk etter \"{query}\" med {label}",
|
||||
"pressEnterToOpen": "Trykk på Enter for å åpne",
|
||||
"engineSelected": "{label} valgt (!{bang})",
|
||||
"typeQueryToContinue": "Skriv inn søkeordet for å fortsette",
|
||||
"emptyBangHint": "Skriv inn en bang, f.eks. !yt, og trykk deretter på mellomrom for å velge"
|
||||
},
|
||||
"children": {
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Porty"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Portas"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": ""
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Porturi"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Порты"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Porty"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Vrata"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Portar"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Bağlantı noktaları"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Порти"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "Cổng"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -3970,6 +3970,9 @@
|
||||
},
|
||||
"ports": {
|
||||
"label": "端口"
|
||||
},
|
||||
"host": {
|
||||
"label": ""
|
||||
}
|
||||
},
|
||||
"action": {
|
||||
|
||||
@@ -79,6 +79,19 @@ const createColumns = (
|
||||
return <ContainerStateBadge state={row.original.state} />;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "host",
|
||||
accessorKey: "host",
|
||||
size: 100,
|
||||
header: t("field.host.label"),
|
||||
Cell({ row }) {
|
||||
return (
|
||||
<Text size="xs" truncate="end">
|
||||
{row.original.host}
|
||||
</Text>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "cpuUsage",
|
||||
sortingFn: (rowA, rowB) => {
|
||||
|
||||
Generated
+1383
-2350
File diff suppressed because it is too large.
Load diff
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user