Skip to content
  • Henrik Fehlauer's avatar
    Emit console warning when using an unsupported BRouter version · eeb1c5bd
    Henrik Fehlauer authored
    abrensch/brouter@c9ae7c8681 changed indexing of voice hint ids, because
    some new hints were inserted in the middle instead of strictly at the
    end, changing the numbering of existing ids. For example, now id `12`
    was sent to indicate a right u-turn, while we still assume the old
    meaning of `12`, i.e. "off route". This clearly was an API break.
    
    This leads us to abort exporting with the Gpsies turn instructions
    style, since `OFFR` has an `undefined` symbol assigned, as well as
    emitting wrong voice hints for ids after `9`. Another unwelcome side
    effect is showing negative exit numbers for roundabouts.
    
    This breakage in the GeoJSON HTTP API has been shipping in BRouter 1.7.0
    and 1.7.1 and finally got fixed with abrensch/brouter@82fecf9 contained
    in BRouter 1.7.2 or later. Earlier releases like 1.6.3 are also
    unaffected. To avoid emitting incorrect voice hints in BRouter-Web,
    running with broken versions of BRouter should be avoided.
    
    By checking the "Creator" field after receiving the first response from
    BRouter, we can now emit a warning if the version of BRouter used is
    unsupported. The warning mostly targets administrators and power users,
    i.e. those responsible for choosing the software versions used, and it
    is also only shown once per session.
    
    Note that the version check is compatible with the common "SemVer"
    scheme, so the check should continue working and even support more
    complex version compatibility scenarios as long as BRouter stays
    SemVer-compliant.
    
    Ref #751
    
    Test Plan:
      - Run with BRouter 1.6.3 and 1.7.2, no warnings shown.
      - Run with BRouter 1.7.0 and 1.7.1, warnings shown only for the first
      segment.
    eeb1c5bd