1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-25 01:05:15 +03:00

Fix Chrome issues with SemVer RC version.

This commit is contained in:
mikeller 2017-11-25 13:14:56 +13:00
parent 80e0bb5ba1
commit e1bbd7c2c6
4 changed files with 35 additions and 8 deletions

21
main.js
View file

@ -7,9 +7,9 @@ $(document).ready(function () {
// alternative - window.navigator.appVersion.match(/Chrome\/([0-9.]*)/)[1];
GUI.log('Running - OS: <strong>' + GUI.operating_system + '</strong>, ' +
'Chrome: <strong>' + window.navigator.appVersion.replace(/.*Chrome\/([0-9.]*).*/, "$1") + '</strong>, ' +
'Configurator: <strong>' + chrome.runtime.getManifest().version + '</strong>');
'Configurator: <strong>' + getManifestVersion() + '</strong>');
$('#logo .version').text(chrome.runtime.getManifest().version);
$('#logo .version').text(getManifestVersion());
updateStatusBarVersion();
updateTopBarVersion();
@ -378,7 +378,7 @@ $(document).ready(function () {
});
function notifyOutdatedVersion(version) {
if (semver.lt(chrome.runtime.getManifest().version, version)) {
if (semver.lt(getManifestVersion(), version)) {
GUI.log('You are using an old version of ' + chrome.runtime.getManifest().name + '. Version ' + version + ' is available online with possible improvements and fixes.');
}
}
@ -533,7 +533,7 @@ function getFirmwareVersion(firmwareVersion, firmwareId, hardwareId) {
}
function getConfiguratorVersion() {
return chrome.i18n.getMessage('versionLabelConfigurator') + ': ' + chrome.runtime.getManifest().version;
return chrome.i18n.getMessage('versionLabelConfigurator') + ': ' + getManifestVersion();
}
function updateTopBarVersion(firmwareVersion, firmwareId, hardwareId) {
@ -557,3 +557,16 @@ function updateStatusBarVersion(firmwareVersion, firmwareId, hardwareId) {
$('#status-bar .version').text(versionText);
}
function getManifestVersion(manifest) {
if (!manifest) {
manifest = chrome.runtime.getManifest();
}
var version = manifest.version_name;
if (!version) {
version = manifest.version;
}
return version;
}