Compare commits

..
Author SHA1 Message Date
Meier Lukas c88a46c839 fix: typecheck issue 2026-04-27 22:15:35 +02:00
Meier LukasandCopilot 7dabc89ab6 fix: lint errors and warnings
Co-authored-by: Copilot <copilot@github.com>
2026-04-27 22:07:52 +02:00
homarr-renovate[bot] 85c5bc45e5 chore(deps): update dependency typescript-eslint to ^8.59.0 2026-04-27 13:59:12 +00:00
106 changed files with 844 additions and 950 deletions

No files matched your search

+4
View File
@@ -12,6 +12,10 @@ 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:
+5 -5
View File
@@ -25,16 +25,16 @@ body:
label: Public API available?
description: Is there a public API available, that we can consume in Homarr?
options:
- "Yes, available on a website"
- "Yes, available in the application itself"
- "No"
- Yes, available on a website
- Yes, available in the application itself
- No
validations:
required: true
- type: dropdown
attributes:
label: Are you willing to contribute this yourself?
options:
- "Yes"
- "No"
- Yes
- No
validations:
required: true
+2 -2
View File
@@ -24,7 +24,7 @@ body:
attributes:
label: Are you willing to contribute this yourself?
options:
- "Yes"
- "No"
- Yes
- No
validations:
required: true
+1 -1
View File
@@ -23,7 +23,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.RENOVATE_APPROVE_PRIVATE_KEY }}
client-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }}
app-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }}
permission-pull-requests: write # required to approve pull request
- name: Install GitHub CLI
+6 -2
View File
@@ -11,10 +11,14 @@ on:
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
# You can leverage Vercel Remote Caching with Turbo to speed up your builds
# @link https://turborepo.org/docs/core-concepts/remote-caching#remote-caching-on-vercel-builds
env:
FORCE_COLOR: 3
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
jobs:
lint:
@@ -55,7 +59,7 @@ jobs:
uses: ./tooling/github/setup
- name: Typecheck
run: pnpm typecheck
run: turbo typecheck
test:
runs-on: ubuntu-latest
@@ -22,7 +22,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.CROWDIN_APP_PRIVATE_KEY }}
client-id: ${{ secrets.CROWDIN_APP_ID }}
app-id: ${{ secrets.CROWDIN_APP_ID }}
permission-contents: write # required to commit to crowdin branch
permission-pull-requests: write # required to create pull request
@@ -1,104 +0,0 @@
name: "[Deployment] Beta Release"
on:
workflow_dispatch:
inputs:
send-notifications:
type: boolean
required: false
default: true
description: Send notifications
permissions:
contents: write
pull-requests: write
jobs:
create-and-merge-pr:
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- name: Discord notification
if: ${{ github.event.inputs.send-notifications }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
with:
args: "Beta release has been triggered: [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ github.token }}
branch: next
- name: Create pull request
id: create-pull-request
run: 'gh pr create --title "chore(release): release ${{ steps.semver.outputs.next }}-beta" --body "Detected change to be ``${{ steps.semver.outputs.bump }}``<br/>Bump version from ``${{ steps.semver.outputs.current }}`` to ``${{ steps.semver.outputs.next }}-beta``" --base beta --head next --label automerge'
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Discord notification
if: ${{ github.event.inputs.send-notifications }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
with:
args: "Created a release PR ${{ steps.create-pull-request.outputs.url }} for version ${{ steps.semver.outputs.next }}-beta (new behaviour: ${{ steps.semver.outputs.bump }})"
- name: Obtain token
id: obtainApprovalToken
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.RENOVATE_APPROVE_PRIVATE_KEY }}
client-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }}
permission-pull-requests: write
- name: Approve PR
env:
GITHUB_TOKEN: ${{ steps.obtainApprovalToken.outputs.token }}
run: |
gh pr review --approve --body "Automatically approved by GitHub Action"
- name: Obtain token
id: obtainMergeToken
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }}
client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
permission-contents: write # write to beta branch (due to merge)
permission-pull-requests: write # merge pull request
- id: automerge
if: ${{ steps.semver.outputs.bump != 'major' }}
name: automerge
uses: "pascalgn/automerge-action@v0.16.4"
env:
GITHUB_TOKEN: ${{ steps.obtainMergeToken.outputs.token }}
MERGE_METHOD: merge # we prefer merge commits for merging to beta
MERGE_COMMIT_MESSAGE: "chore(release): release ${{ steps.semver.outputs.next }}-beta"
MERGE_DELETE_BRANCH: false # never set to true!
PULL_REQUEST: "${{ steps.create-pull-request.outputs.pr_number }}"
MERGE_RETRIES: 20 # 20 retries * MERGE_RETRY_SLEEP until step fails
MERGE_RETRY_SLEEP: 10000 # 10 seconds * MERGE_RETRIES until step fails
MERGE_REQUIRED_APPROVALS: 0 # do not require approvals
- name: Merged Discord notification
if: ${{ steps.automerge.outputs.mergeResult == 'merged' && github.event.inputs.send-notifications }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
with:
args: "Merged PR ${{ steps.create-pull-request.outputs.url }} for release ${{ steps.semver.outputs.next }}-beta"
- name: Major Bump Discord notification
if: ${{ steps.semver.outputs.bump == 'major' && github.event.inputs.send-notifications }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
with:
args: "The release PR must be manually merged because the next version is a major version: ${{ steps.create-pull-request.outputs.url }} for release ${{ steps.semver.outputs.next }}-beta"
- name: Discord Fail Notification
if: failure() && github.event.inputs.send-notifications
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
with:
args: "The beta release workflow [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) has failed"
+11 -13
View File
@@ -5,7 +5,6 @@ on:
branches:
- main
- beta
- next
- dev
workflow_dispatch:
inputs:
@@ -35,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
env:
SKIP_RELEASE: ${{ github.event_name == 'workflow_dispatch' || github.ref_name == 'dev' || github.ref_name == 'next' }}
SKIP_RELEASE: ${{ github.event_name == 'workflow_dispatch' || github.ref_name == 'dev' }}
outputs:
version: ${{ steps.read-semver.outputs.version || steps.version-fallback.outputs.version }}
git_ref: ${{ steps.read-git-ref.outputs.ref || github.ref }}
@@ -54,8 +53,8 @@ jobs:
uses: actions/create-github-app-token@v3
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 / next and publish the release
app-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
permission-contents: write # required to commit package.json & changelog changes, merge them to dev and publish the release
- uses: actions/checkout@v6
if: env.SKIP_RELEASE == 'false'
@@ -67,7 +66,7 @@ jobs:
if: env.SKIP_RELEASE == 'false'
with:
node-version: 24.15.0
package-manager-cache: false
cache: "pnpm"
- run: npm i -g pnpm
if: env.SKIP_RELEASE == 'false'
- name: Install dependencies
@@ -96,21 +95,20 @@ jobs:
id: read-git-ref
run: |
echo "ref=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Update dev / next branch
- name: Update dev 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 ${{ env.UPSTREAM_BRANCH }}
git checkout ${{ env.UPSTREAM_BRANCH }}
git pull origin ${{ env.UPSTREAM_BRANCH }}
git fetch origin dev
git checkout dev
git pull origin dev
git rebase ${{ github.ref_name }}
git push origin ${{ env.UPSTREAM_BRANCH }}
git push origin dev
build-amd64:
name: Build docker image for amd64
needs: release
@@ -236,7 +234,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }}
client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
app-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
permission-contents: write # required to publish the release
- name: Log in to the Container registry
@@ -276,6 +274,6 @@ jobs:
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
uses: Ilshidur/action-discord@master
with:
args: "Successfully deployed images for branch **${{ github.ref_name }}**. Tagged as **${{env.NEXT_VERSION}}**."
+13 -14
View File
@@ -21,10 +21,10 @@ jobs:
timeout-minutes: 2
steps:
- name: Discord notification
if: ${{ github.event.inputs.send-notifications }}
if: ${{ github.events.inputs.send-notifications }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
uses: Ilshidur/action-discord@master
with:
args: "Automatic release has been triggered: [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
- name: Checkout repository
@@ -38,15 +38,14 @@ jobs:
token: ${{ github.token }}
branch: dev
- name: Create pull request
id: create-pull-request
run: 'gh pr create --title "chore(release): automatic release ${{ steps.semver.outputs.next }}" --body "**This is an automatic release**.<br/>Manual action may be required for major bumps.<br/>Detected change to be ``${{ steps.semver.outputs.bump }}``<br/>Bump version from ``${{ steps.semver.outputs.current }}`` to ``${{ steps.semver.outputs.next }}``" --base main --head dev --label automerge'
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Discord notification
if: ${{ github.event.inputs.send-notifications }}
if: ${{ github.events.inputs.send-notifications }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
uses: Ilshidur/action-discord@master
with:
args: "Created a release PR ${{ steps.create-pull-request.outputs.url }} for version ${{ steps.semver.outputs.next }} (new behaviour: ${{ steps.semver.outputs.bump }})"
- name: Obtain token
@@ -54,7 +53,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.RENOVATE_APPROVE_PRIVATE_KEY }}
client-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }}
app-id: ${{ secrets.RENOVATE_APPROVE_APP_ID }}
permission-pull-requests: write
- name: Approve PR
env:
@@ -66,7 +65,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }}
client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
app-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
permission-contents: write # write to main branch (due to merge)
permission-pull-requests: write # merge pull request
- id: automerge
@@ -75,7 +74,7 @@ jobs:
uses: "pascalgn/automerge-action@v0.16.4"
env:
GITHUB_TOKEN: ${{ steps.obtainMergeToken.outputs.token }}
MERGE_METHOD: merge # we prefer merge commits for merging to main
MERGE_METHOD: merge # we prefer merge commits for merging to master
MERGE_COMMIT_MESSAGE: "chore(release): automatic release ${{ steps.semver.outputs.next }}"
MERGE_DELETE_BRANCH: false # never set to true!
PULL_REQUEST: "${{ steps.create-pull-request.outputs.pr_number }}"
@@ -84,23 +83,23 @@ jobs:
MERGE_REQUIRED_APPROVALS: 0 # do not require approvals
- name: Merged Discord notification
if: ${{ steps.automerge.outputs.mergeResult == 'merged' && github.event.inputs.send-notifications }}
if: ${{ steps.automerge.outputs.mergeResult == 'merged' && github.events.inputs.send-notifications }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
uses: Ilshidur/action-discord@master
with:
args: "Merged PR ${{ steps.create-pull-request.outputs.url }} for release ${{ steps.semver.outputs.next }}"
- name: Major Bump Discord notification
if: ${{ steps.semver.outputs.bump == 'major' && github.event.inputs.send-notifications }}
if: ${{ steps.semver.outputs.bump == 'major' && github.events.inputs.send-notifications }}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
uses: Ilshidur/action-discord@master
with:
args: "The release PR must be manually merged because the next version is a major version: ${{ steps.create-pull-request.outputs.url }} for release ${{ steps.semver.outputs.next }}"
- name: Discord Fail Notification
if: failure() && github.event.inputs.send-notifications
if: failure() && github.events.inputs.send-notifications
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.4.0
uses: Ilshidur/action-discord@master
with:
args: "The automatic release workflow [run ${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) has failed"
+2 -2
View File
@@ -15,7 +15,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.HOMARR_DOCS_RELEASE_APP_PRIVATE_KEY }}
client-id: ${{ vars.HOMARR_DOCS_RELEASE_APP_ID }}
app-id: ${{ vars.HOMARR_DOCS_RELEASE_APP_ID }}
owner: homarr-labs
repositories: |
documentation
@@ -48,7 +48,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.RENOVATE_MERGE_PRIVATE_KEY }}
client-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
app-id: ${{ secrets.RENOVATE_MERGE_APP_ID }}
permission-contents: write # required to commit to branch
permission-pull-requests: write # required to create pr & enable automerge
- name: Checkout code
+1 -1
View File
@@ -24,7 +24,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.HOMARR_UPDATE_CONTRIBUTORS_PRIVATE_KEY }}
client-id: ${{ vars.HOMARR_UPDATE_CONTRIBUTORS_APP_ID }}
app-id: ${{ vars.HOMARR_UPDATE_CONTRIBUTORS_APP_ID }}
permission-contents: write # required to commit to branch
permission-pull-requests: write # required to create pr & enable automerge
@@ -24,7 +24,7 @@ jobs:
uses: actions/create-github-app-token@v3
with:
private-key: ${{ secrets.HOMARR_UPDATE_CONTRIBUTORS_PRIVATE_KEY }}
client-id: ${{ vars.HOMARR_UPDATE_CONTRIBUTORS_APP_ID }}
app-id: ${{ vars.HOMARR_UPDATE_CONTRIBUTORS_APP_ID }}
permission-contents: write # required to commit to branch
permission-pull-requests: write # required to create pr & enable automerge
- name: Checkout code
-48
View File
@@ -1,51 +1,3 @@
## [1.60.1-beta.1](https://github.com/homarr-labs/homarr/compare/v1.60.0...v1.60.1-beta.1) (2026-05-01)
### Performance Improvements
* **memory:** combine 3 node processes into one ([#5600](https://github.com/homarr-labs/homarr/issues/5600)) ([a1aa550](https://github.com/homarr-labs/homarr/commit/a1aa5505a365688b456090a882770e561479833e))
## [1.60.1-beta.1](https://github.com/homarr-labs/homarr/compare/v1.60.0...v1.60.1-beta.1) (2026-05-01)
### Performance Improvements
* **memory:** combine 3 node processes into one ([#5600](https://github.com/homarr-labs/homarr/issues/5600)) ([a1aa550](https://github.com/homarr-labs/homarr/commit/a1aa5505a365688b456090a882770e561479833e))
## [1.60.1-beta.1](https://github.com/homarr-labs/homarr/compare/v1.60.0...v1.60.1-beta.1) (2026-05-01)
### Performance Improvements
* **memory:** combine 3 node processes into one ([#5600](https://github.com/homarr-labs/homarr/issues/5600)) ([a1aa550](https://github.com/homarr-labs/homarr/commit/a1aa5505a365688b456090a882770e561479833e))
## [1.60.0](https://github.com/homarr-labs/homarr/compare/v1.59.3...v1.60.0) (2026-05-01)
### Features
* **about:** add opencollective contributors ([#5481](https://github.com/homarr-labs/homarr/issues/5481)) ([3d202d4](https://github.com/homarr-labs/homarr/commit/3d202d409febf33d0218b589c979744c84f87407))
### Bug Fixes
* migrate from node-cron to croner ([#5407](https://github.com/homarr-labs/homarr/issues/5407)) ([e8edc20](https://github.com/homarr-labs/homarr/commit/e8edc203b6c862141668b043ef4232c22b8fae24))
* **openapi:** openapi document empty ([#5579](https://github.com/homarr-labs/homarr/issues/5579)) ([ce8e330](https://github.com/homarr-labs/homarr/commit/ce8e330c82bc0be9f299f3071a1e80daafc5f789))
### Performance Improvements
* **icons:** updater takes 10 seconds to run with high cpu usage ([#5608](https://github.com/homarr-labs/homarr/issues/5608)) ([ed6680b](https://github.com/homarr-labs/homarr/commit/ed6680ba6a42864185818eb8d90b2303846c1761))
## [1.60.0](https://github.com/homarr-labs/homarr/compare/v1.59.3...v1.60.0) (2026-05-01)
### Features
* **about:** add opencollective contributors ([#5481](https://github.com/homarr-labs/homarr/issues/5481)) ([3d202d4](https://github.com/homarr-labs/homarr/commit/3d202d409febf33d0218b589c979744c84f87407))
### Bug Fixes
* migrate from node-cron to croner ([#5407](https://github.com/homarr-labs/homarr/issues/5407)) ([e8edc20](https://github.com/homarr-labs/homarr/commit/e8edc203b6c862141668b043ef4232c22b8fae24))
* **openapi:** openapi document empty ([#5579](https://github.com/homarr-labs/homarr/issues/5579)) ([ce8e330](https://github.com/homarr-labs/homarr/commit/ce8e330c82bc0be9f299f3071a1e80daafc5f789))
### Performance Improvements
* **icons:** updater takes 10 seconds to run with high cpu usage ([#5608](https://github.com/homarr-labs/homarr/issues/5608)) ([ed6680b](https://github.com/homarr-labs/homarr/commit/ed6680ba6a42864185818eb8d90b2303846c1761))
## [1.59.3](https://github.com/homarr-labs/homarr/compare/v1.59.2...v1.59.3) (2026-04-24)
### Bug Fixes
+2
View File
@@ -43,6 +43,8 @@ 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
-2
View File
@@ -32,8 +32,6 @@ 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: {
-2
View File
@@ -44,11 +44,9 @@
"@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:",
@@ -25,14 +25,7 @@ import {
Title,
UnstyledButton,
} from "@mantine/core";
import {
IconKeyboard,
IconLanguage,
IconLibrary,
IconMoneybagHeart,
IconPackage,
IconUsers,
} from "@tabler/icons-react";
import { IconKeyboard, IconLanguage, IconLibrary, IconPackage, IconUsers } from "@tabler/icons-react";
import { capitalize, objectEntries } from "@homarr/common";
import { hotkeys } from "@homarr/definitions";
@@ -44,7 +37,6 @@ import { createMetaTitle } from "~/metadata";
import type { PackageJsonDependencies } from "~/versions/package-reader";
import { getPackageVersion } from "~/versions/package-reader";
import type githubContributorsJson from "../../../../../../../static-data/contributors.json";
import type openCollectiveContributorsJson from "../../../../../../../static-data/opencollective-contributors.json";
import type crowdinContributorsJson from "../../../../../../../static-data/translators.json";
import classes from "./about.module.css";
@@ -79,10 +71,6 @@ export default async function AboutPage() {
res.json(),
)) as typeof crowdinContributorsJson;
const openCollectiveContributors = (await fetch(`${baseServerUrl}/api/about/contributors/opencollective`).then(
(res) => res.json(),
)) as typeof openCollectiveContributorsJson;
return (
<div>
<DynamicBreadcrumb />
@@ -148,30 +136,6 @@ export default async function AboutPage() {
</Flex>
</AccordionPanel>
</AccordionItem>
<AccordionItem value="sponsors">
<AccordionControl icon={<IconMoneybagHeart size="1rem" />}>
<Stack gap={0}>
<Text>{t("accordion.sponsors.title")}</Text>
<Text size="sm" c="dimmed">
{t("accordion.sponsors.subtitle", {
count: String(openCollectiveContributors.length),
})}
</Text>
</Stack>
</AccordionControl>
<AccordionPanel>
<Flex wrap="wrap" gap="xs">
{openCollectiveContributors.map((sponsor) => (
<GenericContributorLinkCard
key={sponsor.slug}
link={`https://opencollective.com/${sponsor.slug}`}
image={sponsor.imageUrl}
name={sponsor.name}
/>
))}
</Flex>
</AccordionPanel>
</AccordionItem>
<AccordionItem value="libraries">
<AccordionControl icon={<IconLibrary size="1rem" />}>
<Stack gap={0}>
@@ -2,7 +2,7 @@ import { headers } from "next/headers";
import { notFound } from "next/navigation";
import { Stack, Tabs, TabsList, TabsPanel, TabsTab } from "@mantine/core";
import { openApiDocument } from "@homarr/api/open-api";
import { openApiDocument } from "@homarr/api";
import { api } from "@homarr/api/server";
import { auth } from "@homarr/auth/next";
import { extractBaseUrlFromHeaders } from "@homarr/common";
@@ -30,7 +30,7 @@ export const FirstDayOfWeek = ({ user }: FirstDayOfWeekProps) => {
},
onSuccess(_, variables) {
form.setInitialValues({
firstDayOfWeek: variables.firstDayOfWeek as DayOfWeek,
firstDayOfWeek: variables.firstDayOfWeek,
});
showSuccessNotification({
message: t("user.action.changeFirstDayOfWeek.notification.success.message"),
@@ -109,7 +109,7 @@ export const WidgetPreviewPageContent = ({ kind, integrationData }: WidgetPrevie
)}
>
<Comp
options={state.options as never}
options={state.options}
integrationIds={state.integrationIds}
width={dimensions.width}
height={dimensions.height}
+2 -3
View File
@@ -2,8 +2,7 @@ import type { NextRequest } from "next/server";
import { userAgent } from "next/server";
import { createOpenApiFetchHandler } from "trpc-to-openapi";
import { createTRPCContext } from "@homarr/api";
import { openApiRouter } from "@homarr/api/open-api";
import { appRouter, createTRPCContext } from "@homarr/api";
import { API_KEY_HEADER_NAME, getSessionFromApiKeyAsync } from "@homarr/auth/api-key";
import { ipAddressFromHeaders } from "@homarr/common/server";
import { createLogger } from "@homarr/core/infrastructure/logs";
@@ -31,7 +30,7 @@ const handlerAsync = async (req: NextRequest) => {
return createOpenApiFetchHandler({
req,
endpoint: "/",
router: openApiRouter,
router: appRouter,
createContext: () => createTRPCContext({ session, headers: req.headers }),
onError({ error, path, type }) {
logger.error(new ErrorWithMetadata("tRPC Error occured", { path, type }, { cause: error }));
@@ -1,9 +0,0 @@
import { NextResponse } from "next/server";
import openCollectiveContributors from "../../../../../../../../static-data/opencollective-contributors.json";
export const GET = () => {
return NextResponse.json(openCollectiveContributors);
};
export const dynamic = "force-static";
+1 -1
View File
@@ -1,6 +1,6 @@
import { NextResponse } from "next/server";
import { openApiDocument } from "@homarr/api/open-api";
import { openApiDocument } from "@homarr/api";
import { extractBaseUrlFromHeaders } from "@homarr/common";
export function GET(request: Request) {
@@ -122,7 +122,7 @@ const InnerContent = ({ item, ...dimensions }: InnerContentProps) => {
/>
<BoardItemMenu offset={4} item={newItem} />
<Comp
options={options as never}
options={options}
integrationIds={item.integrationIds}
isEditMode={isEditMode}
boardId={board.id}
-6
View File
@@ -1,6 +0,0 @@
export async function register() {
if (process.env.NEXT_RUNTIME === "nodejs") {
await import("@homarr/tasks");
await import("@homarr/websocket");
}
}
+3 -2
View File
@@ -5,11 +5,12 @@
"license": "Apache-2.0",
"type": "module",
"exports": {
".": "./src/main.ts"
".": "./src/index.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",
@@ -23,6 +24,7 @@
"@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",
@@ -35,7 +37,6 @@
"@homarr/server-settings": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"@homarr/widgets": "workspace:^0.1.0",
"croner": "catalog:",
"dayjs": "catalog:",
"dotenv": "catalog:",
"fastify": "catalog:",
@@ -1,6 +1,7 @@
import { Cron } from "croner";
import { schedule, validate as validateCron } from "node-cron";
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";
@@ -8,7 +9,7 @@ import { cronJobConfigurations } from "@homarr/db/schema";
const logger = createLogger({ module: "jobManager" });
export class JobManager {
export class JobManager implements IJobManager {
constructor(
private db: Database,
private jobGroup: typeof cronJobGroup,
@@ -20,31 +21,28 @@ export class JobManager {
public async triggerAsync(name: JobGroupKeys): Promise<void> {
await this.jobGroup.runManuallyAsync(name);
}
public stop(name: JobGroupKeys): void {
this.jobGroup.stop(name);
public async stopAsync(name: JobGroupKeys): Promise<void> {
await this.jobGroup.stopAsync(name);
}
public async updateIntervalAsync(name: JobGroupKeys, cron: string): Promise<void> {
logger.info("Updating cron job interval", { name, expression: cron });
const job = this.jobGroup.getJobRegistry().get(name);
if (!job) throw new Error(`Job ${name} not found`);
if (!validateCron(cron)) {
throw new Error(`Invalid cron expression: ${cron}`);
}
if (job.preventCustomInterval && cron !== job.cronExpression) {
throw new Error(`Custom cron expressions are not allowed for job ${name}`);
}
const updatedConfig = await this.updateConfigurationAsync(name, { cronExpression: cron });
this.jobGroup.getTask(name)?.stop();
await this.updateConfigurationAsync(name, { cronExpression: cron });
await this.jobGroup.getTask(name)?.destroy();
this.jobGroup.setTask(
name,
new Cron(
cron,
{
name,
timezone: job.timezone,
paused: !updatedConfig.isEnabled,
},
() => void job.executeAsync(),
),
schedule(cron, () => void job.executeAsync(), {
name,
}),
);
logger.info("Cron job interval updated", { name, expression: cron });
}
@@ -54,7 +52,7 @@ export class JobManager {
if (!job) throw new Error(`Job ${name} not found`);
await this.updateConfigurationAsync(name, { isEnabled: false });
this.jobGroup.stop(name);
await this.jobGroup.stopAsync(name);
logger.info("Cron job disabled", { name });
}
public async enableAsync(name: JobGroupKeys): Promise<void> {
@@ -88,27 +86,21 @@ export class JobManager {
name,
configuration: JSON.stringify(configuration),
});
return {
name,
cronExpression: configuration.cronExpression ?? existingConfig.cronExpression,
isEnabled: configuration.isEnabled ?? existingConfig.isEnabled,
};
return;
}
const job = this.jobGroup.getJobRegistry().get(name);
if (!job) throw new Error(`Job ${name} not found`);
const updatedConfig = {
await this.db.insert(cronJobConfigurations).values({
name,
cronExpression: configuration.cronExpression ?? job.cronExpression,
isEnabled: configuration.isEnabled ?? true,
};
await this.db.insert(cronJobConfigurations).values(updatedConfig);
});
logger.debug("Cron job configuration updated", {
name,
configuration: JSON.stringify(configuration),
});
return updatedConfig;
}
public async getAllAsync(): Promise<
+41 -1
View File
@@ -1,12 +1,52 @@
// 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 { jobGroup } from "@homarr/cron-jobs";
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 { JobManager } from "./job-manager";
import { onStartAsync } from "./on-start";
const logger = createLogger({ module: "tasksMain" });
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"],
});
void (async () => {
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);
}
})();
+1 -3
View File
@@ -4,12 +4,10 @@
"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",
+2 -2
View File
@@ -4,10 +4,10 @@
"dependencies": {
"better-sqlite3": "^12.9.0"
},
"packageManager": "pnpm@10.33.2",
"packageManager": "pnpm@10.33.1",
"engines": {
"node": ">=24.15.0",
"pnpm": ">=10.33.2"
"pnpm": ">=10.33.1"
},
"pnpm": {
"onlyBuiltDependencies": [
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "homarr",
"version": "1.60.1-beta.1",
"version": "1.59.3",
"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": "pnpm -F nextjs dev",
"dev": "turbo dev --parallel",
"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",
@@ -59,10 +59,10 @@
"vite-tsconfig-paths": "catalog:",
"vitest": "catalog:"
},
"packageManager": "pnpm@10.33.2",
"packageManager": "pnpm@10.33.1",
"engines": {
"node": ">=24.15.0",
"pnpm": ">=10.33.2"
"pnpm": ">=10.33.1"
},
"pnpm": {
"onlyBuiltDependencies": [
@@ -79,12 +79,12 @@
"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.15.2",
"axios@>=1.0.0 <1.8.2": ">=1.15.1",
"brace-expansion@>=2.0.0 <=2.0.1": ">=5.0.5",
"brace-expansion@>=1.0.0 <=1.1.11": ">=5.0.5",
"esbuild@<=0.24.2": ">=0.28.0",
"form-data@>=4.0.0 <4.0.4": ">=4.0.5",
"hono@<4.6.5": ">=4.12.15",
"hono@<4.6.5": ">=4.12.14",
"linkifyjs@<4.3.2": ">=4.3.2",
"nanoid@>=4.0.0 <5.0.9": ">=5.1.9",
"prismjs@<1.30.0": ">=1.30.0",
@@ -95,7 +95,7 @@
"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.10"
"vite@>=5.0.0 <=5.4.18": ">=8.0.9"
},
"patchedDependencies": {
"@types/node-unifi": "patches/@types__node-unifi.patch",
+2 -2
View File
@@ -9,8 +9,7 @@
"./client": "./src/client.ts",
"./server": "./src/server.ts",
"./websocket": "./src/websocket.ts",
"./shared": "./src/shared.ts",
"./open-api": "./src/open-api.ts"
"./shared": "./src/shared.ts"
},
"main": "./index.ts",
"types": "./index.ts",
@@ -25,6 +24,7 @@
"@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 -1
View File
@@ -1,5 +1,6 @@
import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server";
import { openApiDocument } from "./open-api";
import type { AppRouter } from "./root";
import { appRouter } from "./root";
import { createCallerFactory, createTRPCContext } from "./trpc";
@@ -29,5 +30,5 @@ type RouterInputs = inferRouterInputs<AppRouter>;
**/
type RouterOutputs = inferRouterOutputs<AppRouter>;
export { createTRPCContext, appRouter, createCaller };
export { createTRPCContext, appRouter, createCaller, openApiDocument };
export type { AppRouter, RouterInputs, RouterOutputs };
+2 -13
View File
@@ -2,21 +2,10 @@ import { generateOpenApiDocument } from "trpc-to-openapi";
import { API_KEY_HEADER_NAME } from "@homarr/auth/api-key";
import { appRouter } from "./router/app";
import { infoRouter } from "./router/info";
import { inviteRouter } from "./router/invite";
import { userRouter } from "./router/user";
import { createTRPCRouter } from "./trpc";
export const openApiRouter = createTRPCRouter({
appRouter,
infoRouter,
inviteRouter,
userRouter,
});
import { appRouter } from "./root";
export const openApiDocument = (base: string) =>
generateOpenApiDocument(openApiRouter, {
generateOpenApiDocument(appRouter, {
title: "Homarr API documentation",
version: "1.0.0",
baseUrl: base,
+17 -20
View File
@@ -2,62 +2,59 @@ import { observable } from "@trpc/server/observable";
import z from "zod/v4";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { cronExpressionSchema, 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, ctx }) => {
await new JobManager(ctx.db, jobGroup).triggerAsync(input);
.mutation(async ({ input }) => {
await cronJobApi.trigger.mutate(input);
}),
startJob: permissionRequiredProcedure
.requiresPermission("admin")
.input(jobNameSchema)
.mutation(async ({ input, ctx }) => {
await new JobManager(ctx.db, jobGroup).startAsync(input);
.mutation(async ({ input }) => {
await cronJobApi.start.mutate(input);
}),
stopJob: permissionRequiredProcedure
.requiresPermission("admin")
.input(jobNameSchema)
.mutation(({ input, ctx }) => {
new JobManager(ctx.db, jobGroup).stop(input);
.mutation(async ({ input }) => {
await cronJobApi.stop.mutate(input);
}),
updateJobInterval: permissionRequiredProcedure
.requiresPermission("admin")
.input(
z.object({
name: jobNameSchema,
cron: z.string(),
cron: cronExpressionSchema,
}),
)
.mutation(async ({ input, ctx }) => {
await new JobManager(ctx.db, jobGroup).updateIntervalAsync(input.name, input.cron);
.mutation(async ({ input }) => {
await cronJobApi.updateInterval.mutate(input);
}),
disableJob: permissionRequiredProcedure
.requiresPermission("admin")
.input(jobNameSchema)
.mutation(async ({ input, ctx }) => {
await new JobManager(ctx.db, jobGroup).disableAsync(input);
.mutation(async ({ input }) => {
await cronJobApi.disable.mutate(input);
}),
enableJob: permissionRequiredProcedure
.requiresPermission("admin")
.input(jobNameSchema)
.mutation(async ({ input, ctx }) => {
await new JobManager(ctx.db, jobGroup).enableAsync(input);
.mutation(async ({ input }) => {
await cronJobApi.enable.mutate(input);
}),
getJobs: permissionRequiredProcedure.requiresPermission("admin").query(async ({ ctx }) => {
return await new JobManager(ctx.db, jobGroup).getAllAsync();
getJobs: permissionRequiredProcedure.requiresPermission("admin").query(async () => {
return await cronJobApi.getAll.query();
}),
subscribeToStatusUpdates: permissionRequiredProcedure.requiresPermission("admin").subscription(() => {
return observable<TaskStatus>((emit) => {
@@ -5,11 +5,11 @@ import { MemoryResourceParser } from "../../../kubernetes/resource-parser/memory
const BYTES_IN_GIB = 1024 ** 3; // 1 GiB in bytes
const BYTES_IN_MIB = 1024 ** 2; // 1 MiB in bytes
const BYTES_IN_KIB = 1024; // 1 KiB in bytes
const KI = "Ki";
const MI = "Mi";
const GI = "Gi";
const TI = "Ti";
const PI = "Pi";
const KI_UNIT = "Ki";
const MI_UNIT = "Mi";
const GI_UNIT = "Gi";
const TI_UNIT = "Ti";
const PI_UNIT = "Pi";
describe("MemoryResourceParser", () => {
const parser = new MemoryResourceParser();
@@ -20,11 +20,11 @@ describe("MemoryResourceParser", () => {
});
it("should parse binary units (Ki, Mi, Gi, Ti, Pi) into GiB", () => {
expect(parser.parse(`1024${KI}`)).toBeCloseTo(1 / 1024); // 1 MiB = 1/1024 GiB
expect(parser.parse(`1${MI}`)).toBeCloseTo(1 / 1024); // 1 MiB = 1/1024 GiB
expect(parser.parse(`1${GI}`)).toBe(1); // 1 GiB
expect(parser.parse(`1${TI}`)).toBe(BYTES_IN_KIB); // 1 TiB = 1024 GiB
expect(parser.parse(`1${PI}`)).toBe(BYTES_IN_MIB); // 1 PiB = 1024^2 GiB
expect(parser.parse(`1024${KI_UNIT}`)).toBeCloseTo(1 / 1024); // 1 MiB = 1/1024 GiB
expect(parser.parse(`1${MI_UNIT}`)).toBeCloseTo(1 / 1024); // 1 MiB = 1/1024 GiB
expect(parser.parse(`1${GI_UNIT}`)).toBe(1); // 1 GiB
expect(parser.parse(`1${TI_UNIT}`)).toBe(BYTES_IN_KIB); // 1 TiB = 1024 GiB
expect(parser.parse(`1${PI_UNIT}`)).toBe(BYTES_IN_MIB); // 1 PiB = 1024^2 GiB
});
it("should parse decimal units (K, M, G, T, P) into GiB", () => {
+1 -1
View File
@@ -38,7 +38,7 @@ export const createSessionAsync = async (
permissions: await getCurrentUserPermissionsAsync(db, user.id),
colorScheme: "dark",
},
} as Session;
};
};
export const createSessionCallback = (db: Database): NextAuthCallbackOf<"session"> => {
@@ -40,7 +40,12 @@ export class LdapClient {
* @param options search options
* @returns list of search results
*/
public async searchAsync({ base, options }: SearchOptions) {
public async searchAsync({ base, options }: SearchOptions): Promise<
{
[key: string]: string;
dn: string;
}[]
> {
const { searchEntries } = await this.client.search(base, options);
return searchEntries.map((entry) => {
@@ -49,9 +54,6 @@ export class LdapClient {
.map(([key, value]) => [key, LdapClient.convertEntryPropertyToString(value)] as const)
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {} as Record<string, string>),
dn: LdapClient.getEntryDn(entry),
} as {
[key: string]: string;
dn: string;
};
});
}
-4
View File
@@ -41,10 +41,6 @@ export class Stopwatch {
return dayjs().millisecond(this.startTime).fromNow(true);
}
getElapsedInFormattedMilliseconds() {
return `${this.getElapsedInMilliseconds().toFixed(0)}ms`;
}
getElapsedInMilliseconds() {
return performance.now() - this.startTime;
}
+9
View File
@@ -0,0 +1,9 @@
import baseConfig from "@homarr/eslint-config/base";
/** @type {import('typescript-eslint').Config} */
export default [
{
ignores: [],
},
...baseConfig,
];
+48
View File
@@ -0,0 +1,48 @@
{
"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:",
"node-cron": "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/node-cron": "catalog:",
"@types/react": "catalog:",
"eslint": "catalog:",
"typescript": "catalog:"
}
}
+20
View File
@@ -0,0 +1,20 @@
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}`;
}
+3
View File
@@ -0,0 +1,3 @@
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";
+11
View File
@@ -0,0 +1,11 @@
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,
});
+90
View File
@@ -0,0 +1,90 @@
import { initTRPC, TRPCError } from "@trpc/server";
import { validate } from "node-cron";
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>;
stopAsync(name: JobGroupKeys): Promise<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 cronExpressionSchema = z.string().refine((expression) => validate(expression), {
error: "Invalid cron expression",
});
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(async ({ input, ctx }) => {
await ctx.manager.stopAsync(input);
}),
updateInterval: apiKeyProcedure
.input(
z.object({
name: jobNameSchema,
cron: cronExpressionSchema,
}),
)
.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;
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "@homarr/tsconfig/base.json",
"compilerOptions": {
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
},
"include": ["*.ts", "src"],
"exclude": ["node_modules"]
}
+2 -1
View File
@@ -27,12 +27,13 @@
"@homarr/common": "workspace:^0.1.0",
"@homarr/core": "workspace:^",
"@homarr/db": "workspace:^0.1.0",
"croner": "catalog:"
"node-cron": "catalog:"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
"@homarr/prettier-config": "workspace:^0.1.0",
"@homarr/tsconfig": "workspace:^0.1.0",
"@types/node-cron": "catalog:",
"eslint": "catalog:",
"typescript": "catalog:"
}
+12 -11
View File
@@ -1,4 +1,4 @@
import { Cron } from "croner";
import { createTask, validate } from "node-cron";
import { Stopwatch } from "@homarr/common";
import type { MaybePromise } from "@homarr/common/types";
@@ -83,15 +83,10 @@ const createCallback = <TAllowedNames extends string, TName extends TAllowedName
? defaultCronExpression
: (configuration?.cronExpression ?? defaultCronExpression);
const scheduledTask = new Cron(
cronExpression,
{
name,
timezone: creatorOptions.timezone,
paused: true,
},
() => void catchingCallbackAsync(),
);
const scheduledTask = createTask(cronExpression, () => void catchingCallbackAsync(), {
name,
timezone: creatorOptions.timezone,
});
creatorOptions.logger.logDebug("The scheduled task for cron job was created", {
name,
cronExpression: defaultCronExpression,
@@ -121,7 +116,6 @@ const createCallback = <TAllowedNames extends string, TName extends TAllowedName
},
preventManualExecution: options.preventManualExecution ?? false,
preventCustomInterval: options.preventCustomInterval ?? false,
timezone: creatorOptions.timezone,
};
};
};
@@ -138,6 +132,13 @@ export const createCronJobCreator = <TAllowedNames extends string = string>(
defaultCronExpression: TExpression,
options: CreateCronJobOptions = { runOnStart: false },
) => {
creatorOptions.logger.logDebug("Validating cron expression for cron job", {
name,
cronExpression: defaultCronExpression,
});
if (!validate(defaultCronExpression)) {
throw new Error(`Invalid cron expression '${defaultCronExpression}' for job '${name}'`);
}
creatorOptions.logger.logDebug("Cron job expression for cron job is valid", {
name,
cronExpression: defaultCronExpression,
+11 -11
View File
@@ -1,4 +1,4 @@
import type { Cron } from "croner";
import type { ScheduledTask } from "node-cron";
import { objectEntries, objectKeys } from "@homarr/common";
import { db } from "@homarr/db";
@@ -34,7 +34,7 @@ export const createJobGroupCreator = <TAllowedNames extends string = string>(
});
}
const tasks = new Map<string, Cron>();
const tasks = new Map<string, ScheduledTask>();
return {
initializeAsync: async () => {
@@ -62,7 +62,7 @@ export const createJobGroupCreator = <TAllowedNames extends string = string>(
name: job.name,
});
await job.onStartAsync();
tasks.get(name as string)?.resume();
await tasks.get(name as string)?.start();
},
startAllAsync: async () => {
for (const job of jobRegistry.values()) {
@@ -74,7 +74,7 @@ export const createJobGroupCreator = <TAllowedNames extends string = string>(
name: job.name,
});
await job.onStartAsync();
tasks.get(job.name)?.resume();
await tasks.get(job.name)?.start();
}
},
runManuallyAsync: async (name: keyof TJobs) => {
@@ -87,23 +87,23 @@ export const createJobGroupCreator = <TAllowedNames extends string = string>(
options.logger.logInfo("Running schedule cron job manually.", {
name: job.name,
});
await tasks.get(name as string)?.trigger();
await tasks.get(name as string)?.execute();
},
stop: (name: keyof TJobs) => {
stopAsync: async (name: keyof TJobs) => {
const job = jobRegistry.get(name as string);
if (!job) return;
options.logger.logInfo("Stopping schedule of cron job.", {
name: job.name,
});
tasks.get(name as string)?.pause();
await tasks.get(name as string)?.stop();
},
stopAll: () => {
stopAllAsync: async () => {
for (const job of jobRegistry.values()) {
options.logger.logInfo("Stopping schedule of cron job.", {
name: job.name,
});
tasks.get(job.name)?.pause();
await tasks.get(job.name)?.stop();
}
},
getJobRegistry() {
@@ -112,8 +112,8 @@ export const createJobGroupCreator = <TAllowedNames extends string = string>(
getTask(name: keyof TJobs) {
return tasks.get(name as string) ?? null;
},
setTask(name: keyof TJobs, cron: Cron) {
tasks.set(name as string, cron);
setTask(name: keyof TJobs, task: ScheduledTask) {
tasks.set(name as string, task);
},
getKeys() {
return objectKeys(jobs);
+2 -4
View File
@@ -5,8 +5,7 @@
"license": "Apache-2.0",
"type": "module",
"exports": {
".": "./index.ts",
"./job-manager": "./src/job-manager.ts"
".": "./index.ts"
},
"typesVersions": {
"*": {
@@ -39,8 +38,7 @@
"@homarr/server-settings": "workspace:^0.1.0",
"@homarr/translation": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"semver-parser": "catalog:",
"zod": "catalog:"
"semver-parser": "catalog:"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
+28 -39
View File
@@ -27,44 +27,33 @@ import { updateCheckerJob } from "./jobs/update-checker";
import { weatherJob } from "./jobs/weather";
import { createCronJobGroup } from "./lib";
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,
});
};
// Add global type augmentation for homarr
declare global {
var cronJobs: ReturnType<typeof getJobGroup> | undefined;
}
global.cronJobs ??= getJobGroup();
export const jobGroup = global.cronJobs;
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,
});
export type JobGroupKeys = ReturnType<(typeof jobGroup)["getKeys"]>[number];
+52 -44
View File
@@ -1,12 +1,9 @@
import type { MySqlRawQueryResult } from "drizzle-orm/mysql2";
import type { QueryResult } from "pg";
import { createId, splitToNChunks, Stopwatch } from "@homarr/common";
import { env } from "@homarr/common/env";
import { createLogger } from "@homarr/core/infrastructure/logs";
import { EVERY_WEEK } from "@homarr/cron-jobs-core/expressions";
import type { InferInsertModel } from "@homarr/db";
import { and, db, eq, handleTransactionsAsync, inArray, notInArray, or } from "@homarr/db";
import { db, handleTransactionsAsync, inArray, sql } from "@homarr/db";
import { iconRepositories, icons } from "@homarr/db/schema";
import { fetchIconsAsync } from "@homarr/icons";
@@ -29,7 +26,7 @@ export const iconsUpdaterJob = createCronJob("iconsUpdater", EVERY_WEEK, {
logger.info("Fetched icons from repositories", {
repositoryCount: repositoryIconGroups.length,
iconCount: countIcons,
duration: stopWatch.getElapsedInFormattedMilliseconds(),
duration: stopWatch.getElapsedInHumanWords(),
});
const databaseIconRepositories = await db.query.iconRepositories.findMany({
@@ -38,7 +35,7 @@ export const iconsUpdaterJob = createCronJob("iconsUpdater", EVERY_WEEK, {
},
});
const skippedChecksums = new Map<string, string[]>();
const skippedChecksums: `${string}.${string}`[] = [];
let countDeleted = 0;
let countInserted = 0;
@@ -53,7 +50,6 @@ export const iconsUpdaterJob = createCronJob("iconsUpdater", EVERY_WEEK, {
if (!repositoryIconGroup.success) {
continue;
}
const localSkippedChecksums: string[] = [];
const repositoryInDb = databaseIconRepositories.find(
(dbIconGroup) => dbIconGroup.slug === repositoryIconGroup.slug,
@@ -70,7 +66,7 @@ export const iconsUpdaterJob = createCronJob("iconsUpdater", EVERY_WEEK, {
for (const icon of repositoryIconGroup.icons) {
if (dbIconsInRepository.some((dbIcon) => dbIcon.checksum === icon.checksum)) {
localSkippedChecksums.push(icon.checksum);
skippedChecksums.push(`${iconRepositoryId}.${icon.checksum}`);
continue;
}
@@ -83,38 +79,19 @@ export const iconsUpdaterJob = createCronJob("iconsUpdater", EVERY_WEEK, {
});
countInserted++;
}
skippedChecksums.set(iconRepositoryId, localSkippedChecksums);
}
const deadIcons = allDbIcons.filter(
(icon) => !skippedChecksums.includes(`${icon.iconRepositoryId}.${icon.checksum}`),
);
const deadIconRepositories = databaseIconRepositories.filter(
(iconRepository) => !repositoryIconGroups.some((group) => group.slug === iconRepository.slug),
);
const deadIconsFilter = or(
...[...skippedChecksums.entries()].map(([iconRepositoryId, checksums]) =>
and(eq(icons.iconRepositoryId, iconRepositoryId), notInArray(icons.checksum, checksums)),
),
);
await handleTransactionsAsync(db, {
async handleAsync(db, schema) {
await db.transaction(async (transaction) => {
const result = (await transaction.delete(schema.icons).where(deadIconsFilter)) as
| MySqlRawQueryResult
| QueryResult;
countDeleted += Array.isArray(result) ? result[0].affectedRows : (result.rowCount ?? 0);
if (deadIconRepositories.length >= 1) {
await transaction.delete(schema.iconRepositories).where(
inArray(
iconRepositories.id,
deadIconRepositories.map((iconRepository) => iconRepository.id),
),
);
}
if (newIconRepositories.length >= 1) {
await transaction.insert(schema.iconRepositories).values(newIconRepositories);
}
@@ -125,12 +102,52 @@ export const iconsUpdaterJob = createCronJob("iconsUpdater", EVERY_WEEK, {
await transaction.insert(schema.icons).values(chunck);
}
}
if (deadIcons.length >= 1) {
await transaction.delete(schema.icons).where(
inArray(
// Combine iconRepositoryId and checksum to allow same icons on different repositories
sql`concat(${icons.iconRepositoryId}, '.', ${icons.checksum})`,
deadIcons.map((icon) => `${icon.iconRepositoryId}.${icon.checksum}`),
),
);
}
if (deadIconRepositories.length >= 1) {
await transaction.delete(schema.iconRepositories).where(
inArray(
iconRepositories.id,
deadIconRepositories.map((iconRepository) => iconRepository.id),
),
);
}
countDeleted += deadIcons.length;
});
},
handleSync() {
db.transaction((transaction) => {
const result = transaction.delete(icons).where(deadIconsFilter).run();
countDeleted += result.changes;
if (newIconRepositories.length >= 1) {
transaction.insert(iconRepositories).values(newIconRepositories).run();
}
if (newIcons.length >= 1) {
// We only insert 5000 icons at a time to avoid SQLite limitations
for (const chunck of splitToNChunks(newIcons, Math.ceil(newIcons.length / 5000))) {
transaction.insert(icons).values(chunck).run();
}
}
if (deadIcons.length >= 1) {
transaction
.delete(icons)
.where(
inArray(
// Combine iconRepositoryId and checksum to allow same icons on different repositories
sql`concat(${icons.iconRepositoryId}, '.', ${icons.checksum})`,
deadIcons.map((icon) => `${icon.iconRepositoryId}.${icon.checksum}`),
),
)
.run();
}
if (deadIconRepositories.length >= 1) {
transaction
@@ -144,22 +161,13 @@ export const iconsUpdaterJob = createCronJob("iconsUpdater", EVERY_WEEK, {
.run();
}
if (newIconRepositories.length >= 1) {
transaction.insert(iconRepositories).values(newIconRepositories).run();
}
if (newIcons.length >= 1) {
// We only insert 5000 icons at a time to avoid SQLite limitations
for (const chunck of splitToNChunks(newIcons, Math.ceil(newIcons.length / 5000))) {
transaction.insert(icons).values(chunck).run();
}
}
countDeleted += deadIcons.length;
});
},
});
logger.info("Updated icons in database", {
duration: stopWatch.getElapsedInFormattedMilliseconds(),
duration: stopWatch.getElapsedInHumanWords(),
added: countInserted,
deleted: countDeleted,
});
+1 -1
View File
@@ -50,7 +50,7 @@ export const createDbInsertCollectionForTransaction = <TTableKey extends TableKe
for (const [key, values] of objectEntries(context)) {
if (values.length >= 1) {
// Below is actually the mysqlSchema when the driver is mysql
await transaction.insert(schema[key] as never).values(values as never);
await transaction.insert(schema[key] as never).values(values);
}
}
});
-2
View File
@@ -37,8 +37,6 @@
"push:sqlite": "pnpm with-env drizzle-kit push --config ./configs/sqlite.config.ts",
"seed": "pnpm with-env tsx ./migrations/run-seed.ts",
"studio": "pnpm with-env drizzle-kit studio --config ./configs/sqlite.config.ts",
"studio:mysql": "pnpm with-env drizzle-kit studio --config ./configs/mysql.config.ts",
"studio:postgresql": "pnpm with-env drizzle-kit studio --config ./configs/postgresql.config.ts",
"typecheck": "tsc --noEmit",
"with-env": "dotenv -e ../../.env --"
},
@@ -36,7 +36,7 @@ const setupMockFetch = (responses: Record<string, MockResponseData>) => {
new Response(body, {
status: 200,
headers: { "content-type": "application/json" },
}) as unknown as Awaited<ReturnType<typeof fetchWithTrustedCertificatesAsync>>,
}),
);
}
@@ -44,7 +44,7 @@ const setupMockFetch = (responses: Record<string, MockResponseData>) => {
new Response(JSON.stringify({ error: "Not Found" }), {
status: 404,
headers: { "content-type": "application/json" },
}) as unknown as Awaited<ReturnType<typeof fetchWithTrustedCertificatesAsync>>,
}),
);
});
};
@@ -82,7 +82,7 @@ describe("CoolifyIntegration", () => {
new Response("Unauthorized", {
status: 401,
headers: { "content-type": "text/plain" },
}) as unknown as Awaited<ReturnType<typeof fetchWithTrustedCertificatesAsync>>,
}),
);
const integration = createCoolifyIntegration();
+2 -4
View File
@@ -1,13 +1,12 @@
import { join } from "path";
import { GenericContainer, getContainerRuntimeClient, ImageName, Wait } from "testcontainers";
import type { StartedTestContainer } from "testcontainers";
import { GenericContainer, getContainerRuntimeClient, ImageName, Wait } from "testcontainers";
import { beforeAll, describe, expect, test, vi } from "vitest";
import { createDb } from "@homarr/db/test";
import { SabnzbdIntegration } from "../src";
import { TestConnectionError } from "../src/base/test-connection/test-connection-error";
import type { DownloadClientItem } from "../src/interfaces/downloads/download-client-items";
vi.mock("@homarr/db", async (importActual) => {
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
@@ -189,8 +188,7 @@ describe("Sabnzbd integration", () => {
const item = await sabNzbdAddItemAsync(startedContainer, DEFAULT_API_KEY, sabnzbdIntegration);
// Act - fromDisk already doesn't work for sabnzbd, so only test deletion itself.
const actAsync = async () =>
await sabnzbdIntegration.deleteItemAsync({ ...item, progress: 0 } as DownloadClientItem, false);
const actAsync = async () => await sabnzbdIntegration.deleteItemAsync({ ...item, progress: 0 }, false);
const getAsync = async () => await sabnzbdIntegration.getClientJobsAndStatusAsync({ limit: 99 });
// Assert
+2
View File
@@ -73,6 +73,8 @@ async function getContainersWithStatsAsync() {
cpuUsage,
memoryUsage,
image: container.Image,
// In some cases the type of Ports can also be undefined
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
ports: container.Ports as Dockerode.Port[] | undefined,
};
});
+4
View File
@@ -36,9 +36,13 @@ export const defaultServerSettings = {
enableGravatar: true,
},
appearance: {
// We want to force the type to be bigger than just "light" to allow other values
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
defaultColorScheme: "light" as ColorScheme,
},
culture: {
// We want to force the type to be bigger than just "light" to allow other values
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
defaultLocale: "en" as SupportedLanguage,
},
search: {
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
+25 -29
View File
@@ -1614,22 +1614,22 @@
"label": ""
},
"showTitle": {
"label": "显示标题"
"label": ""
},
"showUpdatedAt": {
"label": "显示最近更新"
"label": ""
}
},
"empty": "选择要显示的笔记",
"emptyContent": "此笔记没有内容",
"notFound": "未找到笔记",
"empty": "",
"emptyContent": "",
"notFound": "",
"noNotes": "",
"integrationRequired": "",
"updatedAt": "更新时间:{date}",
"untitled": "未命名",
"edit": "编辑",
"save": "保存",
"cancel": "取消",
"updatedAt": "",
"untitled": "",
"edit": "",
"save": "",
"cancel": "",
"readOnlyViewer": "",
"saveForbidden": "",
"saveFailed": ""
@@ -1901,7 +1901,7 @@
"label": "显示内存信息"
},
"gpu": {
"label": "显示 GPU 信息"
"label": ""
},
"showUptime": {
"label": "显示运行时间"
@@ -2200,15 +2200,15 @@
"description": ""
},
"showPhotos": {
"label": "显示图片",
"label": "",
"description": ""
},
"showVideos": {
"label": "显示视频",
"label": "",
"description": ""
},
"showStorage": {
"label": "显示存储",
"label": "",
"description": ""
}
},
@@ -2229,7 +2229,7 @@
"description": ""
},
"showPhotoInfo": {
"label": "显示图片信息",
"label": "",
"description": ""
}
},
@@ -2783,17 +2783,17 @@
"recentResults": "",
"recentResultsSpeed": "",
"recentResultsPing": "",
"download": "下载",
"upload": "上传",
"ping": "Ping",
"status": "状态",
"avgDownload": "平均下载",
"avgUpload": "平均上传",
"avgPing": "平均Ping",
"download": "",
"upload": "",
"ping": "",
"status": "",
"avgDownload": "",
"avgUpload": "",
"avgPing": "",
"healthy": "",
"unhealthy": "",
"ok": "",
"fail": "失败",
"fail": "",
"noSectionsEnabled": "",
"error": {
"internalServerError": ""
@@ -2812,7 +2812,7 @@
"option": {
"cpu": "CPU",
"memory": "内存",
"gpu": "GPU",
"gpu": "",
"network": "网络"
}
},
@@ -2829,7 +2829,7 @@
"card": {
"cpu": "CPU",
"memory": "内存",
"gpu": "GPU",
"gpu": "",
"network": "网络",
"up": "上传",
"down": "下载"
@@ -3790,10 +3790,6 @@
"title": "翻译人员",
"subtitle": "在许多语言中,有{count}人贡献了翻译"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "相关的库",
"subtitle": "{count} 用于 Homarr 代码中"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "crwdns1884:0crwdne1884:0",
"subtitle": "crwdns1886:0{count}crwdne1886:0"
},
"sponsors": {
"title": "crwdns4100:0crwdne4100:0",
"subtitle": "crwdns4102:0{count}crwdne4102:0"
},
"libraries": {
"title": "crwdns1888:0crwdne1888:0",
"subtitle": "crwdns1890:0{count}crwdne1890:0"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Překladatelé",
"subtitle": "{count} přispívá překladem do mnoha jazyků"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Oversættere",
"subtitle": "{count} bidragende oversættere på mange sprog"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Biblioteker",
"subtitle": "{count} brugt i koden for Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Übersetzer",
"subtitle": "{count} tragen Übersetzungen in viele Sprachen bei"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Bibliotheken",
"subtitle": "{count} im Code von Homarr verwendet"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Übersetzer",
"subtitle": "{count} tragen Übersetzungen in viele Sprachen bei"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Bibliotheken",
"subtitle": "{count} im Code von Homarr verwendet"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
+18 -22
View File
@@ -1607,32 +1607,32 @@
}
},
"anchorNote": {
"name": "Anchor Note",
"description": "Displays a selected note from Anchor",
"name": "",
"description": "",
"option": {
"noteId": {
"label": "Note"
"label": ""
},
"showTitle": {
"label": "Show title"
"label": ""
},
"showUpdatedAt": {
"label": "Show last updated"
"label": ""
}
},
"empty": "Select a note to display",
"emptyContent": "This note has no content",
"notFound": "Note not found",
"noNotes": "No notes found",
"integrationRequired": "Select an Anchor integration first",
"updatedAt": "Updated {date}",
"untitled": "Untitled",
"edit": "Edit",
"save": "Save",
"cancel": "Cancel",
"readOnlyViewer": "You have viewer access to this note. Editing is disabled.",
"saveForbidden": "You do not have permission to edit this note.",
"saveFailed": "Failed to save this note. Please try again."
"empty": "",
"emptyContent": "",
"notFound": "",
"noNotes": "",
"integrationRequired": "",
"updatedAt": "",
"untitled": "",
"edit": "",
"save": "",
"cancel": "",
"readOnlyViewer": "",
"saveForbidden": "",
"saveFailed": ""
},
"iframe": {
"name": "iFrame",
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Translators",
"subtitle": "{count} contributing translations in many languages"
},
"sponsors": {
"title": "Sponsors",
"subtitle": "{count} supporting the project financially"
},
"libraries": {
"title": "Libraries",
"subtitle": "{count} used in the Code of Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Traductores",
"subtitle": "{count} contribuyendo con las traducciones en muchos idiomas"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Librerías",
"subtitle": "{count} usadas en el Código de Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Traducteurs",
"subtitle": "{count} ont contribué à des traductions dans de nombreuses langues"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Bibliothèques",
"subtitle": "{count} utilisés dans le Code d'Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "מתרגמים",
"subtitle": "{count} תורמים בתרגום לשפות שונות"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "ספריות",
"subtitle": "{count} בשימוש בקוד של Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Traduttori",
"subtitle": "{count} contribuendo alle traduzioni in molte lingue"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Librerie",
"subtitle": "{count} utilizzato nel Codice di Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "翻訳者",
"subtitle": "{count} の多くの言語で翻訳を行っている"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "ライブラリ",
"subtitle": "{count} 個が Homarr のコードで使用されています"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Vertalers",
"subtitle": "{count} bijdragen aan vertalingen in vele talen"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Bibliotheken",
"subtitle": "{count} gebruikt in de code van Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Oversettere",
"subtitle": "{count} bidrar med oversettelser på mange språk"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Biblioteker",
"subtitle": "{count} brukt i koden til Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Tłumacze",
"subtitle": "{count} współtworzy tłumaczenia w wielu językach"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Biblioteki",
"subtitle": "{count} używanych w kodzie Homarr"
+1 -5
View File
@@ -164,7 +164,7 @@
},
"action": {
"login": {
"label": "Login",
"label": "“Login”",
"labelWith": "Iniciar sessão com {provider}",
"notification": {
"success": {
@@ -3790,10 +3790,6 @@
"title": "Tradutores",
"subtitle": "{count} traduções contribuídas em vários idiomas"
},
"sponsors": {
"title": "Apoiadores",
"subtitle": "{count} apoiando o projeto financeiramente"
},
"libraries": {
"title": "Bibliotecas",
"subtitle": "{count} usadas no código do Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Переводчики",
"subtitle": "{count} помогают с переводами на разные языки"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Библиотеки",
"subtitle": "{count} используются в коде Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Prekladatelia",
"subtitle": "{count} prispievanie prekladmi do mnohých jazykov"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Knižnice",
"subtitle": "{count} používané v Homarrskom kódexe"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Översättare",
"subtitle": "{count} bidrar med översättningar på flera olika språk"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Çevirmenler",
"subtitle": "Birçok kişi Homarr'ın {count} dile çevrilmesine katkı sağlıyor"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Kütüphaneler",
"subtitle": "Homarr kodlamasında {count} kütüphane kullanılıyor"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "Перекладачі",
"subtitle": "{count} - стільки людей допомагають перекладати багатьма мовами"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "Бібліотеки",
"subtitle": "{count} - стільки бібліотек використано в коді Homarr"
-4
View File
@@ -3790,10 +3790,6 @@
"title": "",
"subtitle": ""
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "",
"subtitle": ""
-4
View File
@@ -3790,10 +3790,6 @@
"title": "翻譯人員",
"subtitle": "{count} 翻譯了許多語言"
},
"sponsors": {
"title": "",
"subtitle": ""
},
"libraries": {
"title": "資料庫",
"subtitle": "{count} 於 Homarr 待碼中使用"
+8 -4
View File
@@ -138,10 +138,14 @@ export const userChangeColorSchemeSchema = z.object({
export const userFirstDayOfWeekSchema = z.object({
firstDayOfWeek: z
.number()
.min(0)
.max(6)
.transform((value) => value as DayOfWeek),
.custom<DayOfWeek>((value) => z.number().min(0).max(6).safeParse(value).success)
.meta({
override: {
type: "integer",
minimum: 0,
maximum: 6,
},
}),
});
export const userPingIconsEnabledSchema = z.object({
@@ -198,25 +198,23 @@ const Item = <TItem, TOptionValue extends UniqueIdentifier>({
shadow="xs"
padding="sm"
radius="md"
style={
{
transition: [transition].filter(Boolean).join(", "),
"--translate-x": transform ? `${Math.round(transform.x)}px` : undefined,
"--translate-y": transform ? `${Math.round(transform.y)}px` : undefined,
"--scale-x": transform?.scaleX ? `${transform.scaleX}` : undefined,
"--scale-y": transform?.scaleY ? `${transform.scaleY}` : undefined,
"--index": index,
transform:
"translate3d(var(--translate-x, 0), var(--translate-y, 0), 0) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1))",
transformOrigin: "0 0",
...(isDragging
? {
opacity: "var(--dragging-opacity, 0.5)",
zIndex: 0,
}
: {}),
} as React.CSSProperties
}
style={{
transition: [transition].filter(Boolean).join(", "),
"--translate-x": transform ? `${Math.round(transform.x)}px` : undefined,
"--translate-y": transform ? `${Math.round(transform.y)}px` : undefined,
"--scale-x": transform?.scaleX ? `${transform.scaleX}` : undefined,
"--scale-y": transform?.scaleY ? `${transform.scaleY}` : undefined,
"--index": index,
transform:
"translate3d(var(--translate-x, 0), var(--translate-y, 0), 0) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1))",
transformOrigin: "0 0",
...(isDragging
? {
opacity: "var(--dragging-opacity, 0.5)",
zIndex: 0,
}
: {}),
}}
ref={setNodeRef}
>
<options.itemComponent
@@ -41,12 +41,12 @@ export function InstanceCard({ instance, options, isTiny, widgetKey }: InstanceC
const baseUrl = instance.integrationUrl.replace(/\/+$/, "");
const relativeTime = useTimeAgo(instance.updatedAt);
const onlineServers = instance.instanceInfo.servers.filter((s) => s.is_reachable !== false).length;
const onlineServers = instance.instanceInfo.servers.filter(({ is_reachable }) => is_reachable !== false).length;
const runningApps = instance.instanceInfo.applications.filter(
(a) => parseStatus(a.status ?? "") === "running",
({ status }) => parseStatus(status ?? "") === "running",
).length;
const runningServices = instance.instanceInfo.services.filter(
(s) => parseStatus(s.status ?? "") === "running",
({ status }) => parseStatus(status ?? "") === "running",
).length;
return (
+1
View File
@@ -135,6 +135,7 @@ export const reduceWidgetOptionsWithDefaultValues = (
currentValue: Record<string, unknown> = {},
) => {
const definition = widgetImports[kind].definition;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const options = definition.createOptions(settings) as Record<string, WidgetOptionDefinition>;
return objectEntries(options).reduce(
(prev, [key, value]) => ({
@@ -45,6 +45,7 @@ export const WidgetEditModal = createModal<ModalProps<WidgetKind>>(({ actions, i
customError: zodErrorMap(t),
});
const { definition } = widgetImports[innerProps.kind];
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
const options = definition.createOptions(innerProps.settings) as Record<string, OptionsBuilderResult[string]>;
const form = useForm({
@@ -32,7 +32,8 @@ export default function SystemResources({ integrationIds, options }: WidgetCompo
memory: item.healthInfo.memUsedInBytes,
gpu:
item.healthInfo.gpu.length > 0
? item.healthInfo.gpu.reduce((acc, g) => acc + g.processorUtilization, 0) / item.healthInfo.gpu.length
? item.healthInfo.gpu.reduce((acc, { processorUtilization }) => acc + processorUtilization, 0) /
item.healthInfo.gpu.length
: 0,
network: item.healthInfo.network,
})),
@@ -50,7 +51,8 @@ export default function SystemResources({ integrationIds, options }: WidgetCompo
memory: data.healthInfo.memUsedInBytes,
gpu:
data.healthInfo.gpu.length > 0
? data.healthInfo.gpu.reduce((acc, g) => acc + g.processorUtilization, 0) / data.healthInfo.gpu.length
? data.healthInfo.gpu.reduce((acc, { processorUtilization }) => acc + processorUtilization, 0) /
data.healthInfo.gpu.length
: 0,
network: data.healthInfo.network,
};
+256 -194
View File
File diff suppressed because it is too large. Load diff
+10 -9
View File
@@ -49,9 +49,9 @@ catalog:
"@semantic-release/release-notes-generator": ^14.1.0
"@t3-oss/env-nextjs": ^0.13.11
"@tabler/icons-react": ^3.41.1
"@tanstack/react-query": ^5.100.5
"@tanstack/react-query-devtools": ^5.100.5
"@tanstack/react-query-next-experimental": ^5.100.5
"@tanstack/react-query": ^5.99.1
"@tanstack/react-query-devtools": ^5.99.1
"@tanstack/react-query-next-experimental": ^5.99.1
"@testcontainers/mysql": ^11.14.0
"@testcontainers/postgresql": ^11.14.0
"@testcontainers/redis": ^11.14.0
@@ -86,6 +86,7 @@ catalog:
"@types/css-modules": ^1.0.5
"@types/dockerode": ^4.0.1
"@types/node": ^24.12.2
"@types/node-cron": ^3.0.11
"@types/node-unifi": ^2.5.1
"@types/pg": ^8.20.0
"@types/prismjs": ^1.26.6
@@ -112,13 +113,12 @@ catalog:
conventional-changelog-conventionalcommits: ^9.3.1
cookie: 1.1.1
cookies: ^0.9.1
croner: 10.0.1
cross-env: ^10.1.0
crypto-js: ^4.2.0
dayjs: ^1.11.20
deepmerge: 4.3.1
dns-caching: ^0.2.9
dockerode: ^5.0.0
dockerode: ^4.0.10
dotenv: ^17.4.2
dotenv-cli: ^11.0.0
drizzle-kit: ^0.31.10
@@ -132,13 +132,13 @@ catalog:
eslint-plugin-jsx-a11y: ^6.10.2
eslint-plugin-react: ^7.37.5
eslint-plugin-react-hooks: ^6.1.1
fast-xml-parser: ^5.7.2
fastify: ^5.8.5
fast-xml-parser: ^5.7.1
fastify: ^5.8.4
flag-icons: ^7.5.0
glob: ^13.0.6
ical.js: ^2.2.1
ioredis: 5.10.1
isomorphic-dompurify: ^3.10.0
isomorphic-dompurify: ^3.9.0
jotai: ^2.19.1
jsdom: ^29.0.2
json5: ^2.2.3
@@ -151,6 +151,7 @@ catalog:
next: 16.2.4
next-auth: 5.0.0-beta.31
next-intl: 4.9.1
node-cron: ^4.2.1
node-loader: ^2.1.0
octokit: ^5.0.5
pg: ^8.20.0
@@ -179,7 +180,7 @@ catalog:
tsx: 4.20.4
turbo: ^2.9.6
typescript: ^5.9.3
typescript-eslint: ^8.58.2
typescript-eslint: ^8.59.0
undici: 7.24.6
use-deep-compare-effect: ^1.8.1
video.js: ^8.23.7
Loaded 100 of 106 files, more files were not shown because too many files have changed in this diff. Show more