mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-09-10 08:31:37 +00:00
* feat: add principal-owned code environments * fix: address code environment CI coverage * fix: expose principal code environments in endpoint config * fix: reject missing code environment bodies * fix: harden code environment lifecycle * fix: revalidate principal code environments * fix: synchronize code environment authorization * fix: bind code environments to current principals * fix: fail closed on code ACL cache errors * fix: prevent code environment override shadowing * fix: preserve principal environment defaults * fix: suppress revoked code environment aliases * fix: fail closed on environment augmentation * fix: narrow code environment defaults * fix: isolate code environment fallback * style: sort code config imports
27 lines
996 B
JavaScript
27 lines
996 B
JavaScript
const express = require('express');
|
|
const { createCodeEnvironmentHttpHandlers } = require('@librechat/api');
|
|
const { SystemCapabilities } = require('@librechat/data-schemas');
|
|
const { requireCapability } = require('~/server/middleware/roles/capabilities');
|
|
const { getAppConfig, getCodeEnvironmentRegistry } = require('~/server/services/Config');
|
|
const { requireJwtAuth } = require('~/server/middleware');
|
|
|
|
const router = express.Router();
|
|
let handlers;
|
|
function getHandlers() {
|
|
if (handlers == null) {
|
|
handlers = createCodeEnvironmentHttpHandlers({
|
|
getAppConfig,
|
|
registry: getCodeEnvironmentRegistry(),
|
|
});
|
|
}
|
|
return handlers;
|
|
}
|
|
const requireCodeEnvironmentManage = requireCapability(SystemCapabilities.MANAGE_CODE_ENVIRONMENTS);
|
|
|
|
router.use(requireJwtAuth);
|
|
router.get('/', (req, res, next) => getHandlers().list(req, res, next));
|
|
router.post('/', requireCodeEnvironmentManage, (req, res, next) =>
|
|
getHandlers().register(req, res, next),
|
|
);
|
|
|
|
module.exports = router;
|