Files
chat/api/server/middleware/validateRegistration.js
zooqueen 48eac75e13 refactor: fork @librechat/api workspace package to @hanzochat/api
Forks the internal @librechat/api workspace package (packages/api) to
@hanzochat/api, matching the app package @hanzochat/chat. De-LibreChats
the package name and puts its build under our control.

Fixes the live prod bug where the deployed chat image shipped a stale
@librechat/api/dist missing the exported handleError(), breaking every
error path with "handleError is not a function" and killing the SSE
stream. A clean build of @hanzochat/api produces dist/index.js that
exports handleError (verified: exports.handleError = handleError).

- packages/api/package.json: name @librechat/api -> @hanzochat/api
- 254 source/config/doc/lockfile sites: @librechat/api -> @hanzochat/api
  (api/, packages/, config/, turbo.json, pnpm-lock.yaml, bun.lock,
   package-lock.json, LLM.md)
- @librechat/api-client (distinct MCP client id string) left untouched
- other @librechat/* packages (client, data-schemas, data-provider)
  left as-is per scope

pnpm install (regenerated lockfile) + build:api green; dist exports
handleError. api/data-schemas/client packages build; full build:packages
and api test:ci are blocked by a PRE-EXISTING, unrelated upstream break
in librechat-data-provider (config.spec.ts / cloudfront-config.spec.ts
reference exports that src/config.ts no longer has) -- out of scope here.
2026-06-19 22:00:19 -07:00

18 lines
351 B
JavaScript

const { isEnabled } = require('@hanzochat/api');
function validateRegistration(req, res, next) {
if (req.invite) {
return next();
}
if (isEnabled(process.env.ALLOW_REGISTRATION)) {
next();
} else {
return res.status(403).json({
message: 'Registration is not allowed.',
});
}
}
module.exports = validateRegistration;