You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
586 B

11 months ago
  1. /**
  2. * A simple middleware that validates that the chat history is viewable.
  3. * via the `DISABLE_VIEW_CHAT_HISTORY` environment variable being set AT ALL.
  4. * @param {Request} request - The request object.
  5. * @param {Response} response - The response object.
  6. * @param {NextFunction} next - The next function.
  7. */
  8. function chatHistoryViewable(_request, response, next) {
  9. if ("DISABLE_VIEW_CHAT_HISTORY" in process.env)
  10. return response
  11. .status(422)
  12. .send("This feature has been disabled by the administrator.");
  13. next();
  14. }
  15. module.exports = {
  16. chatHistoryViewable,
  17. };