Support Mastodon nightly version
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
b1a775c2a9
commit
174be975c8
2 changed files with 11 additions and 1 deletions
|
@ -40,6 +40,7 @@ describe('parseVersion', () => {
|
||||||
software: 'TruthSocial',
|
software: 'TruthSocial',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
compatVersion: '3.4.1',
|
compatVersion: '3.4.1',
|
||||||
|
build: 'nightly-20230627',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,6 +63,15 @@ describe('parseVersion', () => {
|
||||||
build: 'cofe',
|
build: 'cofe',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('with Mastodon nightly build', () => {
|
||||||
|
const version = '4.1.2+nightly-20230627';
|
||||||
|
expect(parseVersion(version)).toEqual({
|
||||||
|
software: 'Mastodon',
|
||||||
|
version: '4.1.2',
|
||||||
|
compatVersion: '4.1.2',
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getFeatures', () => {
|
describe('getFeatures', () => {
|
||||||
|
|
|
@ -992,7 +992,7 @@ interface Backend {
|
||||||
|
|
||||||
/** Get information about the software from its version string */
|
/** Get information about the software from its version string */
|
||||||
export const parseVersion = (version: string): Backend => {
|
export const parseVersion = (version: string): Backend => {
|
||||||
const regex = /^([\w+.]*)(?: \(compatible; ([\w]*) (.*)\))?$/;
|
const regex = /^([\w+.-]*)(?: \(compatible; ([\w]*) (.*)\))?$/;
|
||||||
const match = regex.exec(version);
|
const match = regex.exec(version);
|
||||||
|
|
||||||
const semverString = match && (match[3] || match[1]);
|
const semverString = match && (match[3] || match[1]);
|
||||||
|
|
Loading…
Reference in a new issue