mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-26 01:35:28 +03:00
Fix Chrome issues with SemVer RC version.
This commit is contained in:
parent
80e0bb5ba1
commit
e1bbd7c2c6
4 changed files with 35 additions and 8 deletions
17
eventPage.js
17
eventPage.js
|
@ -80,7 +80,7 @@ chrome.app.runtime.onLaunched.addListener(startApplication);
|
||||||
chrome.runtime.onInstalled.addListener(function (details) {
|
chrome.runtime.onInstalled.addListener(function (details) {
|
||||||
if (details.reason == 'update') {
|
if (details.reason == 'update') {
|
||||||
var previousVersionArr = details.previousVersion.split('.'),
|
var previousVersionArr = details.previousVersion.split('.'),
|
||||||
currentVersionArr = chrome.runtime.getManifest().version.split('.');
|
currentVersionArr = getManifestVersion().split('.');
|
||||||
|
|
||||||
// only fire up notification sequence when one of the major version numbers changed
|
// only fire up notification sequence when one of the major version numbers changed
|
||||||
if (currentVersionArr[0] > previousVersionArr[0] || currentVersionArr[1] > previousVersionArr[1]) {
|
if (currentVersionArr[0] > previousVersionArr[0] || currentVersionArr[1] > previousVersionArr[1]) {
|
||||||
|
@ -91,7 +91,7 @@ chrome.runtime.onInstalled.addListener(function (details) {
|
||||||
priority: 0,
|
priority: 0,
|
||||||
type: 'basic',
|
type: 'basic',
|
||||||
title: manifest.name,
|
title: manifest.name,
|
||||||
message: chrome.i18n.getMessage('notifications_app_just_updated_to_version', [manifest.version]),
|
message: chrome.i18n.getMessage('notifications_app_just_updated_to_version', [getManifestVersion(manifest)]),
|
||||||
iconUrl: '/images/icon_128.png',
|
iconUrl: '/images/icon_128.png',
|
||||||
buttons: [{'title': chrome.i18n.getMessage('notifications_click_here_to_start_app')}]
|
buttons: [{'title': chrome.i18n.getMessage('notifications_click_here_to_start_app')}]
|
||||||
};
|
};
|
||||||
|
@ -110,3 +110,16 @@ chrome.notifications.onButtonClicked.addListener(function (notificationId, butto
|
||||||
startApplication();
|
startApplication();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getManifestVersion(manifest) {
|
||||||
|
if (!manifest) {
|
||||||
|
manifest = chrome.runtime.getManifest();
|
||||||
|
}
|
||||||
|
|
||||||
|
var version = manifest.version_name;
|
||||||
|
if (!version) {
|
||||||
|
version = manifest.version;
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
function configuration_backup(callback) {
|
function configuration_backup(callback) {
|
||||||
var activeProfile = null;
|
var activeProfile = null;
|
||||||
|
|
||||||
var version = chrome.runtime.getManifest().version;
|
var version = getManifestVersion();
|
||||||
|
|
||||||
if (version.indexOf(".") === -1) {
|
if (version.indexOf(".") === -1) {
|
||||||
version = version + ".0.0";
|
version = version + ".0.0";
|
||||||
|
|
21
main.js
21
main.js
|
@ -7,9 +7,9 @@ $(document).ready(function () {
|
||||||
// alternative - window.navigator.appVersion.match(/Chrome\/([0-9.]*)/)[1];
|
// alternative - window.navigator.appVersion.match(/Chrome\/([0-9.]*)/)[1];
|
||||||
GUI.log('Running - OS: <strong>' + GUI.operating_system + '</strong>, ' +
|
GUI.log('Running - OS: <strong>' + GUI.operating_system + '</strong>, ' +
|
||||||
'Chrome: <strong>' + window.navigator.appVersion.replace(/.*Chrome\/([0-9.]*).*/, "$1") + '</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();
|
updateStatusBarVersion();
|
||||||
updateTopBarVersion();
|
updateTopBarVersion();
|
||||||
|
|
||||||
|
@ -378,7 +378,7 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
function notifyOutdatedVersion(version) {
|
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.');
|
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() {
|
function getConfiguratorVersion() {
|
||||||
return chrome.i18n.getMessage('versionLabelConfigurator') + ': ' + chrome.runtime.getManifest().version;
|
return chrome.i18n.getMessage('versionLabelConfigurator') + ': ' + getManifestVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTopBarVersion(firmwareVersion, firmwareId, hardwareId) {
|
function updateTopBarVersion(firmwareVersion, firmwareId, hardwareId) {
|
||||||
|
@ -557,3 +557,16 @@ function updateStatusBarVersion(firmwareVersion, firmwareId, hardwareId) {
|
||||||
|
|
||||||
$('#status-bar .version').text(versionText);
|
$('#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;
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"minimum_chrome_version": "38",
|
"minimum_chrome_version": "38",
|
||||||
"version": "10.0.0-RC2",
|
"version": "10.0.0",
|
||||||
|
"version_name": "10.0.0-RC2",
|
||||||
"author": "Betaflight Squad",
|
"author": "Betaflight Squad",
|
||||||
"name": "Betaflight - Configurator",
|
"name": "Betaflight - Configurator",
|
||||||
"short_name": "Betaflight",
|
"short_name": "Betaflight",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue