Opt-outs for the secure defaults; isPathVisibleIn in construction/logic

- setUnknownIpFactor (0 = old free pass), UNKNOWN_IP_FACTOR exported
- createContentHelpers({ settingsDepth }) and markdown/mcp isPathVisible overrides
- <RenderRichText safeLinks={false}>
- resolveRedirect({ draft: true }) for preview
- isPathVisibleIn(mode, path), pathOf, PathVisibility exported; page route uses it

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 17:35:08 +02:00
co-authored by Claude Opus 5.5
parent 4585e0fc69
commit 0fd57c1d6a
13 changed files with 144 additions and 24 deletions
+11
View File
@@ -1,3 +1,5 @@
import type { ConstructionMode } from './types.js'
import { CONSTRUCTION_NOTICE_PARAM, CONSTRUCTION_NOTICE_VALUE } from './types.js'
/** `/pl/` → `/pl`, `` → `/` — paths compare without a trailing slash. */
@@ -15,3 +17,12 @@ export function isPathAllowed(pathname: string, allowedPaths: readonly string[])
/** Where a blocked address goes: the homepage with the notice parameter. */
export const constructionNoticeHref = (homePath: string): string =>
`${homePath}?${CONSTRUCTION_NOTICE_PARAM}=${CONSTRUCTION_NOTICE_VALUE}`
/**
* Is this public page path served under this construction mode? True when the
* mode is off or the path is allowed. One rule for the page route, Markdown,
* MCP, search, the sitemap and llms.txt — feed it getConstructionMode(locale).
*/
export function isPathVisibleIn(mode: Pick<ConstructionMode, 'allowedPaths' | 'enabled'>, pathname: string): boolean {
return !mode.enabled || isPathAllowed(pathname, mode.allowedPaths)
}