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/app/api/server/lib/getServerInfo.ts

22 lines
506 B

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