diff --git a/apps/meteor/app/api/server/lib/getServerInfo.ts b/apps/meteor/app/api/server/lib/getServerInfo.ts index 8b0f15ef2470..987519742f14 100644 --- a/apps/meteor/app/api/server/lib/getServerInfo.ts +++ b/apps/meteor/app/api/server/lib/getServerInfo.ts @@ -3,11 +3,13 @@ import { getCachedSupportedVersionsToken, wrapPromise, } from '../../../cloud/server/functions/supportedVersionsToken/supportedVersionsToken'; -import { Info } from '../../../utils/rocketchat.info'; +import { Info, minimumClientVersions } from '../../../utils/rocketchat.info'; type ServerInfo = | { info: typeof Info; + supportedVersions?: string; + minimumClientVersions: typeof minimumClientVersions; } | { version: string | undefined; @@ -22,10 +24,12 @@ export async function getServerInfo(userId?: string): Promise { return { info: { ...Info, - ...(supportedVersionsToken.success && { + }, + minimumClientVersions, + ...(supportedVersionsToken.success && + supportedVersionsToken.result && { supportedVersions: supportedVersionsToken.result, }), - }, }; } diff --git a/apps/meteor/app/cloud/server/functions/supportedVersionsToken/supportedVersionsToken.ts b/apps/meteor/app/cloud/server/functions/supportedVersionsToken/supportedVersionsToken.ts index e868e5ec83b7..6aae9adc9600 100644 --- a/apps/meteor/app/cloud/server/functions/supportedVersionsToken/supportedVersionsToken.ts +++ b/apps/meteor/app/cloud/server/functions/supportedVersionsToken/supportedVersionsToken.ts @@ -100,11 +100,6 @@ const getSupportedVersionsFromCloud = async () => { }; const getSupportedVersionsToken = async () => { - if (process.env.NODE_ENV === 'development') { - if (process.env.MOCK_CLOUD_SUPPORTED_VERSIONS_TOKEN) { - return JSON.parse(process.env.MOCK_CLOUD_SUPPORTED_VERSIONS_TOKEN); - } - } /** * Gets the supported versions from the license * Gets the supported versions from the cloud diff --git a/apps/meteor/client/definitions/info.d.ts b/apps/meteor/client/definitions/info.d.ts index 18d499213dcb..43fa1fc53414 100644 --- a/apps/meteor/client/definitions/info.d.ts +++ b/apps/meteor/client/definitions/info.d.ts @@ -22,9 +22,10 @@ declare module '*.info' { version: string; tag?: string; branch?: string; - minimumClientVersions: { - desktop: string; - mobile: string; - }; + }; + + export const minimumClientVersions: { + desktop: string; + mobile: string; }; } diff --git a/apps/meteor/packages/rocketchat-version/plugin/compile-version.js b/apps/meteor/packages/rocketchat-version/plugin/compile-version.js index d18bbafafdbc..20b26b9cdcf0 100644 --- a/apps/meteor/packages/rocketchat-version/plugin/compile-version.js +++ b/apps/meteor/packages/rocketchat-version/plugin/compile-version.js @@ -26,7 +26,9 @@ class VersionCompiler { }; output.marketplaceApiVersion = require('@rocket.chat/apps-engine/package.json').version.replace(/^[^0-9]/g, ''); - output.minimumClientVersions = JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }))?.rocketchat?.minimumClientVersions || {}; + const minimumClientVersions = + JSON.parse(fs.readFileSync(path.resolve(process.cwd(), './package.json'), { encoding: 'utf8' }))?.rocketchat + ?.minimumClientVersions || {}; try { const result = await execAsync("git log --pretty=format:'%H%n%ad%n%an%n%s' -n 1"); const data = result.stdout.split('\n'); @@ -58,7 +60,8 @@ class VersionCompiler { // no branch } - output = `exports.Info = ${JSON.stringify(output, null, 4)};`; + output = `exports.Info = ${JSON.stringify(output, null, 4)}; + exports.minimumClientVersions = ${JSON.stringify(minimumClientVersions, null, 4)};`; file.addJavaScript({ data: output,