Add jsdocs

This commit is contained in:
Alan Grainger
2026-06-04 10:25:00 +12:00
parent d7e4079c4d
commit 86ecf08a1a
2 changed files with 22 additions and 0 deletions
+7
View File
@@ -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
+15
View File
@@ -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) {