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
+7 -1
View File
@@ -25,6 +25,11 @@ type ResolveRedirectArgs = {
*/
collections?: RedirectCollection[]
config: I18nConfig
/**
* Preview (draftMode): also redirect from a never-published draft's old
* slug. Default false — public redirects never reveal a draft's new slug.
*/
draft?: boolean
/** Home slug map/string, so a renamed homepage still collapses to the root. */
homeSlug?: Record<string, string> | string
/** Active locale (the request's locale). */
@@ -66,6 +71,7 @@ type DocShape = { _status?: unknown; slug?: unknown }
export async function resolveRedirect({
collections = [{ slug: 'pages' }],
config,
draft = false,
homeSlug,
locale,
payload,
@@ -93,7 +99,7 @@ export async function resolveRedirect({
// A never-published draft must not be reachable — nor its new slug
// revealed — through a redirect (same rule as resolveRoute).
const status = doc?._status
if (doc && status !== undefined && status !== null && status !== 'published') {continue}
if (!draft && doc && status !== undefined && status !== null && status !== 'published') {continue}
if (doc && typeof doc[slugField as keyof DocShape] === 'string') {
currentSlug = doc[slugField as keyof DocShape] as string
}