The communications platform that puts data protection first.
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.
 
 
 
 
 
Rocket.Chat/apps/meteor/app/api/server/lib/getServerInfo.ts

23 lines
566 B

import { Info } from '../../../utils/server';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
type ServerInfo =
| {
info: typeof Info;
}
| {
version: string | undefined;
};
const removePatchInfo = (version: string): string => version.replace(/(\d+\.\d+).*/, '$1');
export async function getServerInfo(userId?: string): Promise<ServerInfo> {
if (userId && (await hasPermissionAsync(userId, 'get-server-info'))) {
return {
info: Info,
};
}
return {
version: removePatchInfo(Info.version),
};
}