Skip to content

Commit

Permalink
get back in check only minor version
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanfbrito committed Oct 20, 2023
1 parent 87149d5 commit 63b5a0a
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/servers/supportedVersions/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import path from 'path';
import { app } from 'electron';
import jwt from 'jsonwebtoken';
import moment from 'moment';
import { coerce, ltr } from 'semver';
import { coerce, satisfies } from 'semver';

import { getLanguage } from '../../i18n/main';
import { dispatch, listen, select } from '../../store';
Expand Down Expand Up @@ -245,9 +245,13 @@ export const isServerVersionSupported = async (

const appLanguage = (await getLanguage()) ?? 'en';

const supportedVersion = versions.find(
({ version }) =>
coerce(version)?.version === coerce(server.version)?.version
const serverVersionTilde = `~${serverVersion
.split('.')
.slice(0, 2)
.join('.')}`;

const supportedVersion = versions.find(({ version }) =>
satisfies(coerce(version)?.version ?? '', serverVersionTilde)
);

if (supportedVersion) {
Expand Down Expand Up @@ -280,9 +284,8 @@ export const isServerVersionSupported = async (
}
}

const exception = exceptions?.versions?.find(
({ version }) =>
coerce(version)?.version === coerce(server.version)?.version
const exception = exceptions?.versions?.find(({ version }) =>
satisfies(coerce(version)?.version ?? '', serverVersionTilde)
);

if (exception) {
Expand Down

0 comments on commit 63b5a0a

Please sign in to comment.