Compare commits

...
Author SHA1 Message Date
Thomas Camlong cb0222c04d fix: keep HTTP methods untranslated 2026-08-10 10:02:01 +02:00
homarr-crowdin[bot]andThomas 06c489bd48 chore(lang): updated translations from crowdin (#6548)
Co-authored-by: Thomas <thomas@ajnart.fr>
2026-08-10 09:06:56 +02:00
Thomas 464d98e124 feat(settings): unify manage and board settings into a single save form (#6541) 2026-08-08 15:33:38 +02:00
Thomas 987c9ade18 fix: make internal nginx proxy tolerate disabled IPv6 (#4596) (#6539)
* fix: keep nginx IPv6 listen only when IPv6 is available (#4596)

Commit 2c48b1896 (1.45.2) made the internal nginx proxy listen on the IPv6
wildcard ('listen [::]:7575;'), which aborts nginx startup on hosts/VMs with
IPv6 disabled:

    nginx: [emerg] socket() [::]:7575 failed (97: Address family not supported by protocol)

A plain revert would reintroduce #2697 and break IPv6-only/dual-stack
environments where this listener is required. Instead, only emit the IPv6
listen directive when the host actually has IPv6 configured.

Reuse the envsubst step run.sh already performs: compute NGINX_LISTEN_IPV6
from /proc/net/if_inet6 and substitute it into the template. proc files always
report size 0, so presence is detected by grepping the file (not 'test -s').

* fix: honor HOMARR_DISABLE_IPV6 override in nginx config generation

Review feedback on #6539: give users an explicit opt-out from the IPv6
listener even when the host reports IPv6. The issue reporter (#4596)
requested such an env var, and the pattern matches the existing
ENABLE_DNS_CACHING IPv6 toggle. Auto-detection behavior is unchanged when
the var is unset. Validated in containers: override wins, dual-stack
preserved by default, IPv4-only fallback on IPv6-less hosts.
2026-08-08 11:16:49 +02:00
Sven Gottwald 6141d505e4 fix(docker): Expose TCP port in Dockerfile (#6538) 2026-08-08 08:53:50 +02:00
Thomas 6178843198 Merge pull request #6536 from homarr-labs/docs/update-helm-docs 2026-08-07 23:53:22 +02:00
github-actions[bot] a7006d746e docs(helm): update chart installation page 2026-08-07 19:37:35 +00:00
70 changed files with 1605 additions and 1791 deletions

No files matched your search

+1
View File
@@ -95,5 +95,6 @@ ENV AUTH_PROVIDERS='credentials'
ENV REDIS_IS_EXTERNAL='false' ENV REDIS_IS_EXTERNAL='false'
ENV NODE_ENV='production' ENV NODE_ENV='production'
EXPOSE 7575
ENTRYPOINT [ "/app/entrypoint.sh" ] ENTRYPOINT [ "/app/entrypoint.sh" ]
CMD ["sh", "run.sh"] CMD ["sh", "run.sh"]
@@ -25,13 +25,14 @@ This is especially useful for [docker secrets](https://docs.docker.com/engine/sw
Using the `PUID` and `PGID` will require you to set the correct permissions on the mounted volumes and if used the docker socket. See more in the [Running as a different user](/docs/advanced/running-as-different-user) documentation. Using the `PUID` and `PGID` will require you to set the correct permissions on the mounted volumes and if used the docker socket. See more in the [Running as a different user](/docs/advanced/running-as-different-user) documentation.
::: :::
| Environment Variable | Description | Possible values | Default | | Environment Variable | Description | Possible values | Default |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------- | | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------- |
| `PUID` | User ID to run the container as | Any valid user ID | `0` | | `PUID` | User ID to run the container as | Any valid user ID | `0` |
| `PGID` | Group ID to run the container as | Any valid group ID | `0` | | `PGID` | Group ID to run the container as | Any valid group ID | `0` |
| `LOG_LEVEL` | Log level to use | `debug` / `info` / `warn` / `error` | `info` | | `LOG_LEVEL` | Log level to use | `debug` / `info` / `warn` / `error` | `info` |
| `NO_EXTERNAL_CONNECTION` | Disables Homarr's internet-backed requests, including update checks, weather, and RSS feeds | `true` or `false` | `false` | | `NO_EXTERNAL_CONNECTION` | Disables Homarr's internet-backed requests, including update checks, weather, and RSS feeds | `true` or `false` | `false` |
| `ENABLE_DNS_CACHING` | Enables dns caching. Enabled by default, but if you experience issues with IPv6 or static IPs, see [#4006](https://github.com/homarr-labs/homarr/issues/4006) or disable this flag | `true` or `false` | `true` | | `ENABLE_DNS_CACHING` | Enables dns caching. Enabled by default, but if you experience issues with IPv6 or static IPs, see [#4006](https://github.com/homarr-labs/homarr/issues/4006) or disable this flag | `true` or `false` | `true` |
| `HOMARR_DISABLE_IPV6` | Disables the IPv6 listener of the internal nginx proxy, even when the host supports IPv6. IPv6 is normally disabled automatically when the host has no IPv6 configured. See [#4596](https://github.com/homarr-labs/homarr/issues/4596) | `true` or `false` | `false` |
## Authentication ## Authentication
-1
View File
@@ -47,7 +47,6 @@ services:
traefik.http.routers.homarr.rule: Host(`your.internal.dns.address.here.com`) traefik.http.routers.homarr.rule: Host(`your.internal.dns.address.here.com`)
traefik.http.routers.homarr.entrypoints: websecure traefik.http.routers.homarr.entrypoints: websecure
traefik.http.routers.homarr-secure.app: homarr traefik.http.routers.homarr-secure.app: homarr
traefik.http.apps.homarr.loadbalancer.server.port: 7575
networks: networks:
proxy: proxy:
@@ -2,9 +2,9 @@
<img src="https://raw.githubusercontent.com/homarr-labs/charts/refs/heads/main/charts/homarr/icon.svg" align="right" width="92" alt="homarr logo"> <img src="https://raw.githubusercontent.com/homarr-labs/charts/refs/heads/main/charts/homarr/icon.svg" align="right" width="92" alt="homarr logo">
![Version: 8.25.0](https://img.shields.io/badge/Version-8.25.0-informational?style=flat) ![Version: 8.26.0](https://img.shields.io/badge/Version-8.26.0-informational?style=flat)
![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat)
![AppVersion: v1.73.0](https://img.shields.io/badge/AppVersion-v1.73.0-informational?style=flat) ![AppVersion: v1.74.0](https://img.shields.io/badge/AppVersion-v1.74.0-informational?style=flat)
A Helm chart to deploy homarr for Kubernetes A Helm chart to deploy homarr for Kubernetes
@@ -429,7 +429,7 @@ All available values are listed on the [artifacthub](https://artifacthub.io/pack
| httproute.rules[0].matches[0].path.value | string | `"/"` | Path value to match | | httproute.rules[0].matches[0].path.value | string | `"/"` | Path value to match |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy | | image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
| image.repository | string | `"ghcr.io/homarr-labs/homarr"` | Image repository | | image.repository | string | `"ghcr.io/homarr-labs/homarr"` | Image repository |
| image.tag | string | `"v1.73.0"` | Overrides the image tag whose default is the chart appVersion | | image.tag | string | `"v1.74.0"` | Overrides the image tag whose default is the chart appVersion |
| imagePullSecrets | list | `[]` | Secrets for Docker registry | | imagePullSecrets | list | `[]` | Secrets for Docker registry |
| ingress.annotations | object | `{}` | Ingress annotations | | ingress.annotations | object | `{}` | Ingress annotations |
| ingress.enabled | bool | `false` | Enable ingress | | ingress.enabled | bool | `false` | Enable ingress |
+70 -33
View File
@@ -9,11 +9,11 @@ tags:
- Layout - Layout
--- ---
import iconColorImage from './img/icon-color.png' import iconColorImage from "./img/icon-color.png";
import itemRadiusImage from './img/item-radius.png' import itemRadiusImage from "./img/item-radius.png";
import layoutLargeImage from './img/layout-large.png' import layoutLargeImage from "./img/layout-large.png";
import layoutMediumImage from './img/layout-medium.png' import layoutMediumImage from "./img/layout-medium.png";
import layoutSmallImage from './img/layout-small.png' import layoutSmallImage from "./img/layout-small.png";
Each dashboard is called a "board". Each dashboard is called a "board".
You can create as many boards as you want. You can create as many boards as you want.
@@ -24,24 +24,29 @@ Other boards can be viewed by direct links (e.g. my-homarr.com/board/smart-home)
Names of boards must be unique because this will be used in the URL to load the desired board. Names of boards must be unique because this will be used in the URL to load the desired board.
## Create a new board ## Create a new board
When creating a board, the availability of the board name will be checked for you. When creating a board, the availability of the board name will be checked for you.
![](./img/create-board-modal.png) ![](./img/create-board-modal.png)
### Name ### Name
The name must not include any special characters and must be at least one character long. The name must not include any special characters and must be at least one character long.
Underscores and hyphen-minus are allowed. Underscores and hyphen-minus are allowed.
### Column count ### Column count
Homarr has a complex drag and drop system that can be used from the browser.
Homarr has a complex drag-and-drop system that can be used from the browser.
The column count defines how many horizontal columns are available to drag and drop elements to. The column count defines how many horizontal columns are available to drag and drop elements to.
### Public ### Public
This will enable public access for everyone - regardless of whether they are logged in or not. This will enable public access for everyone - regardless of whether they are logged in or not.
This can be really useful if you want to have public boards in your company or for family and fiends. This can be really useful if you want to have public boards in your company or for family and friends.
Modifications for public boards must be allowed explicitly using user groups and their permissions. Modifications for public boards must be allowed explicitly using user groups and their permissions.
## Board settings ## Board settings
You navigate to the board settings by clicking on these three dots: You navigate to the board settings by clicking on these three dots:
![](./img/navigate-to-settings.png) ![](./img/navigate-to-settings.png)
@@ -50,8 +55,12 @@ Alternatively, you can also navigate from the board page itself using the cog ic
![](./img/navigate-to-settings-2.png) ![](./img/navigate-to-settings-2.png)
All board settings are edited on a single page. Click the **Save changes** button in the save bar at the bottom to apply them, or **Discard** to restore the last saved values. The save bar only appears when you have unsaved changes. Access control and the Danger zone are independent sections and are applied immediately.
### General ### General
#### Page title #### Page title
This is the title that will be visible at the top left in the navigation bar: This is the title that will be visible at the top left in the navigation bar:
![](./img/page-title.png) ![](./img/page-title.png)
@@ -59,6 +68,7 @@ This is the title that will be visible at the top left in the navigation bar:
This field is optional and Homarr will fall back to "Homarr" if nothing is set. This field is optional and Homarr will fall back to "Homarr" if nothing is set.
#### Meta title #### Meta title
This is the secondary title of the page that is not directly visible in the page itself. This is the secondary title of the page that is not directly visible in the page itself.
Browser will use it to set the title of tabs: Browser will use it to set the title of tabs:
@@ -67,10 +77,12 @@ Browser will use it to set the title of tabs:
Homarr will fall back to the board name and a suffix if nothing is set. Homarr will fall back to the board name and a suffix if nothing is set.
#### Logo image URL #### Logo image URL
This is the URL that is used for the image at the top left. This is the URL that is used for the image at the top left.
Homarr will fall back to the Homarr logo if nothing is set. Homarr will fall back to the Homarr logo if nothing is set.
#### Favicon image URL #### Favicon image URL
This is the URL that is used for the favicon in the tab title. This is the URL that is used for the favicon in the tab title.
Homarr will fall back to the Homarr logo if nothing is set. Homarr will fall back to the Homarr logo if nothing is set.
@@ -94,51 +106,65 @@ Amount of columns for this layout. Defines how many items can be placed in a row
#### Breakpoint #### Breakpoint
Minimum width of the screen where the layout will be used. Minimum width of the screen where the layout will be used.
Once the minmum of the next layout is reached the layout will change. Once the minimum of the next layout is reached the layout will change.
#### Preview #### Preview
<img src={layoutSmallImage} height={256} /> <img src={layoutSmallImage} height={256} />
<img src={layoutMediumImage} height={256} /> <img src={layoutMediumImage} height={256} />
<img src={layoutLargeImage} height={256} /> <img src={layoutLargeImage} height={256} />
### Background ### Background
#### Background image URL #### Background image URL
Homarr can display a background image behind apps and widgets. Homarr can display a background image behind apps and widgets.
This URL can be used to define what image should be shown. This URL can be used to define what image should be shown.
#### Background image attachment #### Background image attachment
This defines whether the background should move when the user scrolls. This defines whether the background should move when the user scrolls.
#### Background image size #### Background image size
This defines whether the background should cover the entire page (and possibly be cropped) or never be cropped but may not cover the entire page. This defines whether the background should cover the entire page (and possibly be cropped) or never be cropped but may not cover the entire page.
#### Background image repeat #### Background image repeat
This defines whether the background should be repeated if it cannot cover the entire page. This defines whether the background should be repeated if it cannot cover the entire page.
This option can be useful if you have patterns that can be repeated easily (e.g. patterns): This option can be useful if you have patterns that can be repeated easily (e.g. patterns):
![](./img/background-repeat.png) ![](./img/background-repeat.png)
### Appearance ### Appearance
#### Primary color #### Primary color
Color that can be chosen freely to give accents to active elements. Color that can be chosen freely to give accents to active elements.
#### Secondary color #### Secondary color
Color that can be chosen freely to give accents. Color that can be chosen freely to give accents.
#### Opacity #### Opacity
Opacity of the colors. Opacity of the colors.
#### Icon color #### Icon color
Change the color of your bookmark / app icons. Change the color of your bookmark / app icons.
<img src={iconColorImage} height={100} /> <img src={iconColorImage} height={100} />
#### Item radius #### Item radius
Change the radius of your items / categories. Change the radius of your items / categories.
<img src={itemRadiusImage} height={100} /> <img src={itemRadiusImage} height={100} />
### Custom CSS ### Custom CSS
This is the field where you can enter custom CSS. This is the field where you can enter custom CSS.
The styling will only be applied on the respective board page. The styling will only be applied on the respective board page.
@@ -147,14 +173,16 @@ The styling will only be applied on the respective board page.
### Behaviour ### Behaviour
#### Disable app status #### Disable app status
This will disable the status check for apps. This will disable the status check for apps.
### Access control ### Access control
With the access control, you can permit a single user or a group to your board. With the access control, you can permit a single user or a group to your board.
The users and groups can have one of these three levels of access: The users and groups can have one of these three levels of access:
| **Permission Level** | View board | Edit mode | Settings | Danger zone (eg. delete) | | **Permission Level** | View board | Edit mode | Settings | Danger zone (eg. delete) |
|----------------------|------------|-----------|----------|--------------------------| | -------------------- | ---------- | --------- | -------- | ------------------------ |
| View board | X | | | | | View board | X | | | |
| Modify board | X | X | X | | | Modify board | X | X | X | |
| Full access | X | X | X | X | | Full access | X | X | X | X |
@@ -173,22 +201,27 @@ After editing permissions, the save button below the table must be pressed.
Otherwise, all changes will be discarded. Otherwise, all changes will be discarded.
### Danger zone ### Danger zone
#### Rename #### Rename
Renaming a board will break all existing links to it permanently with no redirect. Renaming a board will break all existing links to it permanently with no redirect.
#### Board visibility #### Board visibility
By default, boards will be private. This means only authenticated users that are authorized have access. By default, boards will be private. This means only authenticated users that are authorized have access.
Making a board public will expose it to everyone - including unauthenticated users. Making a board public will expose it to everyone - including unauthenticated users.
#### Delete #### Delete
This will permanently delete the board. This will permanently delete the board.
This action is irreversible and cannot be undone. This action is irreversible and cannot be undone.
## Delete boards ## Delete boards
The deletion of boards is permanent and cannot be undone. The deletion of boards is permanent and cannot be undone.
There are two ways to delete a board: There are two ways to delete a board:
- Navigate to the settings of your board, open the "Danger zone" dropdown and click on the "delete this board" button. - Navigate to the settings of your board, open the "Danger zone" section and click on the "delete this board" button.
- Navigate to the list of boards in the management pages, click the three dots and click on "delete permanently". - Navigate to the list of boards in the management pages, click the three dots and click on "delete permanently".
Both actions will execute the same deletion process. Both actions will execute the same deletion process.
@@ -196,7 +229,7 @@ Both actions will execute the same deletion process.
## Duplicate boards ## Duplicate boards
:::note :::note
Duplicating a board will not copy the users and groups that have access to the board Duplicating a board will not copy the users and groups that have access to the board
nor the integrations the user does not have access to. nor the integrations the user does not have access to.
::: :::
@@ -206,47 +239,51 @@ You can duplicate a board by clicking on the three dots in the list of boards an
![](./img/duplicate-board-modal.png) ![](./img/duplicate-board-modal.png)
## Setting boards as your home board ## Setting boards as your home board
The home board is the dashboard, that will be shown at the root path of Homarr or if no board name was passed in the URL. The home board is the dashboard, that will be shown at the root path of Homarr or if no board name was passed in the URL.
All the following paths will lead to the home board: All the following paths will lead to the home board:
- ``my-homarr.com``
- ``my-homarr.com/boards`` - `my-homarr.com`
- `my-homarr.com/boards`
Your home board will have a special small badge at the top right in the list of boards: Your home board will have a special small badge at the top right in the list of boards:
![](./img/home-board-flag.png) ![](./img/home-board-flag.png)
### For yourself ### For yourself
To set the home board yourself, the easiest option is to set it directly in the list of boards: To set the home board yourself, the easiest option is to set it directly in the list of boards:
![](./img/set-as-home-board-menu.png) ![](./img/set-as-home-board-menu.png)
Alternatively, you can also define it via your user profile: Alternatively, you can also define it via your user profile:
1. Click on your user profile at the top right 1. Click on your user profile at the top right
2. Click on ``Your preferences`` 2. Click on `Your preferences`
3. Change the home board in the ``home board`` dropdown and click on ``Save``. 3. Change the home board in the `home board` dropdown and click on `Save`.
### For other users ### For other users
1. Navigate to the users: ``Management`` > ``Users`` > ``Manage`` 1. Navigate to the users: `Management` > `Users` > `Manage`
2. Click on the username of the user that you want to adjust 2. Click on the username of the user that you want to adjust
3. Select the desired home board via the dropdown and click on ``Save`` \ 3. Select the desired home board via the dropdown and click on `Save` \
![](./img/set-home-board-other-user.png) ![](./img/set-home-board-other-user.png)
### For user groups ### For user groups
1. Navigate to the user groups: ``Management`` > ``Users`` > ``Groups`` > ``Manage`` 1. Navigate to the user groups: `Management` > `Users` > `Groups` > `Manage`
2. Go to tab ``Settings`` 2. Go to tab `Settings`
3. Select the desired home board via the dropdown and click on ``Save`` \ 3. Select the desired home board via the dropdown and click on `Save` \
![](./img/set-home-board-user-group.png) ![](./img/set-home-board-user-group.png)
### For whole server ### For whole server
You can also set a global home board that will be used for all users that have not set a home board themselves. You can also set a global home board that will be used for all users that have not set a home board themselves.
It will also be used for anonymous users. It will also be used for anonymous users.
1. Navigate to the settings: ``Management`` > ``Settings`` > ``Boards`` 1. Navigate to the settings: `Management` > `Settings` > `Boards`
2. Select the desired home board via the dropdown and click on ``Save`` \ 2. Select the desired home board via the dropdown and click on `Save` \
![](./img/set-home-board-global.png) ![](./img/set-home-board-global.png)
:::note :::note
For the global home board you can only select boards that are public. For the global home board you can only select boards that are public.
@@ -255,4 +292,4 @@ For the global home board you can only select boards that are public.
### Mobile home board ### Mobile home board
Same as the home board, you can also set a mobile home board. Same as the home board, you can also set a mobile home board.
It will be used for devices that are detected as mobile devices. (Using User-Agent header) It will be used for devices that are detected as mobile devices. (Using User-Agent header)
@@ -13,6 +13,8 @@ tags:
The settings page applies options to the whole Homarr application. The settings page applies options to the whole Homarr application.
Some changes need a full page reload before they take effect. Some changes need a full page reload before they take effect.
All changes are collected in a single form. Click the **Save changes** button in the save bar at the bottom of the page to apply them. The save bar only appears when you have unsaved changes, and the **Discard** button reverts your changes.
## Analytics ## Analytics
Homarr uses [PostHog](https://posthog.com/) to collect anonymous usage data. Homarr uses [PostHog](https://posthog.com/) to collect anonymous usage data.
@@ -19,130 +19,106 @@ import {
import { useDisclosure } from "@mantine/hooks"; import { useDisclosure } from "@mantine/hooks";
import { IconX } from "@tabler/icons-react"; import { IconX } from "@tabler/icons-react";
import { useZodForm } from "@homarr/form"; import type { UseFormReturnType } from "@homarr/form";
import { useI18n } from "@homarr/translation/client"; import { useI18n } from "@homarr/translation/client";
import { boardSavePartialSettingsSchema } from "@homarr/validation/board";
import type { Board } from "../../_types"; import { SectionCard } from "~/components/manage/section-card";
import { generateColors } from "../../(content)/_theme"; import { generateColors } from "../../(content)/_theme";
import { useSavePartialSettingsMutation } from "./_shared"; import type { FormValues } from "./_settings-form";
interface Props { interface Props {
board: Board; form: UseFormReturnType<FormValues>;
} }
const hexRegex = /^#[0-9a-fA-F]{6}$/; const hexRegex = /^#[0-9a-fA-F]{6}$/;
const progressPercentageLabel = (value: number) => `${value}%`; const progressPercentageLabel = (value: number) => `${value}%`;
export const ColorSettingsContent = ({ board }: Props) => { export const ColorSettingsContent = ({ form }: Props) => {
const form = useZodForm(boardSavePartialSettingsSchema, {
initialValues: {
primaryColor: board.primaryColor,
secondaryColor: board.secondaryColor,
opacity: board.opacity,
iconColor: board.iconColor ?? "",
itemRadius: board.itemRadius,
},
});
const [showPreview, { toggle }] = useDisclosure(false); const [showPreview, { toggle }] = useDisclosure(false);
const t = useI18n(); const t = useI18n();
const theme = useMantineTheme(); const theme = useMantineTheme();
const { mutate: savePartialSettings, isPending } = useSavePartialSettingsMutation(board);
return ( return (
<form <SectionCard title={t("board.setting.section.appearance.title")}>
onSubmit={form.onSubmit((values) => { <Grid>
savePartialSettings({ <Grid.Col span={{ sm: 12, md: 6 }}>
id: board.id, <Stack gap="xs">
...values,
});
})}
>
<Stack>
<Grid>
<Grid.Col span={{ sm: 12, md: 6 }}>
<Stack gap="xs">
<ColorInput
label={t("board.field.primaryColor.label")}
format="hex"
swatches={Object.values(theme.colors).map((color) => color[6])}
{...form.getInputProps("primaryColor")}
/>
</Stack>
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<ColorInput <ColorInput
label={t("board.field.secondaryColor.label")} label={t("board.field.primaryColor.label")}
format="hex" format="hex"
swatches={Object.values(theme.colors).map((color) => color[6])} swatches={Object.values(theme.colors).map((color) => color[6])}
{...form.getInputProps("secondaryColor")} {...form.getInputProps("primaryColor")}
/> />
</Grid.Col> </Stack>
<Grid.Col span={12}> </Grid.Col>
<Anchor onClick={toggle}>{showPreview ? t("common.preview.hide") : t("common.preview.show")}</Anchor> <Grid.Col span={{ sm: 12, md: 6 }}>
</Grid.Col> <ColorInput
<Grid.Col span={12}> label={t("board.field.secondaryColor.label")}
<Collapse expanded={showPreview}> format="hex"
<Stack> swatches={Object.values(theme.colors).map((color) => color[6])}
<ColorsPreview previewColor={form.values.primaryColor} /> {...form.getInputProps("secondaryColor")}
<ColorsPreview previewColor={form.values.secondaryColor} /> />
</Stack> </Grid.Col>
</Collapse> <Grid.Col span={12}>
</Grid.Col> <Anchor onClick={toggle}>{showPreview ? t("common.preview.hide") : t("common.preview.show")}</Anchor>
<Grid.Col span={{ sm: 12, md: 6 }}> </Grid.Col>
<InputWrapper label={t("board.field.opacity.label")}> <Grid.Col span={12}>
<Slider <Collapse expanded={showPreview}>
my={6} <Stack>
min={0} <ColorsPreview previewColor={form.values.primaryColor} />
max={100} <ColorsPreview previewColor={form.values.secondaryColor} />
step={5} </Stack>
label={progressPercentageLabel} </Collapse>
{...form.getInputProps("opacity")} </Grid.Col>
/> <Grid.Col span={{ sm: 12, md: 6 }}>
</InputWrapper> <InputWrapper label={t("board.field.opacity.label")}>
</Grid.Col> <Slider
<Grid.Col span={{ sm: 12, md: 6 }}> my={6}
<Group align="end"> min={0}
<ColorInput max={100}
label={t("board.field.iconColor.label")} step={5}
format="hex" label={progressPercentageLabel}
swatches={Object.values(theme.colors).map((color) => color[6])} {...form.getInputProps("opacity")}
flex={1}
{...form.getInputProps("iconColor")}
/>
<Button
variant="subtle"
leftSection={<IconX />}
onClick={() => form.setFieldValue("iconColor", "")}
disabled={!form.values.iconColor}
>
{t("board.field.clearColor.label")}
</Button>
</Group>
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<Select
label={t("board.field.itemRadius.label")}
description={t("board.field.itemRadius.description")}
data={[
{ label: t("board.field.itemRadius.option.xs"), value: "xs" },
{ label: t("board.field.itemRadius.option.sm"), value: "sm" },
{ label: t("board.field.itemRadius.option.md"), value: "md" },
{ label: t("board.field.itemRadius.option.lg"), value: "lg" },
{ label: t("board.field.itemRadius.option.xl"), value: "xl" },
]}
{...form.getInputProps("itemRadius")}
/> />
</Grid.Col> </InputWrapper>
</Grid> </Grid.Col>
<Group justify="end"> <Grid.Col span={{ sm: 12, md: 6 }}>
<Button type="submit" loading={isPending}> <Group align="end">
{t("common.action.saveChanges")} <ColorInput
</Button> label={t("board.field.iconColor.label")}
</Group> format="hex"
</Stack> swatches={Object.values(theme.colors).map((color) => color[6])}
</form> flex={1}
{...form.getInputProps("iconColor")}
/>
<Button
type="button"
variant="subtle"
leftSection={<IconX />}
onClick={() => form.setFieldValue("iconColor", "")}
disabled={!form.values.iconColor}
>
{t("board.field.clearColor.label")}
</Button>
</Group>
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<Select
label={t("board.field.itemRadius.label")}
description={t("board.field.itemRadius.description")}
data={[
{ label: t("board.field.itemRadius.option.xs"), value: "xs" },
{ label: t("board.field.itemRadius.option.sm"), value: "sm" },
{ label: t("board.field.itemRadius.option.md"), value: "md" },
{ label: t("board.field.itemRadius.option.lg"), value: "lg" },
{ label: t("board.field.itemRadius.option.xl"), value: "xl" },
]}
{...form.getInputProps("itemRadius")}
/>
</Grid.Col>
</Grid>
</SectionCard>
); );
}; };
@@ -1,41 +1,32 @@
"use client"; "use client";
import { startTransition } from "react"; import { startTransition } from "react";
import { ActionIcon, Autocomplete, Button, Center, Grid, Group, Popover, Stack, Text } from "@mantine/core"; import { ActionIcon, Autocomplete, Center, Grid, Group, Popover, Stack, Text } from "@mantine/core";
import { useDebouncedValue } from "@mantine/hooks"; import { useDebouncedValue } from "@mantine/hooks";
import { IconPhotoOff, IconUpload } from "@tabler/icons-react"; import { IconPhotoOff, IconUpload } from "@tabler/icons-react";
import { clientApi } from "@homarr/api/client"; import { clientApi } from "@homarr/api/client";
import { useSession } from "@homarr/auth/client"; import { useSession } from "@homarr/auth/client";
import { backgroundImageAttachments, backgroundImageRepeats, backgroundImageSizes } from "@homarr/definitions"; import { backgroundImageAttachments, backgroundImageRepeats, backgroundImageSizes } from "@homarr/definitions";
import { useZodForm } from "@homarr/form"; import type { UseFormReturnType } from "@homarr/form";
import { UploadMedia } from "@homarr/forms-collection"; import { UploadMedia } from "@homarr/forms-collection";
import type { TranslationObject } from "@homarr/translation"; import type { TranslationObject } from "@homarr/translation";
import { useI18n } from "@homarr/translation/client"; import { useI18n } from "@homarr/translation/client";
import type { SelectItemWithDescriptionBadge } from "@homarr/ui"; import type { SelectItemWithDescriptionBadge } from "@homarr/ui";
import { SelectWithDescriptionBadge } from "@homarr/ui"; import { SelectWithDescriptionBadge } from "@homarr/ui";
import { boardSavePartialSettingsSchema } from "@homarr/validation/board";
import type { Board } from "../../_types"; import { SectionCard } from "~/components/manage/section-card";
import { useSavePartialSettingsMutation } from "./_shared"; import type { FormValues } from "./_settings-form";
interface Props { interface Props {
board: Board; form: UseFormReturnType<FormValues>;
} }
export const BackgroundSettingsContent = ({ board }: Props) => {
export const BackgroundSettingsContent = ({ form }: Props) => {
const t = useI18n(); const t = useI18n();
const { data: session } = useSession(); const { data: session } = useSession();
const { mutate: savePartialSettings, isPending } = useSavePartialSettingsMutation(board);
const form = useZodForm(boardSavePartialSettingsSchema, {
initialValues: {
backgroundImageUrl: board.backgroundImageUrl ?? "",
backgroundImageAttachment: board.backgroundImageAttachment,
backgroundImageRepeat: board.backgroundImageRepeat,
backgroundImageSize: board.backgroundImageSize,
},
});
const [debouncedSearch] = useDebouncedValue(form.values.backgroundImageUrl, 200); const [debouncedSearch] = useDebouncedValue(form.values.backgroundImageUrl ?? "", 200);
const medias = clientApi.media.getPaginated.useQuery({ const medias = clientApi.media.getPaginated.useQuery({
page: 1, page: 1,
pageSize: 10, pageSize: 10,
@@ -53,121 +44,106 @@ export const BackgroundSettingsContent = ({ board }: Props) => {
const backgroundImageRepeatData = useBackgroundOptionData("backgroundImageRepeat", backgroundImageRepeats); const backgroundImageRepeatData = useBackgroundOptionData("backgroundImageRepeat", backgroundImageRepeats);
return ( return (
<form <SectionCard title={t("board.setting.section.background.title")}>
onSubmit={form.onSubmit((values) => { <Grid>
savePartialSettings({ <Grid.Col span={12}>
id: board.id, <Group wrap="nowrap" gap="xs" w="100%" align="start">
...values, <Autocomplete
}); flex={1}
})} leftSection={
> form.values.backgroundImageUrl &&
<Stack> form.values.backgroundImageUrl.trim().length >= 2 && (
<Grid> <Popover width={300} withArrow>
<Grid.Col span={12}> <Popover.Target>
<Group wrap="nowrap" gap="xs" w="100%" align="start"> <Center h="100%">
<Autocomplete <ImagePreview src={form.values.backgroundImageUrl} w={20} h={20} />
flex={1} </Center>
leftSection={ </Popover.Target>
form.values.backgroundImageUrl && <Popover.Dropdown>
form.values.backgroundImageUrl.trim().length >= 2 && ( <ImagePreview src={form.values.backgroundImageUrl} w="100%" />
<Popover width={300} withArrow> </Popover.Dropdown>
<Popover.Target> </Popover>
<Center h="100%"> )
<ImagePreview src={form.values.backgroundImageUrl} w={20} h={20} /> }
</Center> // We filter it on the server
</Popover.Target> filter={({ options }) => options}
<Popover.Dropdown> label={t("board.field.backgroundImageUrl.label")}
<ImagePreview src={form.values.backgroundImageUrl} w="100%" /> placeholder={`${t("board.field.backgroundImageUrl.placeholder")}...`}
</Popover.Dropdown> renderOption={({ option }) => {
</Popover> const current = imageMap.get(option.value);
) if (!current) return null;
}
// We filter it on the server
filter={({ options }) => options}
label={t("board.field.backgroundImageUrl.label")}
placeholder={`${t("board.field.backgroundImageUrl.placeholder")}...`}
renderOption={({ option }) => {
const current = imageMap.get(option.value);
if (!current) return null;
return ( return (
<Group gap="sm"> <Group gap="sm">
<ImagePreview src={option.value} w={20} h={20} /> <ImagePreview src={option.value} w={20} h={20} />
<Stack gap={0}> <Stack gap={0}>
<Text size="sm">{current.name}</Text> <Text size="sm">{current.name}</Text>
<Text size="xs" c="dimmed"> <Text size="xs" c="dimmed">
{option.value} {option.value}
</Text> </Text>
</Stack> </Stack>
</Group> </Group>
); );
}}
data={[
{
group: t("board.field.backgroundImageUrl.group.your"),
items: images
.filter((media) => media.creatorId === session?.user.id)
.map((media) => `/api/user-medias/${media.id}`),
},
{
group: t("board.field.backgroundImageUrl.group.other"),
items: images
.filter((media) => media.creatorId !== session?.user.id)
.map((media) => `/api/user-medias/${media.id}`),
},
]}
{...form.getInputProps("backgroundImageUrl")}
/>
{session?.user.permissions.includes("media-upload") && (
<UploadMedia
onSuccess={(uploadedMedias) => {
const first = uploadedMedias.at(0);
if (!first) return;
startTransition(() => {
form.setFieldValue("backgroundImageUrl", first.url);
});
}} }}
data={[ >
{ {({ onClick, loading }) => (
group: t("board.field.backgroundImageUrl.group.your"), <ActionIcon onClick={onClick} loading={loading} mt={24} size={36} variant="default">
items: images <IconUpload size={16} stroke={1.5} />
.filter((media) => media.creatorId === session?.user.id) </ActionIcon>
.map((media) => `/api/user-medias/${media.id}`), )}
}, </UploadMedia>
{ )}
group: t("board.field.backgroundImageUrl.group.other"), </Group>
items: images </Grid.Col>
.filter((media) => media.creatorId !== session?.user.id) <Grid.Col span={12}>
.map((media) => `/api/user-medias/${media.id}`), <SelectWithDescriptionBadge
}, label={t("board.field.backgroundImageAttachment.label")}
]} data={backgroundImageAttachmentData}
{...form.getInputProps("backgroundImageUrl")} {...form.getInputProps("backgroundImageAttachment")}
/> />
{session?.user.permissions.includes("media-upload") && ( </Grid.Col>
<UploadMedia <Grid.Col span={12}>
onSuccess={(medias) => { <SelectWithDescriptionBadge
const first = medias.at(0); label={t("board.field.backgroundImageSize.label")}
if (!first) return; data={backgroundImageSizeData}
{...form.getInputProps("backgroundImageSize")}
startTransition(() => { />
form.setFieldValue("backgroundImageUrl", first.url); </Grid.Col>
}); <Grid.Col span={12}>
}} <SelectWithDescriptionBadge
> label={t("board.field.backgroundImageRepeat.label")}
{({ onClick, loading }) => ( data={backgroundImageRepeatData}
<ActionIcon onClick={onClick} loading={loading} mt={24} size={36} variant="default"> {...form.getInputProps("backgroundImageRepeat")}
<IconUpload size={16} stroke={1.5} /> />
</ActionIcon> </Grid.Col>
)} </Grid>
</UploadMedia> </SectionCard>
)}
</Group>
</Grid.Col>
<Grid.Col span={12}>
<SelectWithDescriptionBadge
label={t("board.field.backgroundImageAttachment.label")}
data={backgroundImageAttachmentData}
{...form.getInputProps("backgroundImageAttachment")}
/>
</Grid.Col>
<Grid.Col span={12}>
<SelectWithDescriptionBadge
label={t("board.field.backgroundImageSize.label")}
data={backgroundImageSizeData}
{...form.getInputProps("backgroundImageSize")}
/>
</Grid.Col>
<Grid.Col span={12}>
<SelectWithDescriptionBadge
label={t("board.field.backgroundImageRepeat.label")}
data={backgroundImageRepeatData}
{...form.getInputProps("backgroundImageRepeat")}
/>
</Grid.Col>
</Grid>
<Group justify="end">
<Button type="submit" loading={isPending}>
{t("common.action.saveChanges")}
</Button>
</Group>
</Stack>
</form>
); );
}; };
@@ -1,48 +1,27 @@
"use client"; "use client";
import { Button, Group, Stack, Switch } from "@mantine/core"; import { Switch } from "@mantine/core";
import { useForm } from "@homarr/form"; import type { UseFormReturnType } from "@homarr/form";
import { useI18n } from "@homarr/translation/client"; import { useI18n } from "@homarr/translation/client";
import type { Board } from "../../_types"; import { SectionCard } from "~/components/manage/section-card";
import { useSavePartialSettingsMutation } from "./_shared"; import type { FormValues } from "./_settings-form";
interface Props { interface Props {
board: Board; form: UseFormReturnType<FormValues>;
} }
export const BehaviorSettingsContent = ({ board }: Props) => { export const BehaviorSettingsContent = ({ form }: Props) => {
const t = useI18n(); const t = useI18n();
const { mutate: savePartialSettings, isPending } = useSavePartialSettingsMutation(board);
const form = useForm({
initialValues: {
disableStatus: board.disableStatus,
},
});
return ( return (
<form <SectionCard title={t("board.setting.section.behavior.title")}>
onSubmit={form.onSubmit((values) => { <Switch
savePartialSettings({ label={t("board.field.disableStatus.label")}
id: board.id, description={t("board.field.disableStatus.description")}
...values, {...form.getInputProps("disableStatus", { type: "checkbox" })}
}); />
})} </SectionCard>
>
<Stack>
<Switch
label={t("board.field.disableStatus.label")}
description={t("board.field.disableStatus.description")}
{...form.getInputProps("disableStatus", { type: "checkbox" })}
/>
<Group justify="end">
<Button type="submit" loading={isPending}>
{t("common.action.saveChanges")}
</Button>
</Group>
</Stack>
</form>
); );
}; };
@@ -1,6 +1,6 @@
"use client"; "use client";
import { Alert, Button, Group, Input, Stack } from "@mantine/core"; import { Alert, Input } from "@mantine/core";
import { highlight, languages } from "prismjs"; import { highlight, languages } from "prismjs";
import Editor from "react-simple-code-editor"; import Editor from "react-simple-code-editor";
@@ -8,59 +8,39 @@ import "~/styles/prismjs.scss";
import { IconInfoCircle } from "@tabler/icons-react"; import { IconInfoCircle } from "@tabler/icons-react";
import { useForm } from "@homarr/form"; import type { UseFormReturnType } from "@homarr/form";
import { useI18n, useScopedI18n } from "@homarr/translation/client"; import { useI18n, useScopedI18n } from "@homarr/translation/client";
import type { Board } from "../../_types"; import { SectionCard } from "~/components/manage/section-card";
import { useSavePartialSettingsMutation } from "./_shared"; import type { FormValues } from "./_settings-form";
import classes from "./customcss.module.css"; import classes from "./customcss.module.css";
interface Props { interface Props {
board: Board; form: UseFormReturnType<FormValues>;
} }
export const CustomCssSettingsContent = ({ board }: Props) => { export const CustomCssSettingsContent = ({ form }: Props) => {
const t = useI18n(); const t = useI18n();
const customCssT = useScopedI18n("board.field.customCss"); const customCssT = useScopedI18n("board.field.customCss");
const { mutate: savePartialSettings, isPending } = useSavePartialSettingsMutation(board);
const form = useForm({
initialValues: {
customCss: board.customCss ?? "",
},
});
return ( return (
<form <SectionCard title={t("board.setting.section.customCss.title")}>
onSubmit={form.onSubmit((values) => { <CustomCssInput {...form.getInputProps("customCss")} />
savePartialSettings({
id: board.id,
...values,
});
})}
>
<Stack>
<CustomCssInput {...form.getInputProps("customCss")} />
<Alert variant="light" color="cyan" title={customCssT("customClassesAlert.title")} icon={<IconInfoCircle />}> <Alert variant="light" color="cyan" title={customCssT("customClassesAlert.title")} icon={<IconInfoCircle />}>
{customCssT("customClassesAlert.description")} {customCssT("customClassesAlert.description")}
</Alert> </Alert>
</SectionCard>
<Group justify="end">
<Button type="submit" loading={isPending}>
{t("common.action.saveChanges")}
</Button>
</Group>
</Stack>
</form>
); );
}; };
interface CustomCssInputProps { interface CustomCssInputProps {
value?: string; value?: string;
onChange: (value: string) => void; onChange: (value: string) => void;
error?: React.ReactNode;
} }
const CustomCssInput = ({ value, onChange }: CustomCssInputProps) => { const CustomCssInput = ({ value, onChange, error }: CustomCssInputProps) => {
const customCssT = useScopedI18n("board.field.customCss"); const customCssT = useScopedI18n("board.field.customCss");
return ( return (
@@ -70,6 +50,7 @@ const CustomCssInput = ({ value, onChange }: CustomCssInputProps) => {
htmlFor: "custom-css", htmlFor: "custom-css",
}} }}
description={customCssT("description")} description={customCssT("description")}
error={error}
inputWrapperOrder={["label", "description", "input", "error"]} inputWrapperOrder={["label", "description", "input", "error"]}
> >
<div className={classes.codeEditorRoot}> <div className={classes.codeEditorRoot}>
@@ -2,7 +2,7 @@
import { useCallback } from "react"; import { useCallback } from "react";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { Button, Divider, Group, Stack, Text } from "@mantine/core"; import { Button } from "@mantine/core";
import { clientApi } from "@homarr/api/client"; import { clientApi } from "@homarr/api/client";
import { useRequiredBoard } from "@homarr/boards/context"; import { useRequiredBoard } from "@homarr/boards/context";
@@ -10,7 +10,7 @@ import { useConfirmModal, useModalAction } from "@homarr/modals";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { BoardRenameModal } from "~/components/board/modals/board-rename-modal"; import { BoardRenameModal } from "~/components/board/modals/board-rename-modal";
import classes from "./danger.module.css"; import { DangerZoneItem, DangerZoneRoot } from "~/components/manage/danger-zone";
export const DangerZoneSettingsContent = ({ hideVisibility }: { hideVisibility: boolean }) => { export const DangerZoneSettingsContent = ({ hideVisibility }: { hideVisibility: boolean }) => {
const board = useRequiredBoard(); const board = useRequiredBoard();
@@ -82,60 +82,36 @@ export const DangerZoneSettingsContent = ({ hideVisibility }: { hideVisibility:
}, [board.id, deleteBoard, router, t, openConfirmModal]); }, [board.id, deleteBoard, router, t, openConfirmModal]);
return ( return (
<Stack gap="sm"> <DangerZoneRoot>
<Divider /> <DangerZoneItem
<DangerZoneRow
label={t("section.dangerZone.action.rename.label")} label={t("section.dangerZone.action.rename.label")}
description={t("section.dangerZone.action.rename.description")} description={t("section.dangerZone.action.rename.description")}
buttonText={t("section.dangerZone.action.rename.button")} action={
onClick={onRenameClick} <Button variant="subtle" color="red" onClick={onRenameClick}>
{t("section.dangerZone.action.rename.button")}
</Button>
}
/> />
{hideVisibility ? null : ( {!hideVisibility && (
<> <DangerZoneItem
<Divider /> label={t("section.dangerZone.action.visibility.label")}
<DangerZoneRow description={t(`section.dangerZone.action.visibility.description.${visibility}`)}
label={t("section.dangerZone.action.visibility.label")} action={
description={t(`section.dangerZone.action.visibility.description.${visibility}`)} <Button variant="subtle" color="red" loading={isChangeVisibilityPending} onClick={onVisibilityClick}>
buttonText={t(`section.dangerZone.action.visibility.button.${visibility}`)} {t(`section.dangerZone.action.visibility.button.${visibility}`)}
onClick={onVisibilityClick} </Button>
isPending={isChangeVisibilityPending} }
/> />
</>
)} )}
<Divider /> <DangerZoneItem
<DangerZoneRow
label={t("section.dangerZone.action.delete.label")} label={t("section.dangerZone.action.delete.label")}
description={t("section.dangerZone.action.delete.description")} description={t("section.dangerZone.action.delete.description")}
buttonText={t("section.dangerZone.action.delete.button")} action={
onClick={onDeleteClick} <Button variant="subtle" color="red" loading={isDeletePending} onClick={onDeleteClick}>
isPending={isDeletePending} {t("section.dangerZone.action.delete.button")}
</Button>
}
/> />
</Stack> </DangerZoneRoot>
);
};
interface DangerZoneRowProps {
label: string;
description: string;
buttonText: string;
isPending?: boolean;
onClick: () => void;
}
const DangerZoneRow = ({ label, description, buttonText, onClick, isPending }: DangerZoneRowProps) => {
return (
<Group justify="space-between" px="md" className={classes.dangerZoneGroup}>
<Stack gap={0}>
<Text fw="bold" size="sm">
{label}
</Text>
<Text size="sm">{description}</Text>
</Stack>
<Group justify="end" w={{ base: "100%", xs: "auto" }}>
<Button variant="subtle" color="red" loading={isPending} onClick={onClick}>
{buttonText}
</Button>
</Group>
</Group>
); );
}; };
@@ -1,128 +1,66 @@
"use client"; "use client";
import { useEffect, useRef } from "react"; import { useEffect } from "react";
import { Button, Grid, Group, Loader, Stack, TextInput } from "@mantine/core"; import { Grid, Loader, TextInput } from "@mantine/core";
import { useDebouncedValue, useDocumentTitle } from "@mantine/hooks"; import { useDebouncedValue, useDocumentTitle } from "@mantine/hooks";
import { useUpdateBoard } from "@homarr/boards/updater"; import { useUpdateBoard } from "@homarr/boards/updater";
import { useZodForm } from "@homarr/form"; import type { UseFormReturnType } from "@homarr/form";
import { IconPicker } from "@homarr/forms-collection"; import { IconPicker } from "@homarr/forms-collection";
import { useI18n } from "@homarr/translation/client"; import { useI18n } from "@homarr/translation/client";
import { boardSavePartialSettingsSchema } from "@homarr/validation/board";
import { homarrLogoPath } from "~/components/layout/logo/homarr-logo"; import { SectionCard } from "~/components/manage/section-card";
import { createMetaTitle } from "~/metadata"; import { createMetaTitle } from "~/metadata";
import type { Board } from "../../_types"; import type { Board } from "../../_types";
import { useSavePartialSettingsMutation } from "./_shared"; import type { FormValues } from "./_settings-form";
interface Props { interface Props {
board: Board; board: Board;
form: UseFormReturnType<FormValues>;
} }
export const GeneralSettingsContent = ({ board }: Props) => { export const GeneralSettingsContent = ({ board, form }: Props) => {
const t = useI18n(); const t = useI18n();
const ref = useRef({
pageTitle: board.pageTitle,
logoImageUrl: board.logoImageUrl,
});
const { updateBoard } = useUpdateBoard();
const { mutate: savePartialSettings, isPending } = useSavePartialSettingsMutation(board);
const form = useZodForm(
boardSavePartialSettingsSchema
.pick({
pageTitle: true,
logoImageUrl: true,
metaTitle: true,
faviconImageUrl: true,
})
.required(),
{
initialValues: {
pageTitle: board.pageTitle ?? "",
logoImageUrl: board.logoImageUrl ?? "",
metaTitle: board.metaTitle ?? "",
faviconImageUrl: board.faviconImageUrl ?? "",
},
onValuesChange({ pageTitle }) {
updateBoard((previous) => ({
...previous,
pageTitle,
}));
},
},
);
useLogoPreview(form.values.logoImageUrl); useLogoPreview(form.values.logoImageUrl);
const metaTitleStatus = useMetaTitlePreview(form.values.metaTitle); const metaTitleStatus = useMetaTitlePreview(form.values.metaTitle);
// Cleanup for not applied changes of the page title and logo image URL
useEffect(() => {
return () => {
updateBoard((previous) => ({
...previous,
pageTitle: ref.current.pageTitle,
logoImageUrl: ref.current.logoImageUrl,
}));
};
}, [updateBoard]);
return ( return (
<form <SectionCard title={t("board.setting.section.general.title")}>
onSubmit={form.onSubmit((values) => { <Grid>
// Save the current values to the ref so that it does not reset if the form is submitted <Grid.Col span={{ xs: 12, md: 6 }}>
ref.current = { <TextInput
pageTitle: values.pageTitle, label={t("board.field.pageTitle.label")}
logoImageUrl: values.logoImageUrl, placeholder="Homarr"
}; {...form.getInputProps("pageTitle")}
updateFavicon(values.faviconImageUrl ?? homarrLogoPath); />
savePartialSettings({ </Grid.Col>
id: board.id, <Grid.Col span={{ xs: 12, md: 6 }}>
...values, <TextInput
}); label={t("board.field.metaTitle.label")}
})} placeholder={createMetaTitle(t("board.content.metaTitle", { boardName: board.name }))}
> rightSection={metaTitleStatus.isPending && <Loader size="xs" />}
<Stack> {...form.getInputProps("metaTitle")}
<Grid> />
<Grid.Col span={{ xs: 12, md: 6 }}> </Grid.Col>
<TextInput <Grid.Col span={{ xs: 12, md: 6 }}>
label={t("board.field.pageTitle.label")} <IconPicker
placeholder="Homarr" {...form.getInputProps("logoImageUrl")}
{...form.getInputProps("pageTitle")} label={t("board.field.logoImageUrl.label")}
/> placeholder="/logo/logo.png"
</Grid.Col> withAsterisk={false}
<Grid.Col span={{ xs: 12, md: 6 }}> />
<TextInput </Grid.Col>
label={t("board.field.metaTitle.label")} <Grid.Col span={{ xs: 12, md: 6 }}>
placeholder={createMetaTitle(t("board.content.metaTitle", { boardName: board.name }))} <IconPicker
rightSection={metaTitleStatus.isPending && <Loader size="xs" />} {...form.getInputProps("faviconImageUrl")}
{...form.getInputProps("metaTitle")} label={t("board.field.faviconImageUrl.label")}
/> placeholder="/logo/logo.png"
</Grid.Col> withAsterisk={false}
<Grid.Col span={{ xs: 12, md: 6 }}> />
<IconPicker </Grid.Col>
{...form.getInputProps("logoImageUrl")} </Grid>
label={t("board.field.logoImageUrl.label")} </SectionCard>
placeholder="/logo/logo.png"
withAsterisk={false}
/>
</Grid.Col>
<Grid.Col span={{ xs: 12, md: 6 }}>
<IconPicker
{...form.getInputProps("faviconImageUrl")}
label={t("board.field.faviconImageUrl.label")}
placeholder="/logo/logo.png"
withAsterisk={false}
/>
</Grid.Col>
</Grid>
<Group justify="end">
<Button type="submit" loading={isPending}>
{t("common.action.saveChanges")}
</Button>
</Group>
</Stack>
</form>
); );
}; };
@@ -146,14 +84,3 @@ const useMetaTitlePreview = (title: string | null) => {
isPending: (title ?? "") !== metaTitleDebounced, isPending: (title ?? "") !== metaTitleDebounced,
}; };
}; };
// Previously we used the useFavicon hook from Mantine
// However if the user tried to click on a link to a different page
// it caused an error "Cannot read properties of null (reading 'removeChild')"
// Probably because the head element was null (https://github.com/mantinedev/mantine/blob/b90d9b81031f45f5d15e75f25138ed6477f65bce/packages/%40mantine/hooks/src/use-favicon/use-favicon.ts#L21)
// See https://github.com/homarr-labs/homarr/issues/4905
const updateFavicon = (url: string) => {
const link: HTMLLinkElement | null = document.querySelector('link[rel="icon"]');
if (!link) return;
link.href = url;
};
@@ -2,114 +2,79 @@
import { Button, Fieldset, Grid, Group, Input, NumberInput, Slider, Stack, Text, TextInput } from "@mantine/core"; import { Button, Fieldset, Grid, Group, Input, NumberInput, Slider, Stack, Text, TextInput } from "@mantine/core";
import { clientApi } from "@homarr/api/client";
import { createId } from "@homarr/common"; import { createId } from "@homarr/common";
import { useZodForm } from "@homarr/form"; import type { UseFormReturnType } from "@homarr/form";
import { useI18n } from "@homarr/translation/client"; import { useI18n } from "@homarr/translation/client";
import { boardSaveLayoutsSchema } from "@homarr/validation/board";
import type { Board } from "../../_types"; import { SectionCard } from "~/components/manage/section-card";
import type { FormValues } from "./_settings-form";
interface Props { interface Props {
board: Board; form: UseFormReturnType<FormValues>;
} }
export const LayoutSettingsContent = ({ board }: Props) => {
export const LayoutSettingsContent = ({ form }: Props) => {
const t = useI18n(); const t = useI18n();
const utils = clientApi.useUtils();
const { mutate: saveLayouts, isPending } = clientApi.board.saveLayouts.useMutation({
onSettled() {
void utils.board.getBoardByName.invalidate({ name: board.name });
void utils.board.getHomeBoard.invalidate();
},
});
const form = useZodForm(boardSaveLayoutsSchema.omit({ id: true }).required(), {
initialValues: {
layouts: board.layouts,
},
});
return ( return (
<form <SectionCard title={t("board.setting.section.layout.title")}>
onSubmit={form.onSubmit((values) => { <Stack gap="sm">
saveLayouts({ <Group justify="space-between" align="center">
id: board.id, <Text fw={500}>{t("board.setting.section.layout.responsive.title")}</Text>
...values, <Button
}); type="button"
})} variant="subtle"
> onClick={() => {
<Stack> form.setValues((previous) => ({
<Stack gap="sm"> ...previous,
<Group justify="space-between" align="center"> layouts: [...(previous.layouts ?? []), { id: createId(), name: "", columnCount: 10, breakpoint: 0 }],
<Text fw={500}>{t("board.setting.section.layout.responsive.title")}</Text> }));
<Button }}
variant="subtle" >
onClick={() => { {t("board.setting.section.layout.responsive.action.add")}
form.setValues({
layouts: [
...form.values.layouts,
{
id: createId(),
name: "",
columnCount: 10,
breakpoint: 0,
},
],
});
}}
>
{t("board.setting.section.layout.responsive.action.add")}
</Button>
</Group>
{form.values.layouts.map((layout, index) => (
<Fieldset key={layout.id} legend={layout.name} bg="transparent">
<Grid>
<Grid.Col span={{ sm: 12, md: 6 }}>
<TextInput {...form.getInputProps(`layouts.${index}.name`)} label={t("layout.field.name.label")} />
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<Input.Wrapper label={t("layout.field.columnCount.label")}>
<Slider mt="xs" min={1} max={24} step={1} {...form.getInputProps(`layouts.${index}.columnCount`)} />
</Input.Wrapper>
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<NumberInput
{...form.getInputProps(`layouts.${index}.breakpoint`)}
label={t("layout.field.breakpoint.label")}
description={t("layout.field.breakpoint.description")}
/>
</Grid.Col>
</Grid>
{form.values.layouts.length >= 2 && (
<Group justify="end">
<Button
variant="subtle"
onClick={() => {
form.setValues((previous) =>
previous.layouts !== undefined && previous.layouts.length >= 2
? {
layouts: form.values.layouts.filter((filteredLayout) => filteredLayout.id !== layout.id),
}
: previous,
);
}}
>
{t("common.action.remove")}
</Button>
</Group>
)}
</Fieldset>
))}
</Stack>
<Group justify="end">
<Button type="submit" loading={isPending}>
{t("common.action.saveChanges")}
</Button> </Button>
</Group> </Group>
{form.values.layouts.map((layout, index) => (
<Fieldset key={layout.id} legend={layout.name} bg="transparent">
<Grid>
<Grid.Col span={{ sm: 12, md: 6 }}>
<TextInput {...form.getInputProps(`layouts.${index}.name`)} label={t("layout.field.name.label")} />
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<Input.Wrapper label={t("layout.field.columnCount.label")}>
<Slider mt="xs" min={1} max={24} step={1} {...form.getInputProps(`layouts.${index}.columnCount`)} />
</Input.Wrapper>
</Grid.Col>
<Grid.Col span={{ sm: 12, md: 6 }}>
<NumberInput
{...form.getInputProps(`layouts.${index}.breakpoint`)}
label={t("layout.field.breakpoint.label")}
description={t("layout.field.breakpoint.description")}
/>
</Grid.Col>
</Grid>
{form.values.layouts.length >= 2 && (
<Group justify="end">
<Button
type="button"
variant="subtle"
onClick={() => {
form.setValues((previous) => ({
...previous,
layouts: form.values.layouts.filter((filteredLayout) => filteredLayout.id !== layout.id),
}));
}}
>
{t("common.action.remove")}
</Button>
</Group>
)}
</Fieldset>
))}
</Stack> </Stack>
</form> </SectionCard>
); );
}; };
@@ -0,0 +1,219 @@
"use client";
import { useEffect, useRef } from "react";
import { Button, Stack } from "@mantine/core";
import type { z } from "zod/v4";
import type { RouterOutputs } from "@homarr/api";
import { useUpdateBoard } from "@homarr/boards/updater";
import { revalidatePathActionAsync } from "@homarr/common/client";
import { env } from "@homarr/common/env";
import { useZodForm } from "@homarr/form";
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
import { useI18n, useScopedI18n } from "@homarr/translation/client";
import { boardSaveLayoutsSchema, boardSavePartialSettingsSchema } from "@homarr/validation/board";
import { homarrLogoPath } from "~/components/layout/logo/homarr-logo";
import { SectionCard } from "~/components/manage/section-card";
import { UnsavedChangesBar } from "~/components/manage/unsaved-changes-bar";
import type { Board } from "../../_types";
import { ColorSettingsContent } from "./_appereance";
import { BackgroundSettingsContent } from "./_background";
import { BehaviorSettingsContent } from "./_behavior";
import { BoardAccessSettings } from "./_board-access";
import { CustomCssSettingsContent } from "./_customCss";
import { DangerZoneSettingsContent } from "./_danger";
import { GeneralSettingsContent } from "./_general";
import { LayoutSettingsContent } from "./_layout";
import { useSaveLayoutsMutation, useSavePartialSettingsMutation } from "./_shared";
const boardSettingsFormSchema = boardSavePartialSettingsSchema
.extend({
layouts: boardSaveLayoutsSchema.shape.layouts,
})
.required();
export type FormValues = z.infer<typeof boardSettingsFormSchema>;
const PARTIAL_FORM_KEYS = [
"pageTitle",
"metaTitle",
"logoImageUrl",
"faviconImageUrl",
"backgroundImageUrl",
"backgroundImageAttachment",
"backgroundImageRepeat",
"backgroundImageSize",
"primaryColor",
"secondaryColor",
"opacity",
"iconColor",
"itemRadius",
"customCss",
"disableStatus",
] as const;
const buildInitialValues = (board: Board): FormValues => ({
pageTitle: board.pageTitle ?? "",
metaTitle: board.metaTitle ?? "",
logoImageUrl: board.logoImageUrl ?? "",
faviconImageUrl: board.faviconImageUrl ?? "",
backgroundImageUrl: board.backgroundImageUrl ?? "",
backgroundImageAttachment: board.backgroundImageAttachment,
backgroundImageRepeat: board.backgroundImageRepeat,
backgroundImageSize: board.backgroundImageSize,
primaryColor: board.primaryColor,
secondaryColor: board.secondaryColor,
opacity: board.opacity,
iconColor: board.iconColor ?? "",
itemRadius: board.itemRadius,
customCss: board.customCss ?? "",
disableStatus: board.disableStatus,
layouts: board.layouts,
});
interface BoardSettingsFormProps {
board: Board;
permissions: RouterOutputs["board"]["getBoardPermissions"];
hasFullAccess: boolean;
hideVisibility: boolean;
}
export const BoardSettingsForm = ({ board, permissions, hasFullAccess, hideVisibility }: BoardSettingsFormProps) => {
const t = useI18n();
const tSection = useScopedI18n("board.setting.section");
const { updateBoard } = useUpdateBoard();
const savePartialSettings = useSavePartialSettingsMutation(board);
const saveLayouts = useSaveLayoutsMutation(board);
const form = useZodForm(boardSettingsFormSchema, {
initialValues: buildInitialValues(board),
onValuesChange({ pageTitle }) {
updateBoard((previous) => ({
...previous,
pageTitle,
}));
},
});
const initialValuesRef = useRef(buildInitialValues(board));
const lastSavedRef = useRef({ pageTitle: board.pageTitle, logoImageUrl: board.logoImageUrl });
const isDirtyRef = useRef(false);
isDirtyRef.current = form.isDirty();
useEffect(() => {
return () => {
updateBoard((previous) => ({
...previous,
pageTitle: lastSavedRef.current.pageTitle,
logoImageUrl: lastSavedRef.current.logoImageUrl,
}));
};
}, [updateBoard]);
useEffect(() => {
const handler = (event: BeforeUnloadEvent) => {
if (env.NODE_ENV === "development") return;
if (isDirtyRef.current) event.preventDefault();
};
window.addEventListener("beforeunload", handler);
return () => window.removeEventListener("beforeunload", handler);
}, []);
const handleSubmitAsync = async (values: FormValues) => {
const defaults = initialValuesRef.current;
const changed = <TKey extends keyof FormValues>(...fields: TKey[]) =>
fields.some((field) => values[field] !== defaults[field]);
const { layouts, ...partialSettings } = values;
const saveActions: { when: boolean; action: () => Promise<unknown> }[] = [
{
when: changed(...PARTIAL_FORM_KEYS),
action: () =>
savePartialSettings.mutateAsync({ id: board.id, ...partialSettings }).then(() => {
updateFavicon(values.faviconImageUrl ?? homarrLogoPath);
}),
},
{
when: changed("layouts"),
action: () => saveLayouts.mutateAsync({ id: board.id, layouts }),
},
];
const promises = saveActions.filter((saveAction) => saveAction.when).map((saveAction) => saveAction.action());
if (promises.length === 0) return;
try {
await Promise.all(promises);
lastSavedRef.current = { pageTitle: values.pageTitle, logoImageUrl: values.logoImageUrl };
initialValuesRef.current = values;
form.setInitialValues(values);
form.resetDirty();
await revalidatePathActionAsync(`/boards/${board.name}/settings`);
showSuccessNotification({
title: t("common.notification.update.success"),
message: t("common.notification.update.success"),
});
} catch {
showErrorNotification({
title: t("common.notification.update.error"),
message: t("common.notification.update.error"),
});
}
};
const handleDiscard = () => {
form.setValues(initialValuesRef.current);
form.resetDirty();
updateBoard((previous) => ({
...previous,
pageTitle: lastSavedRef.current.pageTitle,
logoImageUrl: lastSavedRef.current.logoImageUrl,
}));
};
const isPending = savePartialSettings.isPending || saveLayouts.isPending;
return (
<form onSubmit={form.onSubmit((values) => void handleSubmitAsync(values))}>
<Stack gap="xl">
<GeneralSettingsContent board={board} form={form} />
<LayoutSettingsContent form={form} />
<BackgroundSettingsContent form={form} />
<ColorSettingsContent form={form} />
<CustomCssSettingsContent form={form} />
<BehaviorSettingsContent form={form} />
{hasFullAccess && (
<SectionCard title={tSection("access.title")}>
<BoardAccessSettings board={board} initialPermissions={permissions} />
</SectionCard>
)}
{hasFullAccess && <DangerZoneSettingsContent hideVisibility={hideVisibility} />}
{form.isDirty() && (
<UnsavedChangesBar>
<Button type="button" disabled={isPending} variant="default" onClick={handleDiscard}>
{t("common.action.discard")}
</Button>
<Button loading={isPending} type="submit" disabled={!form.isValid()}>
{t("common.action.saveChanges")}
</Button>
</UnsavedChangesBar>
)}
</Stack>
</form>
);
};
// Previously part of the general settings section; applied on the unified save
// https://github.com/homarr-labs/homarr/issues/4905
const updateFavicon = (url: string) => {
const link = document.querySelector<HTMLLinkElement>('link[rel="icon"]');
if (!link) return;
link.href = url;
};
@@ -11,3 +11,13 @@ export const useSavePartialSettingsMutation = (board: Board) => {
}, },
}); });
}; };
export const useSaveLayoutsMutation = (board: Board) => {
const utils = clientApi.useUtils();
return clientApi.board.saveLayouts.useMutation({
onSettled() {
void utils.board.getBoardByName.invalidate({ name: board.name });
void utils.board.getHomeBoard.invalidate();
},
});
};
@@ -1,5 +0,0 @@
@media (min-width: 36em) {
.dangerZoneGroup {
--group-wrap: nowrap !important;
}
}
@@ -1,44 +1,20 @@
import type { PropsWithChildren } from "react";
import { notFound } from "next/navigation"; import { notFound } from "next/navigation";
import { AccordionControl, AccordionItem, AccordionPanel, Container, Stack, Text, Title } from "@mantine/core"; import { Container, Stack, Title } from "@mantine/core";
import {
IconAlertTriangle,
IconBrush,
IconClick,
IconFileTypeCss,
IconLayout,
IconPhoto,
IconSettings,
IconUser,
} from "@tabler/icons-react";
import { TRPCError } from "@trpc/server"; import { TRPCError } from "@trpc/server";
import { api } from "@homarr/api/server"; import { api } from "@homarr/api/server";
import { capitalize } from "@homarr/common"; import { capitalize } from "@homarr/common";
import { db } from "@homarr/db"; import { db } from "@homarr/db";
import { getServerSettingByKeyAsync } from "@homarr/db/queries"; import { getServerSettingByKeyAsync } from "@homarr/db/queries";
import type { TranslationObject } from "@homarr/translation";
import { getScopedI18n } from "@homarr/translation/server"; import { getScopedI18n } from "@homarr/translation/server";
import type { TablerIcon } from "@homarr/ui";
import { getBoardPermissionsAsync } from "~/components/board/permissions/server"; import { getBoardPermissionsAsync } from "~/components/board/permissions/server";
import { ActiveTabAccordion } from "../../../../../components/active-tab-accordion"; import { BoardSettingsForm } from "./_settings-form";
import { ColorSettingsContent } from "./_appereance";
import { BackgroundSettingsContent } from "./_background";
import { BehaviorSettingsContent } from "./_behavior";
import { BoardAccessSettings } from "./_board-access";
import { CustomCssSettingsContent } from "./_customCss";
import { DangerZoneSettingsContent } from "./_danger";
import { GeneralSettingsContent } from "./_general";
import { LayoutSettingsContent } from "./_layout";
interface Props { interface Props {
params: Promise<{ params: Promise<{
name: string; name: string;
}>; }>;
searchParams: Promise<{
tab?: keyof TranslationObject["board"]["setting"]["section"];
}>;
} }
const getBoardAndPermissionsAsync = async (params: Awaited<Props["params"]>) => { const getBoardAndPermissionsAsync = async (params: Awaited<Props["params"]>) => {
@@ -57,11 +33,7 @@ const getBoardAndPermissionsAsync = async (params: Awaited<Props["params"]>) =>
} catch (error) { } catch (error) {
// Ignore not found errors and redirect to 404 // Ignore not found errors and redirect to 404
// error is already logged in _layout-creator.tsx // error is already logged in _layout-creator.tsx
if (error instanceof TRPCError && error.code === "NOT_FOUND") { if (error instanceof TRPCError && (error.code === "NOT_FOUND" || error.code === "BAD_REQUEST")) {
notFound();
}
if (error instanceof TRPCError && error.code === "BAD_REQUEST") {
notFound(); notFound();
} }
@@ -70,7 +42,6 @@ const getBoardAndPermissionsAsync = async (params: Awaited<Props["params"]>) =>
}; };
export default async function BoardSettingsPage(props: Props) { export default async function BoardSettingsPage(props: Props) {
const searchParams = await props.searchParams;
const params = await props.params; const params = await props.params;
const { board, permissions } = await getBoardAndPermissionsAsync(params); const { board, permissions } = await getBoardAndPermissionsAsync(params);
const boardSettings = await getServerSettingByKeyAsync(db, "board"); const boardSettings = await getServerSettingByKeyAsync(db, "board");
@@ -85,76 +56,13 @@ export default async function BoardSettingsPage(props: Props) {
<Container> <Container>
<Stack> <Stack>
<Title>{t("title", { boardName: capitalize(board.name) })}</Title> <Title>{t("title", { boardName: capitalize(board.name) })}</Title>
<ActiveTabAccordion variant="separated" defaultValue={searchParams.tab ?? "general"}> <BoardSettingsForm
<AccordionItemFor value="general" icon={IconSettings}> board={board}
<GeneralSettingsContent board={board} /> permissions={permissions}
</AccordionItemFor> hasFullAccess={hasFullAccess}
<AccordionItemFor value="layout" icon={IconLayout}> hideVisibility={boardSettings.homeBoardId === board.id || boardSettings.mobileHomeBoardId === board.id}
<LayoutSettingsContent board={board} /> />
</AccordionItemFor>
<AccordionItemFor value="background" icon={IconPhoto}>
<BackgroundSettingsContent board={board} />
</AccordionItemFor>
<AccordionItemFor value="appearance" icon={IconBrush}>
<ColorSettingsContent board={board} />
</AccordionItemFor>
<AccordionItemFor value="customCss" icon={IconFileTypeCss}>
<CustomCssSettingsContent board={board} />
</AccordionItemFor>
<AccordionItemFor value="behavior" icon={IconClick}>
<BehaviorSettingsContent board={board} />
</AccordionItemFor>
{hasFullAccess && (
<>
<AccordionItemFor value="access" icon={IconUser}>
<BoardAccessSettings board={board} initialPermissions={permissions} />
</AccordionItemFor>
<AccordionItemFor value="dangerZone" icon={IconAlertTriangle} danger noPadding>
<DangerZoneSettingsContent
hideVisibility={
boardSettings.homeBoardId === board.id || boardSettings.mobileHomeBoardId === board.id
}
/>
</AccordionItemFor>
</>
)}
</ActiveTabAccordion>
</Stack> </Stack>
</Container> </Container>
); );
} }
type AccordionItemForProps = PropsWithChildren<{
value: keyof TranslationObject["board"]["setting"]["section"];
icon: TablerIcon;
danger?: boolean;
noPadding?: boolean;
}>;
const AccordionItemFor = async ({ value, children, icon: Icon, danger, noPadding }: AccordionItemForProps) => {
const t = await getScopedI18n("board.setting.section");
return (
<AccordionItem
value={value}
styles={
danger
? {
item: {
"--__item-border-color": "rgba(248,81,73,0.4)",
borderWidth: 4,
},
}
: undefined
}
>
<AccordionControl icon={<Icon />}>
<Text fw="bold" size="lg">
{t(`${value}.title`)}
</Text>
</AccordionControl>
<AccordionPanel styles={noPadding ? { content: { paddingRight: 0, paddingLeft: 0 } } : undefined}>
{children}
</AccordionPanel>
</AccordionItem>
);
};
@@ -1,53 +1,22 @@
"use client"; "use client";
import React from "react"; import type { UseFormReturnType } from "@homarr/form";
import { Card, LoadingOverlay, Stack, Title } from "@mantine/core";
import { clientApi } from "@homarr/api/client";
import { revalidatePathActionAsync } from "@homarr/common/client";
import { useForm } from "@homarr/form";
import type { defaultServerSettings } from "@homarr/server-settings";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { SwitchSetting } from "~/app/[locale]/manage/settings/_components/setting-switch"; import { SectionCard } from "~/components/manage/section-card";
import type { FormValues } from "./settings-form";
import { SwitchSetting } from "./setting-switch";
interface AnalyticsSettingsProps { interface AnalyticsSettingsProps {
initialData: typeof defaultServerSettings.analytics; form: UseFormReturnType<FormValues>;
} }
export const AnalyticsSettings = ({ initialData }: AnalyticsSettingsProps) => { export const AnalyticsSettings = ({ form }: AnalyticsSettingsProps) => {
const t = useScopedI18n("management.page.settings.section.analytics"); const t = useScopedI18n("management.page.settings.section.analytics");
const { instanceId: _, ...formDefaults } = initialData;
const form = useForm({
initialValues: formDefaults,
onValuesChange: (updatedValues, _prev) => {
if (!form.isValid()) {
return;
}
void mutateAsync({
settingsKey: "analytics",
value: updatedValues,
});
},
});
const { mutateAsync, isPending } = clientApi.serverSettings.saveSettings.useMutation({
onSettled: async () => {
await revalidatePathActionAsync("/manage/settings");
},
});
return ( return (
<> <SectionCard title={t("title")}>
<Title order={2}>{t("title")}</Title> <SwitchSetting form={form} formKey="enableGeneral" title={t("general.title")} text={t("general.text")} />
</SectionCard>
<Card pos="relative">
<LoadingOverlay visible={isPending} />
<Stack>
<SwitchSetting form={form} formKey="enableGeneral" title={t("general.title")} text={t("general.text")} />
</Stack>
</Card>
</>
); );
}; };
@@ -5,31 +5,32 @@ import { IconDeviceDesktop, IconMoon, IconSun } from "@tabler/icons-react";
import type { ColorScheme } from "@homarr/definitions"; import type { ColorScheme } from "@homarr/definitions";
import { colorSchemes } from "@homarr/definitions"; import { colorSchemes } from "@homarr/definitions";
import type { ServerSettings } from "@homarr/server-settings"; import type { UseFormReturnType } from "@homarr/form";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { SelectWithCustomItems } from "@homarr/ui"; import { SelectWithCustomItems } from "@homarr/ui";
import { CommonSettingsForm } from "./common-form"; import { SectionCard } from "~/components/manage/section-card";
import type { FormValues } from "./settings-form";
export const AppearanceSettingsForm = ({ defaultValues }: { defaultValues: ServerSettings["appearance"] }) => { interface AppearanceSettingsFormProps {
const tApperance = useScopedI18n("management.page.settings.section.appearance"); form: UseFormReturnType<FormValues>;
}
export const AppearanceSettingsForm = ({ form }: AppearanceSettingsFormProps) => {
const tAppearance = useScopedI18n("management.page.settings.section.appearance");
return ( return (
<CommonSettingsForm settingKey="appearance" defaultValues={defaultValues}> <SectionCard title={tAppearance("title")}>
{(form) => ( <SelectWithCustomItems
<> label={tAppearance("defaultColorScheme.label")}
<SelectWithCustomItems data={colorSchemes.map((scheme) => ({
label={tApperance("defaultColorScheme.label")} value: scheme,
data={colorSchemes.map((scheme) => ({ label: tAppearance(`defaultColorScheme.options.${scheme}`),
value: scheme, }))}
label: tApperance(`defaultColorScheme.options.${scheme}`), {...form.getInputProps("defaultColorScheme")}
}))} SelectOption={AppearanceCustomOption}
{...form.getInputProps("defaultColorScheme")} />
SelectOption={ApperanceCustomOption} </SectionCard>
/>
</>
)}
</CommonSettingsForm>
); );
}; };
@@ -39,7 +40,7 @@ const appearanceIcons = {
dark: IconMoon, dark: IconMoon,
}; };
const ApperanceCustomOption = ({ value, label }: { value: ColorScheme; label: string }) => { const AppearanceCustomOption = ({ value, label }: { value: ColorScheme; label: string }) => {
const Icon = appearanceIcons[value]; const Icon = appearanceIcons[value];
return ( return (
@@ -3,49 +3,50 @@
import { Switch, Text } from "@mantine/core"; import { Switch, Text } from "@mantine/core";
import { clientApi } from "@homarr/api/client"; import { clientApi } from "@homarr/api/client";
import type { ServerSettings } from "@homarr/server-settings"; import type { UseFormReturnType } from "@homarr/form";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { BoardSelect } from "~/components/board/board-select"; import { BoardSelect } from "~/components/board/board-select";
import { CommonSettingsForm } from "./common-form"; import { SectionCard } from "~/components/manage/section-card";
import type { FormValues } from "./settings-form";
export const BoardSettingsForm = ({ defaultValues }: { defaultValues: ServerSettings["board"] }) => { interface BoardSettingsFormProps {
form: UseFormReturnType<FormValues>;
}
export const BoardSettingsForm = ({ form }: BoardSettingsFormProps) => {
const tBoard = useScopedI18n("management.page.settings.section.board"); const tBoard = useScopedI18n("management.page.settings.section.board");
const [selectableBoards] = clientApi.board.getPublicBoards.useSuspenseQuery(); const [selectableBoards] = clientApi.board.getPublicBoards.useSuspenseQuery();
return ( return (
<CommonSettingsForm settingKey="board" defaultValues={defaultValues}> <SectionCard title={tBoard("title")}>
{(form) => ( <BoardSelect
<> label={tBoard("homeBoard.label")}
<BoardSelect description={tBoard("homeBoard.description")}
label={tBoard("homeBoard.label")} clearable
description={tBoard("homeBoard.description")} boards={selectableBoards}
clearable {...form.getInputProps("homeBoardId")}
boards={selectableBoards} />
{...form.getInputProps("homeBoardId")}
/>
<BoardSelect <BoardSelect
label={tBoard("homeBoard.mobileLabel")} label={tBoard("homeBoard.mobileLabel")}
description={tBoard("homeBoard.description")} description={tBoard("homeBoard.description")}
clearable clearable
boards={selectableBoards} boards={selectableBoards}
{...form.getInputProps("mobileHomeBoardId")} {...form.getInputProps("mobileHomeBoardId")}
/> />
<Text fw={500}>{tBoard("status.title")}</Text> <Text fw={500}>{tBoard("status.title")}</Text>
<Switch <Switch
{...form.getInputProps("enableStatusByDefault", { type: "checkbox" })} {...form.getInputProps("enableStatusByDefault", { type: "checkbox" })}
label={tBoard("status.enableStatusByDefault.label")} label={tBoard("status.enableStatusByDefault.label")}
description={tBoard("status.enableStatusByDefault.description")} description={tBoard("status.enableStatusByDefault.description")}
/> />
<Switch <Switch
{...form.getInputProps("forceDisableStatus", { type: "checkbox" })} {...form.getInputProps("forceDisableStatus", { type: "checkbox" })}
label={tBoard("status.forceDisableStatus.label")} label={tBoard("status.forceDisableStatus.label")}
description={tBoard("status.forceDisableStatus.description")} description={tBoard("status.forceDisableStatus.description")}
/> />
</> </SectionCard>
)}
</CommonSettingsForm>
); );
}; };
@@ -1,57 +0,0 @@
"use client";
import { Button, Group, Stack } from "@mantine/core";
import { clientApi } from "@homarr/api/client";
import { useForm } from "@homarr/form";
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
import type { ServerSettings } from "@homarr/server-settings";
import { useI18n, useScopedI18n } from "@homarr/translation/client";
export const CommonSettingsForm = <TKey extends keyof ServerSettings>({
settingKey,
defaultValues,
children,
}: {
settingKey: TKey;
defaultValues: ServerSettings[TKey];
children: (form: ReturnType<typeof useForm<ServerSettings[TKey]>>) => React.ReactNode;
}) => {
const t = useI18n();
const tSettings = useScopedI18n("management.page.settings");
const { mutateAsync, isPending } = clientApi.serverSettings.saveSettings.useMutation({
onSuccess() {
showSuccessNotification({
message: tSettings("notification.success.message"),
});
},
onError() {
showErrorNotification({
message: tSettings("notification.error.message"),
});
},
});
const form = useForm({
initialValues: defaultValues,
});
const handleSubmitAsync = async (values: ServerSettings[TKey]) => {
await mutateAsync({
settingsKey: settingKey,
value: values,
});
};
return (
<form onSubmit={form.onSubmit((values) => void handleSubmitAsync(values))}>
<Stack gap="sm">
{children(form)}
<Group justify="end">
<Button type="submit" loading={isPending}>
{t("common.action.save")}
</Button>
</Group>
</Stack>
</form>
);
};
@@ -1,68 +1,35 @@
"use client"; "use client";
import React from "react"; import { Text } from "@mantine/core";
import { Card, LoadingOverlay, Stack, Text, Title } from "@mantine/core";
import { clientApi } from "@homarr/api/client"; import type { UseFormReturnType } from "@homarr/form";
import { revalidatePathActionAsync } from "@homarr/common/client";
import { useForm } from "@homarr/form";
import type { defaultServerSettings } from "@homarr/server-settings";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { SwitchSetting } from "~/app/[locale]/manage/settings/_components/setting-switch"; import { SectionCard } from "~/components/manage/section-card";
import type { FormValues } from "./settings-form";
import { SwitchSetting } from "./setting-switch";
interface CrawlingAndIndexingSettingsProps { interface CrawlingAndIndexingSettingsProps {
initialData: typeof defaultServerSettings.crawlingAndIndexing; form: UseFormReturnType<FormValues>;
} }
export const CrawlingAndIndexingSettings = ({ initialData }: CrawlingAndIndexingSettingsProps) => { export const CrawlingAndIndexingSettings = ({ form }: CrawlingAndIndexingSettingsProps) => {
const t = useScopedI18n("management.page.settings.section.crawlingAndIndexing"); const t = useScopedI18n("management.page.settings.section.crawlingAndIndexing");
const form = useForm({
initialValues: initialData,
onValuesChange: (updatedValues, _) => {
if (!form.isValid()) {
return;
}
void mutateAsync({
settingsKey: "crawlingAndIndexing",
value: updatedValues,
});
},
});
const { mutateAsync, isPending } = clientApi.serverSettings.saveSettings.useMutation({
onSettled: async () => {
await revalidatePathActionAsync("/manage/settings");
},
});
return ( return (
<> <SectionCard title={t("title")}>
<Title order={2}>{t("title")}</Title> <Text c="dimmed" size="sm">
{t("warning")}
<Card pos="relative"> </Text>
<Text c={"dimmed"} mb={"lg"}> <SwitchSetting form={form} formKey="noIndex" title={t("noIndex.title")} text={t("noIndex.text")} />
{t("warning")} <SwitchSetting form={form} formKey="noFollow" title={t("noFollow.title")} text={t("noFollow.text")} />
</Text> <SwitchSetting form={form} formKey="noTranslate" title={t("noTranslate.title")} text={t("noTranslate.text")} />
<LoadingOverlay visible={isPending} /> <SwitchSetting
<Stack> form={form}
<SwitchSetting form={form} formKey="noIndex" title={t("noIndex.title")} text={t("noIndex.text")} /> formKey="noSiteLinksSearchBox"
<SwitchSetting form={form} formKey="noFollow" title={t("noFollow.title")} text={t("noFollow.text")} /> title={t("noSiteLinksSearchBox.title")}
<SwitchSetting text={t("noSiteLinksSearchBox.text")}
form={form} />
formKey="noTranslate" </SectionCard>
title={t("noTranslate.title")}
text={t("noTranslate.text")}
/>
<SwitchSetting
form={form}
formKey="noSiteLinksSearchBox"
title={t("noSiteLinksSearchBox.title")}
text={t("noSiteLinksSearchBox.text")}
/>
</Stack>
</Card>
</>
); );
}; };
@@ -1,26 +1,28 @@
"use client"; "use client";
import type { ServerSettings } from "@homarr/server-settings"; import type { UseFormReturnType } from "@homarr/form";
import type { SupportedLanguage } from "@homarr/translation"; import type { SupportedLanguage } from "@homarr/translation";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { LanguageCombobox } from "~/components/language/language-combobox"; import { LanguageCombobox } from "~/components/language/language-combobox";
import { CommonSettingsForm } from "./common-form"; import { SectionCard } from "~/components/manage/section-card";
import type { FormValues } from "./settings-form";
export const CultureSettingsForm = ({ defaultValues }: { defaultValues: ServerSettings["culture"] }) => { interface CultureSettingsFormProps {
form: UseFormReturnType<FormValues>;
}
export const CultureSettingsForm = ({ form }: CultureSettingsFormProps) => {
const tCulture = useScopedI18n("management.page.settings.section.culture"); const tCulture = useScopedI18n("management.page.settings.section.culture");
const localeInputProps = form.getInputProps("defaultLocale");
return ( return (
<CommonSettingsForm settingKey="culture" defaultValues={defaultValues}> <SectionCard title={tCulture("title")}>
{(form) => ( <LanguageCombobox
<> label={tCulture("defaultLocale.label")}
<LanguageCombobox {...localeInputProps}
label={tCulture("defaultLocale.label")} value={localeInputProps.value as SupportedLanguage}
value={form.getInputProps("defaultLocale").value as SupportedLanguage} />
{...form.getInputProps("defaultLocale")} </SectionCard>
/>
</>
)}
</CommonSettingsForm>
); );
}; };
@@ -3,27 +3,28 @@
import { Select } from "@mantine/core"; import { Select } from "@mantine/core";
import { clientApi } from "@homarr/api/client"; import { clientApi } from "@homarr/api/client";
import type { ServerSettings } from "@homarr/server-settings"; import type { UseFormReturnType } from "@homarr/form";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { CommonSettingsForm } from "./common-form"; import { SectionCard } from "~/components/manage/section-card";
import type { FormValues } from "./settings-form";
export const SearchSettingsForm = ({ defaultValues }: { defaultValues: ServerSettings["search"] }) => { interface SearchSettingsFormProps {
form: UseFormReturnType<FormValues>;
}
export const SearchSettingsForm = ({ form }: SearchSettingsFormProps) => {
const tSearch = useScopedI18n("management.page.settings.section.search"); const tSearch = useScopedI18n("management.page.settings.section.search");
const [selectableSearchEngines] = clientApi.searchEngine.getSelectable.useSuspenseQuery({ withIntegrations: false }); const [selectableSearchEngines] = clientApi.searchEngine.getSelectable.useSuspenseQuery({ withIntegrations: false });
return ( return (
<CommonSettingsForm settingKey="search" defaultValues={defaultValues}> <SectionCard title={tSearch("title")}>
{(form) => ( <Select
<> label={tSearch("defaultSearchEngine.label")}
<Select description={tSearch("defaultSearchEngine.description")}
label={tSearch("defaultSearchEngine.label")} data={selectableSearchEngines}
description={tSearch("defaultSearchEngine.description")} {...form.getInputProps("defaultSearchEngineId")}
data={selectableSearchEngines} />
{...form.getInputProps("defaultSearchEngineId")} </SectionCard>
/>
</>
)}
</CommonSettingsForm>
); );
}; };
@@ -3,10 +3,13 @@ import React from "react";
import type { MantineSpacing } from "@mantine/core"; import type { MantineSpacing } from "@mantine/core";
import { Group, Stack, Switch, Text, UnstyledButton } from "@mantine/core"; import { Group, Stack, Switch, Text, UnstyledButton } from "@mantine/core";
import type { Modify } from "@homarr/common/types";
import type { UseFormReturnType } from "@homarr/form"; import type { UseFormReturnType } from "@homarr/form";
export const SwitchSetting = <TFormValue extends Record<string, boolean>>({ type BooleanKeys<TFormValue> = {
[TKey in keyof TFormValue]: TFormValue[TKey] extends boolean ? TKey : never;
}[keyof TFormValue];
export const SwitchSetting = <TFormValue extends Record<string, unknown>>({
form, form,
ms, ms,
title, title,
@@ -14,13 +17,8 @@ export const SwitchSetting = <TFormValue extends Record<string, boolean>>({
formKey, formKey,
disabled, disabled,
}: { }: {
form: Modify< form: UseFormReturnType<TFormValue, TFormValue>;
UseFormReturnType<TFormValue, TFormValue>, formKey: string & BooleanKeys<TFormValue>;
{
setFieldValue: (key: keyof TFormValue, value: (previous: boolean) => boolean) => void;
}
>;
formKey: keyof TFormValue;
ms?: MantineSpacing; ms?: MantineSpacing;
title: string; title: string;
text: ReactNode; text: ReactNode;
@@ -31,7 +29,7 @@ export const SwitchSetting = <TFormValue extends Record<string, boolean>>({
return; return;
} }
form.setFieldValue(formKey, (previous) => !previous); form.setFieldValue(formKey, (previous) => !previous as never);
}, [form, formKey, disabled]); }, [form, formKey, disabled]);
return ( return (
@@ -44,7 +42,7 @@ export const SwitchSetting = <TFormValue extends Record<string, boolean>>({
</Text> </Text>
</Stack> </Stack>
</UnstyledButton> </UnstyledButton>
<Switch disabled={disabled} onClick={handleClick} checked={form.values[formKey] && !disabled} /> <Switch disabled={disabled} onClick={handleClick} checked={Boolean(form.values[formKey])} />
</Group> </Group>
); );
}; };
@@ -0,0 +1,193 @@
"use client";
import { useEffect, useRef, useState } from "react";
import { Button, Stack } from "@mantine/core";
import { z } from "zod/v4";
import { clientApi } from "@homarr/api/client";
import { revalidatePathActionAsync } from "@homarr/common/client";
import { env } from "@homarr/common/env";
import { colorSchemes } from "@homarr/definitions";
import { useZodForm } from "@homarr/form";
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
import type { ServerSettings, defaultServerSettingsKeys } from "@homarr/server-settings";
import { useI18n, useScopedI18n } from "@homarr/translation/client";
import { UnsavedChangesBar } from "~/components/manage/unsaved-changes-bar";
import { AnalyticsSettings } from "./analytics.settings";
import { AppearanceSettingsForm } from "./appearance-settings-form";
import { BoardSettingsForm } from "./board-settings-form";
import { CrawlingAndIndexingSettings } from "./crawling-and-indexing.settings";
import { CultureSettingsForm } from "./culture-settings-form";
import { SearchSettingsForm } from "./search-settings-form";
import { UserSettingsForm } from "./user-settings-form";
const settingsFormSchema = z.object({
enableGeneral: z.boolean(),
noIndex: z.boolean(),
noFollow: z.boolean(),
noTranslate: z.boolean(),
noSiteLinksSearchBox: z.boolean(),
homeBoardId: z.string().nullable(),
mobileHomeBoardId: z.string().nullable(),
enableStatusByDefault: z.boolean(),
forceDisableStatus: z.boolean(),
enableGravatar: z.boolean(),
defaultSearchEngineId: z.string().nullable(),
defaultColorScheme: z.enum(colorSchemes),
defaultLocale: z.string(),
});
export type FormValues = z.infer<typeof settingsFormSchema>;
const buildInitialValues = (initialData: ServerSettings): FormValues => ({
enableGeneral: initialData.analytics.enableGeneral,
noIndex: initialData.crawlingAndIndexing.noIndex,
noFollow: initialData.crawlingAndIndexing.noFollow,
noTranslate: initialData.crawlingAndIndexing.noTranslate,
noSiteLinksSearchBox: initialData.crawlingAndIndexing.noSiteLinksSearchBox,
homeBoardId: initialData.board.homeBoardId,
mobileHomeBoardId: initialData.board.mobileHomeBoardId,
enableStatusByDefault: initialData.board.enableStatusByDefault,
forceDisableStatus: initialData.board.forceDisableStatus,
enableGravatar: initialData.user.enableGravatar,
defaultSearchEngineId: initialData.search.defaultSearchEngineId,
defaultColorScheme: initialData.appearance.defaultColorScheme,
defaultLocale: initialData.culture.defaultLocale,
});
interface SettingsFormProps {
initialData: ServerSettings;
}
export const SettingsForm = ({ initialData }: SettingsFormProps) => {
const t = useI18n();
const tSettings = useScopedI18n("management.page.settings");
const initialValues = buildInitialValues(initialData);
const initialValuesRef = useRef(initialValues);
const form = useZodForm(settingsFormSchema, {
initialValues,
});
const isDirtyRef = useRef(false);
isDirtyRef.current = form.isDirty();
const [isSubmitting, setIsSubmitting] = useState(false);
const saveSettingsMutation = clientApi.serverSettings.saveSettings.useMutation({
onError(error) {
showErrorNotification({ title: t("common.notification.update.error"), message: error.message });
},
});
useEffect(() => {
const handler = (event: BeforeUnloadEvent) => {
if (env.NODE_ENV === "development") return;
if (isDirtyRef.current) event.preventDefault();
};
window.addEventListener("beforeunload", handler);
return () => window.removeEventListener("beforeunload", handler);
}, []);
const handleSubmitAsync = async (values: FormValues) => {
const defaults = initialValuesRef.current;
const changed = <TKey extends keyof FormValues>(...fields: TKey[]) =>
fields.some((field) => values[field] !== defaults[field]);
const groups: {
settingsKey: (typeof defaultServerSettingsKeys)[number];
when: boolean;
value: Record<string, unknown>;
}[] = [
{ settingsKey: "analytics", when: changed("enableGeneral"), value: { enableGeneral: values.enableGeneral } },
{
settingsKey: "crawlingAndIndexing",
when: changed("noIndex", "noFollow", "noTranslate", "noSiteLinksSearchBox"),
value: {
noIndex: values.noIndex,
noFollow: values.noFollow,
noTranslate: values.noTranslate,
noSiteLinksSearchBox: values.noSiteLinksSearchBox,
},
},
{
settingsKey: "board",
when: changed("homeBoardId", "mobileHomeBoardId", "enableStatusByDefault", "forceDisableStatus"),
value: {
homeBoardId: values.homeBoardId,
mobileHomeBoardId: values.mobileHomeBoardId,
enableStatusByDefault: values.enableStatusByDefault,
forceDisableStatus: values.forceDisableStatus,
},
},
{ settingsKey: "user", when: changed("enableGravatar"), value: { enableGravatar: values.enableGravatar } },
{
settingsKey: "search",
when: changed("defaultSearchEngineId"),
value: { defaultSearchEngineId: values.defaultSearchEngineId },
},
{
settingsKey: "appearance",
when: changed("defaultColorScheme"),
value: { defaultColorScheme: values.defaultColorScheme },
},
{ settingsKey: "culture", when: changed("defaultLocale"), value: { defaultLocale: values.defaultLocale } },
];
const promises = groups
.filter((group) => group.when)
.map((group) => saveSettingsMutation.mutateAsync({ settingsKey: group.settingsKey, value: group.value }));
if (promises.length === 0) return;
setIsSubmitting(true);
try {
const results = await Promise.allSettled(promises);
if (!results.every((result) => result.status === "fulfilled")) {
return;
}
initialValuesRef.current = values;
form.setInitialValues(values);
form.resetDirty();
await revalidatePathActionAsync("/manage/settings");
showSuccessNotification({
title: t("common.notification.update.success"),
message: tSettings("notification.success.message"),
});
} finally {
setIsSubmitting(false);
}
};
const handleDiscard = () => {
form.setValues(initialValuesRef.current);
form.resetDirty();
};
return (
<form onSubmit={form.onSubmit((values) => void handleSubmitAsync(values))}>
<Stack gap="xl">
<AnalyticsSettings form={form} />
<CrawlingAndIndexingSettings form={form} />
<BoardSettingsForm form={form} />
<UserSettingsForm form={form} />
<SearchSettingsForm form={form} />
<AppearanceSettingsForm form={form} />
<CultureSettingsForm form={form} />
{form.isDirty() && (
<UnsavedChangesBar>
<Button type="button" disabled={isSubmitting} variant="default" onClick={handleDiscard}>
{t("common.action.discard")}
</Button>
<Button loading={isSubmitting} type="submit" disabled={!form.isValid()}>
{t("common.action.saveChanges")}
</Button>
</UnsavedChangesBar>
)}
</Stack>
</form>
);
};
@@ -2,25 +2,26 @@
import { Switch } from "@mantine/core"; import { Switch } from "@mantine/core";
import type { ServerSettings } from "@homarr/server-settings"; import type { UseFormReturnType } from "@homarr/form";
import { useScopedI18n } from "@homarr/translation/client"; import { useScopedI18n } from "@homarr/translation/client";
import { CommonSettingsForm } from "./common-form"; import { SectionCard } from "~/components/manage/section-card";
import type { FormValues } from "./settings-form";
export const UserSettingsForm = ({ defaultValues }: { defaultValues: ServerSettings["user"] }) => { interface UserSettingsFormProps {
form: UseFormReturnType<FormValues>;
}
export const UserSettingsForm = ({ form }: UserSettingsFormProps) => {
const tUser = useScopedI18n("management.page.settings.section.user"); const tUser = useScopedI18n("management.page.settings.section.user");
return ( return (
<CommonSettingsForm settingKey="user" defaultValues={defaultValues}> <SectionCard title={tUser("title")}>
{(form) => ( <Switch
<> {...form.getInputProps("enableGravatar", { type: "checkbox" })}
<Switch label={tUser("enableGravatar.label")}
{...form.getInputProps("enableGravatar", { type: "checkbox" })} description={tUser("enableGravatar.description")}
label={tUser("enableGravatar.label")} />
description={tUser("enableGravatar.description")} </SectionCard>
/>
</>
)}
</CommonSettingsForm>
); );
}; };
@@ -0,0 +1,9 @@
import { Center, Loader } from "@mantine/core";
export default function SettingsLoading() {
return (
<Center h="40vh">
<Loader />
</Center>
);
}
@@ -5,14 +5,8 @@ import { api } from "@homarr/api/server";
import { auth } from "@homarr/auth/next"; import { auth } from "@homarr/auth/next";
import { getScopedI18n } from "@homarr/translation/server"; import { getScopedI18n } from "@homarr/translation/server";
import { CrawlingAndIndexingSettings } from "~/app/[locale]/manage/settings/_components/crawling-and-indexing.settings";
import { DynamicBreadcrumb } from "~/components/navigation/dynamic-breadcrumb"; import { DynamicBreadcrumb } from "~/components/navigation/dynamic-breadcrumb";
import { AnalyticsSettings } from "./_components/analytics.settings"; import { SettingsForm } from "./_components/settings-form";
import { AppearanceSettingsForm } from "./_components/appearance-settings-form";
import { BoardSettingsForm } from "./_components/board-settings-form";
import { CultureSettingsForm } from "./_components/culture-settings-form";
import { SearchSettingsForm } from "./_components/search-settings-form";
import { UserSettingsForm } from "./_components/user-settings-form";
export async function generateMetadata() { export async function generateMetadata() {
const t = await getScopedI18n("management"); const t = await getScopedI18n("management");
@@ -32,33 +26,13 @@ export default async function SettingsPage() {
const serverSettings = await api.serverSettings.getAll(); const serverSettings = await api.serverSettings.getAll();
const tSettings = await getScopedI18n("management.page.settings"); const tSettings = await getScopedI18n("management.page.settings");
return ( return (
<> <>
<DynamicBreadcrumb /> <DynamicBreadcrumb />
<Stack> <Stack>
<Title order={1}>{tSettings("title")}</Title> <Title order={1}>{tSettings("title")}</Title>
<AnalyticsSettings initialData={serverSettings.analytics} /> <SettingsForm initialData={serverSettings} />
<CrawlingAndIndexingSettings initialData={serverSettings.crawlingAndIndexing} />
<Stack>
<Title order={2}>{tSettings("section.board.title")}</Title>
<BoardSettingsForm defaultValues={serverSettings.board} />
</Stack>
<Stack>
<Title order={2}>{tSettings("section.user.title")}</Title>
<UserSettingsForm defaultValues={serverSettings.user} />
</Stack>
<Stack>
<Title order={2}>{tSettings("section.search.title")}</Title>
<SearchSettingsForm defaultValues={serverSettings.search} />
</Stack>
<Stack>
<Title order={2}>{tSettings("section.appearance.title")}</Title>
<AppearanceSettingsForm defaultValues={serverSettings.appearance} />
</Stack>
<Stack>
<Title order={2}>{tSettings("section.culture.title")}</Title>
<CultureSettingsForm defaultValues={serverSettings.culture} />
</Stack>
</Stack> </Stack>
</> </>
); );
@@ -1,19 +1,21 @@
"use client";
import { Fragment } from "react"; import { Fragment } from "react";
import { Card, CardSection, Divider, Group, Stack, Text, Title } from "@mantine/core"; import { Card, CardSection, Divider, Group, Stack, Text, Title } from "@mantine/core";
import { getI18n } from "@homarr/translation/server"; import { useScopedI18n } from "@homarr/translation/client";
interface DangerZoneRootProps { interface DangerZoneRootProps {
children: React.ReactNode[] | React.ReactNode; children: React.ReactNode[] | React.ReactNode;
} }
export const DangerZoneRoot = async ({ children }: DangerZoneRootProps) => { export const DangerZoneRoot = ({ children }: DangerZoneRootProps) => {
const t = await getI18n(); const t = useScopedI18n("common");
return ( return (
<Stack gap="sm"> <Stack gap="sm">
<Title c="red.8" order={2}> <Title c="red.8" order={2}>
{t("common.dangerZone")} {t("dangerZone")}
</Title> </Title>
<Card style={{ borderColor: "var(--mantine-color-red-8)", borderWidth: 3 }}> <Card style={{ borderColor: "var(--mantine-color-red-8)", borderWidth: 3 }}>
<Stack gap="sm"> <Stack gap="sm">
@@ -0,0 +1,19 @@
import type { ReactNode } from "react";
import { Card, Divider, Stack, Title } from "@mantine/core";
interface SectionCardProps {
title: ReactNode;
children: ReactNode;
}
export const SectionCard = ({ title, children }: SectionCardProps) => {
return (
<Card withBorder bg="transparent">
<Stack gap="md">
<Title order={3}>{title}</Title>
<Divider />
{children}
</Stack>
</Card>
);
};
@@ -0,0 +1,25 @@
"use client";
import type { ReactNode } from "react";
import { Card, Group, Text } from "@mantine/core";
import { useI18n } from "@homarr/translation/client";
interface UnsavedChangesBarProps {
children: ReactNode;
}
export const UnsavedChangesBar = ({ children }: UnsavedChangesBarProps) => {
const t = useI18n();
return (
<div style={{ position: "sticky", bottom: 20 }}>
<Card withBorder>
<Group justify="space-between" wrap="wrap">
<Text fw={500}>{t("common.unsavedChanges")}</Text>
<Group>{children}</Group>
</Group>
</Card>
</div>
);
};
+1 -1
View File
@@ -5,7 +5,7 @@ events {
http { http {
server { server {
listen 7575; listen 7575;
listen [::]:7575; ${NGINX_LISTEN_IPV6}
# Route websockets traffic to port 3001 # Route websockets traffic to port 3001
location /websockets { location /websockets {
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
File diff suppressed because it is too large. Load diff
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "crwdns5493:0crwdne5493:0", "actionButton": "crwdns5493:0crwdne5493:0",
"customJsx": "crwdns5495:0crwdne5495:0" "customJsx": "crwdns5495:0crwdne5495:0"
}, },
"method": {
"GET": "crwdns5497:0crwdne5497:0",
"POST": "crwdns5499:0crwdne5499:0",
"PUT": "crwdns5501:0crwdne5501:0",
"DELETE": "crwdns5503:0crwdne5503:0",
"PATCH": "crwdns5505:0crwdne5505:0"
},
"authType": { "authType": {
"none": "crwdns5507:0crwdne5507:0", "none": "crwdns5507:0crwdne5507:0",
"bearer": "crwdns5509:0crwdne5509:0", "bearer": "crwdns5509:0crwdne5509:0",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Eine Schaltfläche welche eine Anfrage auslöst wenn sie angeklickt wird", "actionButton": "Eine Schaltfläche welche eine Anfrage auslöst wenn sie angeklickt wird",
"customJsx": "Benutzerdefiniertes JSX-Layout mit Whitelist Mantine Komponenten und vollständiger API-Datenbindung" "customJsx": "Benutzerdefiniertes JSX-Layout mit Whitelist Mantine Komponenten und vollständiger API-Datenbindung"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "Keine", "none": "Keine",
"bearer": "Bearer Token", "bearer": "Bearer Token",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "A button that triggers a request when clicked", "actionButton": "A button that triggers a request when clicked",
"customJsx": "Custom JSX layout using whitelisted Mantine components with full API data binding" "customJsx": "Custom JSX layout using whitelisted Mantine components with full API data binding"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "None", "none": "None",
"bearer": "Bearer Token", "bearer": "Bearer Token",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "A button that triggers a request when clicked", "actionButton": "A button that triggers a request when clicked",
"customJsx": "Custom JSX layout using whitelisted Mantine components with full API data binding" "customJsx": "Custom JSX layout using whitelisted Mantine components with full API data binding"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "None", "none": "None",
"bearer": "Bearer Token", "bearer": "Bearer Token",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Painike, joka laukaisee pyynnön napsautettaessa", "actionButton": "Painike, joka laukaisee pyynnön napsautettaessa",
"customJsx": "Mukautettu JSX-asettelu käyttäen sallittuja Mantine-komponentteja täydellä API-tietojen sidonnalla" "customJsx": "Mukautettu JSX-asettelu käyttäen sallittuja Mantine-komponentteja täydellä API-tietojen sidonnalla"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "Ei mitään", "none": "Ei mitään",
"bearer": "Bearer-tunniste", "bearer": "Bearer-tunniste",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Un bouton qui déclenche une requête lorsqu'elle est cliquée", "actionButton": "Un bouton qui déclenche une requête lorsqu'elle est cliquée",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "Aucun", "none": "Aucun",
"bearer": "Jeton Bearer", "bearer": "Jeton Bearer",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Egy gomb, ami kérés végrehajtását váltja ki kattintásra", "actionButton": "Egy gomb, ami kérés végrehajtását váltja ki kattintásra",
"customJsx": "Egyéni JSX elrendezés engedélyezett Mantine komponensekkel és teljes API adatkötéssel" "customJsx": "Egyéni JSX elrendezés engedélyezett Mantine komponensekkel és teljes API adatkötéssel"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "Nincs", "none": "Nincs",
"bearer": "Bearer token", "bearer": "Bearer token",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Un pulsante che attiva una richiesta al clic", "actionButton": "Un pulsante che attiva una richiesta al clic",
"customJsx": "Layout JSX personalizzato che usa componenti Mantine consentiti con binding completo dei dati API" "customJsx": "Layout JSX personalizzato che usa componenti Mantine consentiti con binding completo dei dati API"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "Nessuno", "none": "Nessuno",
"bearer": "Token Bearer", "bearer": "Token Bearer",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "클릭 시 요청을 트리거하는 버튼", "actionButton": "클릭 시 요청을 트리거하는 버튼",
"customJsx": "전체 API 데이터 바인딩과 함께 허용된 Mantine 구성 요소를 사용하는 사용자 정의 JSX 레이아웃" "customJsx": "전체 API 데이터 바인딩과 함께 허용된 Mantine 구성 요소를 사용하는 사용자 정의 JSX 레이아웃"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "없음", "none": "없음",
"bearer": "Bearer 토큰", "bearer": "Bearer 토큰",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
+36 -43
View File
@@ -824,13 +824,6 @@
"actionButton": "Przycisk, który wywołuje zapytanie po kliknięciu", "actionButton": "Przycisk, który wywołuje zapytanie po kliknięciu",
"customJsx": "Własny układ JSX za pomocą komponentów Mantine z białej listy z pełnym powiązaniem danych API" "customJsx": "Własny układ JSX za pomocą komponentów Mantine z białej listy z pełnym powiązaniem danych API"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "None", "none": "None",
"bearer": "Bearer Token", "bearer": "Bearer Token",
@@ -2430,19 +2423,19 @@
"label": "Odwróć sortowanie" "label": "Odwróć sortowanie"
}, },
"columnOrder": { "columnOrder": {
"label": "" "label": "Kolejność kolumn"
}, },
"columnWidths": { "columnWidths": {
"label": "" "label": "Szerokości kolumn"
} }
}, },
"error": { "error": {
"internalServerError": "Nie udało się pobrać statystyk kontenerów", "internalServerError": "Nie udało się pobrać statystyk kontenerów",
"layoutSaveTitle": "", "layoutSaveTitle": "Nie zapisano układu tabeli",
"layoutSaveMessage": "" "layoutSaveMessage": "Nie można zapisać układu tabeli Dockera. Spróbuj ponownie przesunąć lub zmienić rozmiar kolumny."
}, },
"empty": { "empty": {
"noContainers": "" "noContainers": "Nie znaleziono kontenerów"
} }
}, },
"coolify": { "coolify": {
@@ -2738,17 +2731,17 @@
"description": "Wyłączenie tej opcji nie zadziała w przypadku Plex" "description": "Wyłączenie tej opcji nie zadziała w przypadku Plex"
}, },
"showBitrate": { "showBitrate": {
"label": "", "label": "Pokaż bitrate",
"description": "" "description": "Pokaż bieżącą przepływność odtwarzania obok lokalizacji"
}, },
"showLocation": { "showLocation": {
"label": "", "label": "Pokaż lokalizację",
"description": "" "description": "Pokaż, czy strumień jest w sieci LAN, czy WAN"
} }
}, },
"footer": { "footer": {
"streams": "", "streams": "{count, plural, one {# aktywny strumień} few {# aktywne strumienie} many {# aktywnych strumieni} other {# aktywnych strumieni}}",
"totalBitrate": "" "totalBitrate": "Łącznie: {bitrate}"
}, },
"items": { "items": {
"currentlyPlaying": "Obecnie odtwarzane", "currentlyPlaying": "Obecnie odtwarzane",
@@ -2757,9 +2750,9 @@
"id": "ID", "id": "ID",
"status": "Status", "status": "Status",
"directPlay": "Odtwarzanie bezpośrednie", "directPlay": "Odtwarzanie bezpośrednie",
"directStream": "", "directStream": "Bezpośredni strumień",
"transcodeVideo": "", "transcodeVideo": "Transkodowanie wideo",
"transcodeAudio": "", "transcodeAudio": "Transkodowanie audio",
"transcoding": "Transkodowanie", "transcoding": "Transkodowanie",
"paused": "Zatrzymane", "paused": "Zatrzymane",
"remaining": "{minutes} min pozostało", "remaining": "{minutes} min pozostało",
@@ -3107,18 +3100,18 @@
"description": "To ograniczy liczbę wyświetlanych elementów dla każdej integracji, a nie globalnie." "description": "To ograniczy liczbę wyświetlanych elementów dla każdej integracji, a nie globalnie."
}, },
"columnOrder": { "columnOrder": {
"label": "" "label": "Kolejność kolumn"
}, },
"columnWidths": { "columnWidths": {
"label": "" "label": "Szerokości kolumn"
} }
}, },
"errors": { "errors": {
"noColumns": "Wybierz kolumny w elementach", "noColumns": "Wybierz kolumny w elementach",
"noCommunications": "Nie można załadować danych z integracji", "noCommunications": "Nie można załadować danych z integracji",
"noItems": "", "noItems": "Nie znaleziono pobrań",
"actionFailed": "", "actionFailed": "Akcja nie powiodła się",
"actionFailedMessage": "" "actionFailedMessage": "Nie można ukończyć działania. Spróbuj ponownie."
}, },
"items": { "items": {
"actions": { "actions": {
@@ -3142,7 +3135,7 @@
}, },
"id": { "id": {
"columnTitle": "ID", "columnTitle": "ID",
"detailsTitle": "" "detailsTitle": "Identyfikator elementu"
}, },
"integration": { "integration": {
"columnTitle": "Integracja" "columnTitle": "Integracja"
@@ -3177,7 +3170,7 @@
"time": { "time": {
"columnTitle": "Czas zakończenia", "columnTitle": "Czas zakończenia",
"detailsTitle": "Czas od/do zakończenia", "detailsTitle": "Czas od/do zakończenia",
"eta": "" "eta": "Przewidywany czas"
}, },
"type": { "type": {
"columnTitle": "Typ", "columnTitle": "Typ",
@@ -3223,21 +3216,21 @@
}, },
"globalRatio": "Wskaźnik globalny", "globalRatio": "Wskaźnik globalny",
"contextMenu": { "contextMenu": {
"copyName": "", "copyName": "Kopiuj nazwę",
"copyId": "", "copyId": "Kopiuj ID",
"clearFilters": "" "clearFilters": "Wyczyść filtry"
}, },
"footer": { "footer": {
"filter": "" "filter": "Filtruj pobierania"
}, },
"stats": { "stats": {
"show": "", "show": "Pokaż globalne statystyki",
"hide": "", "hide": "Ukryj globalne statystyki",
"overallProgress": "", "overallProgress": "Ogólny postęp kolejki",
"totalSize": "", "totalSize": "Całkowity rozmiar kolejki",
"clients": "" "clients": "{count, plural, one {# klient} few {# klientów} many {# klientów} other {# klientów}}"
}, },
"disconnected": "" "disconnected": "(rozłączono)"
}, },
"mediaReleases": { "mediaReleases": {
"name": "Wydania mediów", "name": "Wydania mediów",
@@ -3968,17 +3961,17 @@
"label": "Pokaż wersję agenta" "label": "Pokaż wersję agenta"
}, },
"columnOrder": { "columnOrder": {
"label": "" "label": "Kolejność kolumn"
}, },
"columnWidths": { "columnWidths": {
"label": "" "label": "Szerokości kolumn"
} }
}, },
"noRecords": "Nie znaleziono systemów", "noRecords": "Nie znaleziono systemów",
"error": { "error": {
"internalServerError": "Nie można połączyć się z Beszel. Sprawdź ustawienia integracji.", "internalServerError": "Nie można połączyć się z Beszel. Sprawdź ustawienia integracji.",
"layoutSaveTitle": "", "layoutSaveTitle": "Nie można zapisać układu tabeli",
"layoutSaveMessage": "" "layoutSaveMessage": "Nie można zapisać kolejności kolumn ani ich szerokości. Spróbuj ponownie."
}, },
"column": { "column": {
"system": "System", "system": "System",
@@ -5376,7 +5369,7 @@
}, },
"remove": { "remove": {
"label": "Usuń", "label": "Usuń",
"confirm": "", "confirm": "Kliknij ponownie, aby trwale usunąć",
"notification": { "notification": {
"success": { "success": {
"title": "Usunięto kontenery", "title": "Usunięto kontenery",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Um botão que aciona uma solicitação quando clicado", "actionButton": "Um botão que aciona uma solicitação quando clicado",
"customJsx": "Layout JSX personalizado usando componentes Mantine na lista branca com ligação completa de dados de API" "customJsx": "Layout JSX personalizado usando componentes Mantine na lista branca com ligação completa de dados de API"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "Nenhum", "none": "Nenhum",
"bearer": "Token Bearer", "bearer": "Token Bearer",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Tlačidlo, ktoré po kliknutí spustí požiadavku", "actionButton": "Tlačidlo, ktoré po kliknutí spustí požiadavku",
"customJsx": "Vlastné rozloženie JSX pomocou whitelistovaných komponentov Mantine s plnou väzbou API dát" "customJsx": "Vlastné rozloženie JSX pomocou whitelistovaných komponentov Mantine s plnou väzbou API dát"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "Žiadna", "none": "Žiadna",
"bearer": "Bearer token", "bearer": "Bearer token",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Tıklandığında istek başlatan bir düğme", "actionButton": "Tıklandığında istek başlatan bir düğme",
"customJsx": "Tam API veri bağlamasıyla izin verilen Mantine bileşenlerini kullanan özel JSX düzeni" "customJsx": "Tam API veri bağlamasıyla izin verilen Mantine bileşenlerini kullanan özel JSX düzeni"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "Yok", "none": "Yok",
"bearer": "Bearer Token", "bearer": "Bearer Token",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "Кнопка яка виконує запит при натисканні", "actionButton": "Кнопка яка виконує запит при натисканні",
"customJsx": "Користувацький макет JSX з пов'язування повним API даних з білого списку" "customJsx": "Користувацький макет JSX з пов'язування повним API даних з білого списку"
}, },
"method": {
"GET": "ОТРИМАТИ",
"POST": "СТВОРИТИ",
"PUT": "Розміщення",
"DELETE": "ВИДАЛИТИ",
"PATCH": "ПАТЧ"
},
"authType": { "authType": {
"none": "Немає", "none": "Немає",
"bearer": "Пред'явити токен", "bearer": "Пред'явити токен",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "", "actionButton": "",
"customJsx": "" "customJsx": ""
}, },
"method": {
"GET": "",
"POST": "",
"PUT": "",
"DELETE": "",
"PATCH": ""
},
"authType": { "authType": {
"none": "", "none": "",
"bearer": "", "bearer": "",
-7
View File
@@ -824,13 +824,6 @@
"actionButton": "點擊時觸發請求的按鈕", "actionButton": "點擊時觸發請求的按鈕",
"customJsx": "使用白名單 Mantine 組件的自訂 JSX 佈局,具有完整的 API 資料綁定" "customJsx": "使用白名單 Mantine 組件的自訂 JSX 佈局,具有完整的 API 資料綁定"
}, },
"method": {
"GET": "GET",
"POST": "POST",
"PUT": "PUT",
"DELETE": "DELETE",
"PATCH": "PATCH"
},
"authType": { "authType": {
"none": "無", "none": "無",
"bearer": "Bearer 令牌", "bearer": "Bearer 令牌",
+10 -1
View File
@@ -24,8 +24,17 @@ export AUTH_SECRET=$(openssl rand -base64 32)
# 1. Replace the HOSTNAME in the nginx template file # 1. Replace the HOSTNAME in the nginx template file
# 2. Create the nginx configuration file from the template # 2. Create the nginx configuration file from the template
# 3. Start the nginx server # 3. Start the nginx server
# Only listen on IPv6 when the host actually has IPv6 configured (#4596).
# Otherwise nginx aborts with "socket() [::]:7575 failed (97: Address family
# not supported by protocol)". Check HOMARR_DISABLE_IPV6 first so users can
# force IPv4-only even when the host supports IPv6, then probe for IPv6
# addresses via grep (not -s: proc files always report size 0).
export HOSTNAME export HOSTNAME
envsubst '${HOSTNAME}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf export NGINX_LISTEN_IPV6=''
if [ "${HOMARR_DISABLE_IPV6:-false}" != "true" ] && grep -q . /proc/net/if_inet6 2>/dev/null; then
NGINX_LISTEN_IPV6='listen [::]:7575;'
fi
envsubst '${HOSTNAME} ${NGINX_LISTEN_IPV6}' < /etc/nginx/templates/nginx.conf > /etc/nginx/nginx.conf
# Start services in the background and store their PIDs # Start services in the background and store their PIDs
nginx -g 'daemon off;' & nginx -g 'daemon off;' &
NGINX_PID=$! NGINX_PID=$!