Pass at first endpoints

This commit is contained in:
Owen
2026-03-24 18:17:33 -07:00
parent 7b78b91449
commit b2eab95a3b
4 changed files with 373 additions and 0 deletions

View File

@@ -102,6 +102,13 @@ authenticated.put(
logActionAudit(ActionsEnum.createSite),
site.createSite
);
authenticated.put(
"/org/:orgId/newt/provisioning-key",
verifyOrgAccess,
verifyUserHasAction(ActionsEnum.createSite),
newt.createNewtProvisioningKey
);
authenticated.get(
"/org/:orgId/sites",
verifyOrgAccess,
@@ -1202,6 +1209,22 @@ authRouter.post(
}),
newt.getNewtToken
);
authRouter.post(
"/newt/register",
rateLimit({
windowMs: 15 * 60 * 1000,
max: 30,
keyGenerator: (req) =>
`newtRegister:${req.body.provisioningKey?.split(".")[0] || ipKeyGenerator(req.ip || "")}`,
handler: (req, res, next) => {
const message = `You can only register a newt ${30} times every ${15} minutes. Please try again later.`;
return next(createHttpError(HttpCode.TOO_MANY_REQUESTS, message));
},
store: createStore()
}),
newt.registerNewt
);
authRouter.post(
"/olm/get-token",
rateLimit({