Skip to content

Fix semver parsing, add "+soapbox" to instance version

Alex Gleason requested to merge semver into develop

Semver uses dots to separate parts of the version number. Pleroma uses these dots correctly, and then incorrectly strips them out at the wrong time.

For example (wrong):

2.7.2 (compatible; Pleroma 2.4.51-1267-gcfbf24d1-gleasonator+soapbox-dev)

Now becomes (correct):

2.7.2 (compatible; Pleroma 2.4.51-1267-gcfbf24d1.gleasonator+soapbox.dev)

This allows semver to correctly parse the branch and env. Before:

> semver.parse('2.4.51-1267-gcfbf24d1-gleasonator+soapbox-dev')
SemVer {
  options: {},
  loose: false,
  includePrerelease: false,
  raw: '2.4.51-1267-gcfbf24d1-gleasonator+soapbox-dev',
  major: 2,
  minor: 4,
  patch: 51,
  prerelease: [ '1267-gcfbf24d1-gleasonator' ],
  build: [ 'soapbox-dev' ],
  version: '2.4.51-1267-gcfbf24d1-gleasonator'
}

After:

> semver.parse('2.4.51-1267-gcfbf24d1.gleasonator+soapbox.dev')
SemVer {
  options: {},
  loose: false,
  includePrerelease: false,
  raw: '2.4.51-1267-gcfbf24d1.gleasonator+soapbox.dev',
  major: 2,
  minor: 4,
  patch: 51,
  prerelease: [ '1267-gcfbf24d1', 'gleasonator' ],
  build: [ 'soapbox', 'dev' ],
  version: '2.4.51-1267-gcfbf24d1.gleasonator'
}

Pay attention to the build and prerelease sections.

Also, Application.get_env/2 no longer works inside of mix.exs after the move from Mix.Config to Config, so I've removed it and hardcoded a default build, +soapbox.

This will help us finally be able to detect Soapbox BE in Soapbox FE.

Merge request reports

Loading