IAPL rename, scripted: preferred names in src, bin, scripts, services, tests; bin files and skill folders moved
Replaced by an explicit list of forms only (ten exported names, runtime env names, project file names and marks, commands, skill names, the log prefix, the brand in prose). Package name, import paths, routes, CSS tokens, data attributes, custom keys, context flags, the cookie and kv keys are not touched. package.json keeps the five old bin names beside the five new ones. The old names stop working in this commit and come back as aliases in the next; docs follow. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
414a4702df
commit
0a4f001797
@@ -21,7 +21,7 @@ export function pluginVersion(): string {
|
||||
type CollectionLike = { fields?: Array<{ name?: string }>; slug: string }
|
||||
|
||||
/**
|
||||
* Read-only counts for ipal-doctor's deep rules: users without TOTP, cookies waiting for approval,
|
||||
* Read-only counts for iapl-doctor's deep rules: users without TOTP, cookies waiting for approval,
|
||||
* the versions. Counts and booleans only — never names, e-mails or values.
|
||||
*/
|
||||
export async function collectDoctorStatus(payload: BasePayload): Promise<DoctorStatus> {
|
||||
@@ -82,7 +82,7 @@ export async function collectDoctorStatus(payload: BasePayload): Promise<DoctorS
|
||||
export type DoctorEndpointOptions = {
|
||||
/** Who may read the status besides a valid token, e.g. `({ req }) => isAdmin(req.user, req.payload)` (a staff admin; the second factor is checked for you). */
|
||||
access?: (args: { req: PayloadRequest }) => boolean | Promise<boolean>
|
||||
/** Env variable that holds the token (≥ 32 characters). Default IPAL_DOCTOR_TOKEN. */
|
||||
/** Env variable that holds the token (≥ 32 characters). Default IAPL_DOCTOR_TOKEN. */
|
||||
tokenVar?: string
|
||||
}
|
||||
|
||||
@@ -93,17 +93,17 @@ const sameToken = (given: string, expected: string) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/ipal/doctor — the deep status for `ipal-doctor --url`. Off (404) until the token variable
|
||||
* GET /api/ipal/doctor — the deep status for `iapl-doctor --url`. Off (404) until the token variable
|
||||
* holds at least 32 characters; then `Authorization: Bearer <token>` (or `access`) is required.
|
||||
* Rate-limited per client IP. `ipalKit({ doctor: false })` removes the endpoint.
|
||||
* Rate-limited per client IP. `iapl({ doctor: false })` removes the endpoint.
|
||||
*/
|
||||
export function buildDoctorEndpoint(options: DoctorEndpointOptions = {}): Endpoint {
|
||||
const tokenVar = options.tokenVar ?? 'IPAL_DOCTOR_TOKEN'
|
||||
const tokenVar = options.tokenVar ?? 'IAPL_DOCTOR_TOKEN'
|
||||
return {
|
||||
handler: async (req: PayloadRequest) => {
|
||||
const token = process.env[tokenVar]?.trim() ?? ''
|
||||
if (token.length < 32) {return Response.json({ error: 'Not found' }, { status: 404 })}
|
||||
const limit = await consumeRateLimit({ key: clientIp(req.headers), max: 10, scope: 'ipal-doctor', windowMs: 60_000 })
|
||||
const limit = await consumeRateLimit({ key: clientIp(req.headers), max: 10, scope: 'iapl-doctor', windowMs: 60_000 })
|
||||
if (!limit.ok) {return tooManyRequests(limit.retryAfter, { error: 'Too many requests' })}
|
||||
const given = (req.headers.get('authorization') ?? '').replace(/^Bearer\s+/i, '').trim()
|
||||
const allowed = (given && sameToken(given, token)) || (options.access ? secondFactorPassed(req) && (await options.access({ req })) : false)
|
||||
|
||||
Reference in New Issue
Block a user