diff --git a/packages/nocodb/src/lib/meta/api/utilApis.ts b/packages/nocodb/src/lib/meta/api/utilApis.ts index cdd9f0a321..16cee5adcb 100644 --- a/packages/nocodb/src/lib/meta/api/utilApis.ts +++ b/packages/nocodb/src/lib/meta/api/utilApis.ts @@ -1,5 +1,6 @@ // // Project CRUD import { Request, Response } from 'express'; +import { compareVersions, validate } from 'compare-versions'; import { ViewTypes } from 'nocodb-sdk'; import Project from '../../models/Project'; @@ -65,17 +66,22 @@ export async function versionInfo(_req: Request, res: Response) { (versionCache.lastFetched && versionCache.lastFetched < Date.now() - 1000 * 60 * 60) ) { - versionCache.releaseVersion = await axios - .get('https://github.com/nocodb/nocodb/releases/latest', { + const nonBetaTags = await axios + .get('https://api.github.com/repos/nocodb/nocodb/tags', { timeout: 5000, }) - .then((response) => - response.request.res.responseUrl.replace( - 'https://github.com/nocodb/nocodb/releases/tag/', - '' - ) - ) + .then((response) => { + return response.data + .map((x) => x.name) + .filter( + (v) => validate(v) && !v.includes('finn') && !v.includes('beta') + ) + .sort((x, y) => compareVersions(y, x)); + }) .catch(() => null); + if (nonBetaTags && nonBetaTags.length > 0) { + versionCache.releaseVersion = nonBetaTags[0]; + } versionCache.lastFetched = Date.now(); }