Merge commit '977872b' into claude/ipal-doctor-build
# Conflicts: # src/modules/seo/buildSitemapEntries.ts
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { Config, Plugin } from 'payload'
|
||||
|
||||
import { deepMergeSimple } from 'payload/shared'
|
||||
|
||||
import type { ResolvedAdminMeta } from './modules/branding/adminMeta.js'
|
||||
import type { IpalOptions, TotpPluginFactory } from './types.js'
|
||||
|
||||
@@ -31,6 +33,7 @@ import { buildGlobalRevalidateHook } from './modules/hooks/buildRevalidateHook.j
|
||||
import { withFillLocales } from './modules/hooks/fillEmptyLocales.js'
|
||||
import { buildLocalizationConfig, validateI18nConfig } from './modules/i18n/index.js'
|
||||
import { buildSystemPagesFields } from './modules/pages/index.js'
|
||||
import { TOTP_TEXTS, TOTP_VIEW_TITLE } from './modules/security/totp/totpTexts.js'
|
||||
import { buildSeoPlugin, injectAutoFillMeta, injectSeoTabs } from './modules/seo/index.js'
|
||||
import { buildIndexNowHook } from './modules/seo/indexNow.js'
|
||||
import { searchSettingsFields } from './modules/seo/searchSettings.js'
|
||||
@@ -200,6 +203,34 @@ export const ipalKit = (options: IpalOptions): Plugin => {
|
||||
totp: { issuer: tf.issuer },
|
||||
})(config)
|
||||
|
||||
// The package's texts are long and informal: ipal-kit's (admin-ux.md) go over
|
||||
// them, the project's own i18n.translations over both. The 2FA screens get a
|
||||
// tab title instead of "Payload" (view meta is a plain string: the site's language).
|
||||
if (tf.texts !== false) {
|
||||
config.i18n = {
|
||||
...config.i18n,
|
||||
translations: deepMergeSimple(
|
||||
deepMergeSimple((config.i18n?.translations ?? {}) as Record<string, unknown>, TOTP_TEXTS),
|
||||
(incomingConfig.i18n?.translations ?? {}) as Record<string, unknown>,
|
||||
),
|
||||
}
|
||||
const title = TOTP_VIEW_TITLE[options.i18n.defaultLocale.toLowerCase().startsWith('pl') ? 'pl' : 'en']
|
||||
const views = config.admin?.components?.views ?? {}
|
||||
config.admin = {
|
||||
...config.admin,
|
||||
components: {
|
||||
...config.admin?.components,
|
||||
views: Object.fromEntries(
|
||||
Object.entries(views).map(([key, view]) =>
|
||||
/^(?:Setup|Verify)TOTP/.test(key) && view && !view.meta?.title
|
||||
? [key, { ...view, meta: { ...view.meta, title } }]
|
||||
: [key, view],
|
||||
),
|
||||
),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// The package's TOTPProvider reads the path from an `x-pathname` header
|
||||
// no proxy sets on /admin, so it redirected the setup screen to itself
|
||||
// (`setup-totp?back=null`). Swap in ipal-kit's client-side provider, or
|
||||
|
||||
Reference in New Issue
Block a user