fix: address review findings in the v2 stack fix PR

Board scaling: no sideways scrolling
- Revert the pannable narrow canvas. The canvas fits the viewport again and
  `.viewport` goes back to `overflow: clip`, so a board can never widen the
  document or scroll horizontally.
- Fix the unreadable-narrow-board regression at the real cause instead: cap the
  inverse UI compensation at 2x (50% canvas scale). Down to 50% text and
  controls keep their physical size; below it the board zooms out as a whole, so
  a 200x200 logical tile hosts at most 28px logical text rather than 96px and
  content stops overlapping its neighbours.

Touch editing
- Add `touch-action: none` to `.board-grid-entry`, the dnd-kit draggable and its
  own drag handle. The 200ms touch activation delay is useless if the browser
  has already handed the gesture to page panning and emitted `pointercancel`.
  Only edit mode renders this element.

Custom widgets
- Memoize the merged `data`/`status`/`options` passed to `CustomJsxRenderer`.
  They were rebuilt every render, so the compiled-template memo never hit and
  the new reference-identity boundary key changed on every render, resetting the
  error boundary and forcing an extra reconciliation of the widget subtree.
- Keep the cache key when the shared Redis cache is unavailable so the
  process-local cache still absorbs polling instead of sending every widget
  refresh upstream.
- Reclaim the shared cache's LRU/size/byte bookkeeping for TTL-expired entries
  and touch the LRU in the same script, so expired ghosts stop consuming the
  64 MiB budget and a read costs one round trip instead of two.

Forwarded IP
- Restore `ipAddressFromHeaders` to the full forwarding chain and add
  `trustedIpAddressFromHeaders` for the last hop. Repointing the shared helper
  had collapsed MCP failed-auth rate limiting into a single bucket for every
  client behind a reverse proxy and replaced the client IP with the proxy IP in
  API-key auth logs.

Runtime and restore
- Make the new /appdata ownership migration best-effort. Under `set -e` a mount
  that rejects chown (CIFS/SMB, fixed-uid NFS) turned into a container that
  refuses to start, and /appdata was never chowned before.
- Report malformed metadata.json as such instead of blaming the archive.
This commit is contained in:
ajnart committed 2026-08-21 01:40:46 +02:00
1 parent 496fa60b5f
commit 1b544f599c
10 files changed
+153 -69

No files matched your search

+19 -3
View File
@@ -10,12 +10,28 @@ export const userAgent = (headers: Headers) => {
export type DeviceType = "console" | "mobile" | "tablet" | "smarttv" | "wearable" | "embedded" | undefined;
/**
* The client-reported forwarding chain, verbatim. Behind an additional reverse
* proxy this still contains the originating client, so it is the useful value
* for audit logging and diagnostics. A caller can put anything in front of the
* chain, so never key a limit or quota on it.
*/
export const ipAddressFromHeaders = (headers: Headers): string | null => {
return headers.get("x-forwarded-for");
};
/**
* The last hop of the forwarding chain. The bundled nginx proxy appends its own
* transport peer, so this is the only entry a caller cannot choose, which makes
* it the right identity for rate limits and concurrency budgets.
*
* Behind an additional reverse proxy the last hop is that proxy, so every client
* behind it shares one identity. Distinguishing them needs an explicit
* trusted-proxy configuration, which Homarr does not have yet.
*/
export const trustedIpAddressFromHeaders = (headers: Headers): string | null => {
const forwardedFor = headers.get("x-forwarded-for");
if (!forwardedFor) return null;
// The bundled nginx proxy appends the transport peer to this chain. Using
// the last hop prevents a caller-controlled prefix from creating arbitrary
// rate-limit identities.
return forwardedFor.split(",").at(-1)?.trim() || null;
};