Add jsdocs
This commit is contained in:
@@ -12,6 +12,13 @@ import {
|
|||||||
import { computeLayout } from './layout.js'
|
import { computeLayout } from './layout.js'
|
||||||
import { createTile } from './tiles.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 () {
|
function getVisibleRange () {
|
||||||
if (!state.container) return { top: 0, bottom: 0 }
|
if (!state.container) return { top: 0, bottom: 0 }
|
||||||
const containerTop = state.container.getBoundingClientRect().top
|
const containerTop = state.container.getBoundingClientRect().top
|
||||||
|
|||||||
@@ -8,6 +8,21 @@ import { Response } from 'express-serve-static-core'
|
|||||||
import { getConfigOption } from './config/access'
|
import { getConfigOption } from './config/access'
|
||||||
import { log } from './utils/log'
|
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 = '') {
|
export function respondToInvalidRequest (res: Response, defaultResponse: number | string | null, logMessage = '') {
|
||||||
let method = getConfigOption('ipp.customInvalidResponse', false)
|
let method = getConfigOption('ipp.customInvalidResponse', false)
|
||||||
if (method === false) {
|
if (method === false) {
|
||||||
|
|||||||
Reference in New Issue
Block a user