From 86ecf08a1a90e253c2f8435e785304f6e72cf430 Mon Sep 17 00:00:00 2001 From: Alan Grainger Date: Thu, 4 Jun 2026 10:25:00 +1200 Subject: [PATCH] Add jsdocs --- app/src/client/virtualization.ts | 7 +++++++ app/src/invalidRequestHandler.ts | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/app/src/client/virtualization.ts b/app/src/client/virtualization.ts index 00a6a61..6b2698d 100644 --- a/app/src/client/virtualization.ts +++ b/app/src/client/virtualization.ts @@ -12,6 +12,13 @@ import { import { computeLayout } from './layout.js' import { createTile } from './tiles.js' +/** + * Translate the current window viewport into container-relative coordinates + * (so layout entries' absolute `top` values can be compared directly) and + * extend by `BUFFER_VIEWPORTS` worth of viewport height in each direction. + * The buffer is what lets tiles fade in just before they scroll into view + * instead of popping in at the edge. + */ function getVisibleRange () { if (!state.container) return { top: 0, bottom: 0 } const containerTop = state.container.getBoundingClientRect().top diff --git a/app/src/invalidRequestHandler.ts b/app/src/invalidRequestHandler.ts index 26c89fb..577bd9a 100644 --- a/app/src/invalidRequestHandler.ts +++ b/app/src/invalidRequestHandler.ts @@ -8,6 +8,21 @@ import { Response } from 'express-serve-static-core' import { getConfigOption } from './config/access' import { log } from './utils/log' +/** + * Respond to any request that IPP would otherwise serve content for but cannot + * (bad share key, password failure, unknown asset, etc.). Behavior is driven + * by `ipp.customInvalidResponse` config; if unset, falls back to + * `defaultResponse` (typically 404). + * + * Accepted values for the configured response (and `defaultResponse`): + * - `number` - HTTP status code to send with an empty body. + * - `null` - drop the TCP connection without sending anything. + * - `string` starting with `http` - 302 redirect to that URL. + * - anything else - send an empty 404 (the ultimate fallback). + * + * Operators can replace this file entirely via a Docker volume mount to + * customise the behavior; the function signature is the public contract. + */ export function respondToInvalidRequest (res: Response, defaultResponse: number | string | null, logMessage = '') { let method = getConfigOption('ipp.customInvalidResponse', false) if (method === false) {