
const version = require('../../../lib/version');

module.exports = async function (req, res, next) {

	try {
		const v = await version();
		if (!["write", "edit"].some( op => req.user?.operations.includes(op) )) {
			delete v.os;
			delete v.db;
		}
		res.status(200).json(v);
	} catch (err) {
		next(err);
		return;
	}
	next();

};
