Auto merged - #2574 at Mon, 06 Sep 2021 21:17:13 GMT

Standardised configurator version naming.
10.8-maintenance
J Blackman 2021-09-07 07:17:14 +10:00 committed by GitHub
commit f0bc8219c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 221 additions and 181 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="com.betaflight.betaflightconfigurator" version="[INJECTED_BY_GULPFILE]">
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="[INJECTED_BY_GULPFILE]" version="[INJECTED_BY_GULPFILE]">
<name>[INJECTED_BY_GULPFILE]</name>
<description>[INJECTED_BY_GULPFILE]</description>
<author href="https://betaflight.com">[INJECTED_BY_GULPFILE]</author>
@ -44,6 +44,7 @@
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/usb_device_filter"/>
</config-file>
<resource-file src="usb_device_filter.xml" target="app/src/main/res/xml/usb_device_filter.xml"/>
<resource-file src="manifest.json" target="app/src/main/assets/www/manifest.json"/>
</platform>
<platform name="ios">
<allow-intent href="itms:*"/>

View File

@ -1,9 +1,5 @@
'use strict';
const pkg = require('./package.json');
// remove gulp-appdmg from the package.json we're going to write
delete pkg.optionalDependencies['gulp-appdmg'];
const child_process = require('child_process');
const fs = require('fs');
const fse = require('fs-extra');
@ -28,7 +24,7 @@ const replace = require('gulp-replace');
const jeditor = require("gulp-json-editor");
const xmlTransformer = require("gulp-xml-transformer");
const os = require('os');
const git = require('gulp-git');
const git = require('simple-git')();
const source = require('vinyl-source-stream');
const stream = require('stream');
@ -47,8 +43,8 @@ const LINUX_INSTALL_DIR = '/opt/betaflight';
const NODE_ENV = process.env.NODE_ENV || 'production';
// Global variable to hold the change hash from when we get it, to when we use it.
let gitChangeSetId;
const NAME_REGEX = /-/g;
const nwBuilderOptions = {
version: '0.54.1',
@ -61,13 +57,18 @@ const nwBuilderOptions = {
const nwArmVersion = '0.27.6';
let metadata = {};
let cordovaDependencies = true;
//-----------------
//Pre tasks operations
//-----------------
const SELECTED_PLATFORMS = getInputPlatforms();
//-----------------
//Tasks
//-----------------
@ -86,21 +87,35 @@ gulp.task('clean-cache', clean_cache);
gulp.task('clean-cordova', clean_cordova);
gulp.task('test-cordova', cordova_browserify);
// Function definitions are processed before function calls.
const getChangesetId = gulp.series(getHash, writeChangesetId);
gulp.task('get-changeset-id', getChangesetId);
function process_package_release(done) {
getGitRevision(done, processPackage, true);
}
function process_package_debug(done) {
getGitRevision(done, processPackage, false);
}
// dist_yarn MUST be done after dist_src
const distBuild = gulp.series(dist_src, dist_changelog, dist_yarn, dist_locale, dist_libraries, dist_resources, dist_rollup, getChangesetId, gulp.series(cordova_dist()));
const distBuild = gulp.series(process_package_release, dist_src, dist_changelog, dist_yarn, dist_locale, dist_libraries, dist_resources, dist_rollup, gulp.series(cordova_dist()));
const debugDistBuild = gulp.series(process_package_debug, dist_src, dist_changelog, dist_yarn, dist_locale, dist_libraries, dist_resources, dist_rollup, gulp.series(cordova_dist()));
const distRebuild = gulp.series(clean_dist, distBuild);
gulp.task('dist', distRebuild);
const appsBuild = gulp.series(gulp.parallel(clean_apps, distRebuild), apps, gulp.series(cordova_apps()), gulp.parallel(listPostBuildTasks(APPS_DIR)));
gulp.task('apps', appsBuild);
const debugAppsBuild = gulp.series(gulp.parallel(clean_debug, distRebuild), debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR)));
const debugAppsBuild = gulp.series(gulp.parallel(clean_debug, gulp.series(clean_dist, debugDistBuild)), debug, gulp.series(cordova_apps()), gulp.parallel(listPostBuildTasks(DEBUG_DIR)));
const debugBuild = gulp.series(distBuild, debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR)), start_debug);
const debugBuild = gulp.series(debugDistBuild, debug, gulp.parallel(listPostBuildTasks(DEBUG_DIR)), start_debug);
gulp.task('debug', debugBuild);
const releaseBuild = gulp.series(gulp.parallel(clean_release, appsBuild), gulp.parallel(listReleaseTasks(APPS_DIR)));
@ -111,6 +126,7 @@ gulp.task('debug-release', debugReleaseBuild);
gulp.task('default', debugBuild);
// -----------------
// Helper functions
// -----------------
@ -203,21 +219,21 @@ function getRunDebugAppCommand(arch) {
switch (arch) {
case 'osx64':
const pkgName = `${pkg.name}.app`;
command = `open ${path.join(DEBUG_DIR, pkg.name, arch, pkgName)}`;
const packageName = `${metadata.name}.app`;
command = `open ${path.join(DEBUG_DIR, metadata.name, arch, packageName)}`;
break;
case 'linux64':
case 'linux32':
case 'armv7':
command = path.join(DEBUG_DIR, pkg.name, arch, pkg.name);
command = path.join(DEBUG_DIR, metadata.name, arch, metadata.name);
break;
case 'win32':
case 'win64':
command = path.join(DEBUG_DIR, pkg.name, arch, `${pkg.name}.exe`);
command = path.join(DEBUG_DIR, metadata.name, arch, `${metadata.name}.exe`);
break;
@ -231,7 +247,7 @@ function getRunDebugAppCommand(arch) {
}
function getReleaseFilename(platform, ext) {
return `${pkg.name}_${pkg.version}_${platform}.${ext}`;
return `${metadata.name}_${metadata.version}_${platform}.${ext}`;
}
function clean_dist() {
@ -256,19 +272,51 @@ function clean_cache() {
// Real work for dist task. Done in another task to call it via
// run-sequence.
function processPackage(done, gitRevision, isReleaseBuild) {
const metadataKeys = [ 'name', 'productName', 'description', 'author', 'license', 'version' ];
const pkg = require('./package.json');
// remove gulp-appdmg from the package.json we're going to write
delete pkg.optionalDependencies['gulp-appdmg'];
pkg.gitRevision = gitRevision;
if (!isReleaseBuild) {
pkg.productName = `${pkg.productName} (Debug Build)`;
pkg.description = `${pkg.description} (Debug Build)`;
pkg.version = `${pkg.version}-debug-${gitRevision}`;
metadata.packageId = `${pkg.name}-debug`;
} else {
metadata.packageId = pkg.name;
}
const packageJson = new stream.Readable;
packageJson.push(JSON.stringify(pkg, undefined, 2));
packageJson.push(null);
Object.keys(pkg)
.filter(key => metadataKeys.includes(key))
.forEach((key) => {
metadata[key] = pkg[key];
});
packageJson
.pipe(source('package.json'))
.pipe(gulp.dest(DIST_DIR));
done();
}
function dist_src() {
const distSources = [
'./src/**/*',
'!./src/css/dropdown-lists/LICENSE',
'!./src/support/**',
];
const packageJson = new stream.Readable;
packageJson.push(JSON.stringify(pkg,undefined,2));
packageJson.push(null);
return packageJson
.pipe(source('package.json'))
.pipe(gulp.src(distSources, { base: 'src' }))
return gulp.src(distSources, { base: 'src' })
.pipe(gulp.src('yarn.lock'))
.pipe(gulp.dest(DIST_DIR));
}
@ -395,7 +443,7 @@ function post_build(arch, folder, done) {
if ((arch === 'linux32') || (arch === 'linux64')) {
// Copy Ubuntu launcher scripts to destination dir
const launcherDir = path.join(folder, pkg.name, arch);
const launcherDir = path.join(folder, metadata.name, arch);
console.log(`Copy Ubuntu launcher scripts to ${launcherDir}`);
return gulp.src('assets/linux/**')
.pipe(gulp.dest(launcherDir));
@ -403,7 +451,7 @@ function post_build(arch, folder, done) {
if (arch === 'armv7') {
console.log('Moving ARMv7 build from "linux32" to "armv7" directory...');
fse.moveSync(path.join(folder, pkg.name, 'linux32'), path.join(folder, pkg.name, 'armv7'));
fse.moveSync(path.join(folder, metadata.name, 'linux32'), path.join(folder, metadata.name, 'armv7'));
}
return done();
@ -542,27 +590,21 @@ function buildNWApps(platforms, flavor, dir, done) {
}
}
function getHash(cb) {
git.revParse({args: '--short HEAD'}, function (err, hash) {
if (err) {
gitChangeSetId = 'unsupported';
} else {
gitChangeSetId = hash;
function getGitRevision(done, callback, isReleaseBuild) {
let gitRevision = 'norevision';
git.diff([ '--shortstat' ], function (err, diff) {
if (!err && !diff) {
git.log([ '-1', '--pretty=format:%h' ], function (err, rev) {
if (!err) {
gitRevision = rev.latest.hash;
}
cb();
});
}
function writeChangesetId() {
const versionJson = new stream.Readable;
versionJson.push(JSON.stringify({
gitChangesetId: gitChangeSetId,
version: pkg.version,
}, undefined, 2));
versionJson.push(null);
return versionJson
.pipe(source('version.json'))
.pipe(gulp.dest(DIST_DIR));
callback(done, gitRevision, isReleaseBuild);
});
} else {
callback(done, gitRevision, isReleaseBuild);
}
});
}
function start_debug(done) {
@ -590,7 +632,7 @@ function release_win(arch, appDirectory, done) {
const parameters = [];
// Extra parameters to replace inside the iss file
parameters.push(`/Dversion=${pkg.version}`);
parameters.push(`/Dversion=${metadata.version}`);
parameters.push(`/DarchName=${arch}`);
parameters.push(`/DarchAllowed=${(arch === 'win32') ? 'x86 x64' : 'x64'}`);
parameters.push(`/DarchInstallIn64bit=${(arch === 'win32') ? '' : 'x64'}`);
@ -616,9 +658,9 @@ function release_win(arch, appDirectory, done) {
// Create distribution package (zip) for windows and linux platforms
function release_zip(arch, appDirectory) {
const src = path.join(appDirectory, pkg.name, arch, '**');
const src = path.join(appDirectory, metadata.name, arch, '**');
const output = getReleaseFilename(arch, 'zip');
const base = path.join(appDirectory, pkg.name, arch);
const base = path.join(appDirectory, metadata.name, arch);
return compressFiles(src, base, output, 'Betaflight Configurator');
}
@ -641,25 +683,25 @@ function release_deb(arch, appDirectory, done) {
done();
}
return gulp.src([path.join(appDirectory, pkg.name, arch, '*')])
return gulp.src([path.join(appDirectory, metadata.name, arch, '*')])
.pipe(deb({
package: pkg.name,
version: pkg.version,
package: metadata.name,
version: metadata.version,
section: 'base',
priority: 'optional',
architecture: getLinuxPackageArch('deb', arch),
maintainer: pkg.author,
description: pkg.description,
preinst: [`rm -rf ${LINUX_INSTALL_DIR}/${pkg.name}`],
maintainer: metadata.author,
description: metadata.description,
preinst: [`rm -rf ${LINUX_INSTALL_DIR}/${metadata.name}`],
postinst: [
`chown root:root ${LINUX_INSTALL_DIR}`,
`chown -R root:root ${LINUX_INSTALL_DIR}/${pkg.name}`,
`xdg-desktop-menu install ${LINUX_INSTALL_DIR}/${pkg.name}/${pkg.name}.desktop`,
`chown -R root:root ${LINUX_INSTALL_DIR}/${metadata.name}`,
`xdg-desktop-menu install ${LINUX_INSTALL_DIR}/${metadata.name}/${metadata.name}.desktop`,
],
prerm: [`xdg-desktop-menu uninstall ${pkg.name}.desktop`],
prerm: [`xdg-desktop-menu uninstall ${metadata.name}.desktop`],
depends: 'libgconf-2-4',
changelog: [],
_target: `${LINUX_INSTALL_DIR}/${pkg.name}`,
_target: `${LINUX_INSTALL_DIR}/${metadata.name}`,
_out: RELEASE_DIR,
_copyright: 'assets/linux/copyright',
_clean: true,
@ -677,24 +719,22 @@ function release_rpm(arch, appDirectory, done) {
// The buildRpm does not generate the folder correctly, manually
createDirIfNotExists(RELEASE_DIR);
const regex = /-/g;
const options = {
name: pkg.name,
version: pkg.version.replace(regex, '_'), // RPM does not like release candidate versions
name: metadata.name,
version: metadata.version.replace(NAME_REGEX, '_'), // RPM does not like release candidate versions
buildArch: getLinuxPackageArch('rpm', arch),
vendor: pkg.author,
summary: pkg.description,
vendor: metadata.author,
summary: metadata.description,
license: 'GNU General Public License v3.0',
requires: 'libgconf-2-4',
prefix: '/opt',
files: [{
cwd: path.join(appDirectory, pkg.name, arch),
cwd: path.join(appDirectory, metadata.name, arch),
src: '*',
dest: `${LINUX_INSTALL_DIR}/${pkg.name}`,
dest: `${LINUX_INSTALL_DIR}/${metadata.name}`,
}],
postInstallScript: [`xdg-desktop-menu install ${LINUX_INSTALL_DIR}/${pkg.name}/${pkg.name}.desktop`],
preUninstallScript: [`xdg-desktop-menu uninstall ${pkg.name}.desktop`],
postInstallScript: [`xdg-desktop-menu install ${LINUX_INSTALL_DIR}/${metadata.name}/${metadata.name}.desktop`],
preUninstallScript: [`xdg-desktop-menu uninstall ${metadata.name}.desktop`],
tempDir: path.join(RELEASE_DIR, `tmp-rpm-build-${arch}`),
keepTemp: false,
verbose: false,
@ -743,12 +783,12 @@ function release_osx64(appDirectory) {
return gulp.src(['.'])
.pipe(appdmg({
target: path.join(RELEASE_DIR, getReleaseFilename('macOS', 'dmg')),
basepath: path.join(appDirectory, pkg.name, 'osx64'),
basepath: path.join(appDirectory, metadata.name, 'osx64'),
specification: {
title: 'Betaflight Configurator',
contents: [
{ 'x': 448, 'y': 342, 'type': 'link', 'path': '/Applications' },
{ 'x': 192, 'y': 344, 'type': 'file', 'path': `${pkg.name}.app`, 'name': 'Betaflight Configurator.app' },
{ 'x': 192, 'y': 344, 'type': 'file', 'path': `${metadata.name}.app`, 'name': 'Betaflight Configurator.app' },
],
background: path.join(__dirname, 'assets/osx/dmg-background.png'),
format: 'UDZO',
@ -849,6 +889,7 @@ function cordova_dist() {
distTasks.push(cordova_rename_src_config);
distTasks.push(cordova_rename_src_package);
distTasks.push(cordova_packagejson);
distTasks.push(cordova_manifestjson);
distTasks.push(cordova_configxml);
distTasks.push(cordova_browserify);
distTasks.push(cordova_depedencies);
@ -875,7 +916,6 @@ function cordova_apps() {
return appsTasks;
}
function clean_cordova() {
const patterns = [];
if (cordovaDependencies) {
@ -886,14 +926,18 @@ function clean_cordova() {
}
return del(patterns, { force: true });
}
function cordova_copy_www() {
return gulp.src(`${DIST_DIR}**`, { base: DIST_DIR })
.pipe(gulp.dest(`${CORDOVA_DIST_DIR}www/`));
}
function cordova_resources() {
return gulp.src('assets/android/**')
.pipe(gulp.dest(`${CORDOVA_DIST_DIR}resources/android/`));
}
function cordova_include_www() {
return gulp.src(`${CORDOVA_DIST_DIR}www/main.html`)
.pipe(replace('<!-- CORDOVA_INCLUDE js/cordova_chromeapi.js -->', '<script type="text/javascript" src="./js/cordova_chromeapi.js"></script>'))
@ -901,43 +945,60 @@ function cordova_include_www() {
.pipe(replace('<!-- CORDOVA_INCLUDE cordova.js -->', '<script type="text/javascript" src="cordova.js"></script>'))
.pipe(gulp.dest(`${CORDOVA_DIST_DIR}www`));
}
function cordova_copy_src() {
return gulp.src([`${CORDOVA_DIR}**`, `!${CORDOVA_DIR}config_template.xml`, `!${CORDOVA_DIR}package_template.json`])
.pipe(gulp.dest(`${CORDOVA_DIST_DIR}`));
}
function cordova_rename_src_config() {
return gulp.src(`${CORDOVA_DIR}config_template.xml`)
.pipe(rename('config.xml'))
.pipe(gulp.dest(`${CORDOVA_DIST_DIR}`));
}
function cordova_rename_src_package() {
return gulp.src(`${CORDOVA_DIR}package_template.json`)
.pipe(rename('package.json'))
.pipe(gulp.dest(`${CORDOVA_DIST_DIR}`));
}
function cordova_packagejson() {
return gulp.src(`${CORDOVA_DIST_DIR}package.json`)
.pipe(jeditor({
'name': pkg.name,
'description': pkg.description,
'version': pkg.version,
'author': pkg.author,
'license': pkg.license,
'name': metadata.name,
'description': metadata.description,
'version': metadata.version,
'author': metadata.author,
'license': metadata.license,
}))
.pipe(gulp.dest(CORDOVA_DIST_DIR));
}
// Required to make getManifest() work in cordova
function cordova_manifestjson() {
return gulp.src(`${DIST_DIR}package.json`)
.pipe(rename('manifest.json'))
.pipe(gulp.dest(CORDOVA_DIST_DIR));
}
function cordova_configxml() {
let androidName = metadata.packageId.replace(NAME_REGEX, '_');
return gulp.src([`${CORDOVA_DIST_DIR}config.xml`])
.pipe(xmlTransformer([
{ path: '//xmlns:name', text: pkg.productName },
{ path: '//xmlns:description', text: pkg.description },
{ path: '//xmlns:author', text: pkg.author },
{ path: '//xmlns:name', text: metadata.productName },
{ path: '//xmlns:description', text: metadata.description },
{ path: '//xmlns:author', text: metadata.author },
], 'http://www.w3.org/ns/widgets'))
.pipe(xmlTransformer([
{ path: '.', attr: { 'version': pkg.version } },
{ path: '.', attr: { 'id': `com.betaflight.${androidName}` } },
{ path: '.', attr: { 'version': metadata.version } },
]))
.pipe(gulp.dest(CORDOVA_DIST_DIR));
}
function cordova_browserify(callback) {
const readFile = function(file) {
return new Promise(function(resolve) {
@ -967,6 +1028,7 @@ function cordova_browserify(callback) {
readLoop();
});
}
function cordova_execbrowserify(file) {
const filename = file.split('/').pop();
const destpath = file.replace(filename, '');
@ -976,21 +1038,24 @@ function cordova_execbrowserify(file) {
.pipe(source(filename))
.pipe(gulp.dest(destpath));
}
gulp.task('test', cordova_browserify);
function cordova_depedencies() {
process.chdir('dist_cordova');
process.chdir(CORDOVA_DIST_DIR);
return gulp.src(['./package.json', './yarn.lock'])
.pipe(gulp.dest('./'))
.pipe(yarn({
production: true,
}));
}
function cordova_platforms() {
return cordova.platform('add', ['android']);
}
function cordova_debug() {
cordova.run();
}
function cordova_build(cb) {
cordova.build({
'platforms': ['android'],
@ -1002,8 +1067,9 @@ function cordova_build(cb) {
process.chdir('../');
cb();
});
console.log('APK will be generated at dist_cordova/platforms/android/app/build/outputs/apk/release/app-release.apk');
console.log(`APK will be generated at ${CORDOVA_DIST_DIR}platforms/android/app/build/outputs/apk/release/app-release.apk`);
}
async function cordova_release() {
const filename = await getReleaseFilename('android', 'apk');
console.log(`Release APK : release/${filename}`);

View File

@ -543,9 +543,13 @@
"message": "<strong>the accelerometer is enabled but it is not calibrated</strong>.<br>If you plan to use the accelerometer, please follow the instructions for '$t(initialSetupButtonCalibrateAccel.message)' on the '$t(tabSetup.message)' tab. If any function that requires the accelerometer (auto level modes, GPS rescue, ...) is enabled, arming of the craft will be disabled until the accelerometer has been calibrated.<br>If you are not planning on using the accelerometer it is recommended that you disable it in '$t(configurationSystem.message)' on the '$t(tabConfiguration.message)' tab."
},
"infoVersions": {
"message" : "Running - OS: <strong>{{operatingSystem}}</strong>, Configurator: <strong>{{configuratorVersion}}</strong>",
"description": "Message that appears in the GUI log panel indicating operating system and Configurator version"
"infoVersionOs": {
"message" : "OS: <strong>{{operatingSystem}}</strong>",
"description": "Message that appears in the GUI log panel indicating operating system"
},
"infoVersionConfigurator": {
"message" : "Configurator: <strong>{{configuratorVersion}}</strong>",
"description": "Message that appears in the GUI log panel indicating Configurator version"
},
"buildServerLoaded": {
"message" : "Loaded builds information for $1 from build server."

View File

@ -93,7 +93,6 @@
"gulp": "^4.0.2",
"gulp-concat": "~2.6.1",
"gulp-debian": "~0.1.8",
"gulp-git": "^2.10.0",
"gulp-json-editor": "^2.5.4",
"gulp-rename": "^2.0.0",
"gulp-replace": "^1.0.0",
@ -118,6 +117,7 @@
"rollup-plugin-vue": "^5.*.*",
"rpm-builder": "^1.2.1",
"run-script-os": "^1.1.3",
"simple-git": "^2.44.0",
"sinon": "^9.0.0",
"sinon-chai": "^3.5.0",
"targz": "^1.0.1",

View File

@ -26,7 +26,6 @@
:firmware-version="firmwareVersion"
:firmware-id="firmwareId"
:hardware-id="hardwareId"
:git-changeset-id="gitChangesetId"
/>
</div>
</template>
@ -73,9 +72,6 @@ export default {
hardwareId: {
type: String,
},
gitChangesetId: {
type: String,
},
},
};
</script>

View File

@ -8,7 +8,6 @@
<span v-if="hardwareId">
, {{ $t("versionLabelTarget") }}: {{ hardwareId }}
</span>
({{ gitChangesetId }})
</div>
</template>
@ -27,9 +26,6 @@ export default {
hardwareId: {
type: String,
},
gitChangesetId: {
type: String,
},
},
};
</script>

View File

@ -1,6 +1,6 @@
'use strict';
const Analytics = function (trackingId, userId, appName, appVersion, changesetId, os, checkForDebugVersions, optOut, debugMode, buildType) {
const Analytics = function (trackingId, userId, appName, appVersion, gitRevision, os, checkForDebugVersions, optOut, debugMode, buildType) {
this._trackingId = trackingId;
this.setOptOut(optOut);
@ -76,7 +76,7 @@ const Analytics = function (trackingId, userId, appName, appVersion, changesetId
};
this.setDimension(this.DIMENSIONS.CONFIGURATOR_OS, os);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_CHANGESET_ID, changesetId);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_CHANGESET_ID, gitRevision);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_USE_DEBUG_VERSIONS, checkForDebugVersions);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_BUILD_TYPE, buildType);

View File

@ -29,8 +29,17 @@ const CONFIGURATOR = {
virtualApiVersion: '0.0.1',
cliActive: false,
cliValid: false,
gitChangesetId: 'unknown',
productName: 'Betaflight Configurator',
version: '0.0.1',
gitRevision: 'norevision',
latestVersion: '0.0.1',
latestVersionReleaseUrl: 'https://github.com/betaflight/betaflight-configurator/releases',
getDisplayVersion: function () {
if (this.version.indexOf(this.gitRevision) === -1) {
return `${this.version} (${this.gitRevision})`;
} else {
return `${this.version}`;
}
},
};

View File

@ -21,11 +21,15 @@ function useGlobalNodeFunctions() {
}
}
function appReady() {
$.getJSON('version.json', function(data) {
CONFIGURATOR.version = data.version;
CONFIGURATOR.gitChangesetId = data.gitChangesetId;
function readConfiguratorVersionMetadata() {
let manifest = chrome.runtime.getManifest();
CONFIGURATOR.productName = manifest.productName;
CONFIGURATOR.version = manifest.version;
CONFIGURATOR.gitRevision = manifest.gitRevision;
}
function appReady() {
readConfiguratorVersionMetadata();
i18n.init(function() {
startProcess();
@ -35,7 +39,6 @@ function appReady() {
initializeSerialBackend();
});
});
}
function checkSetupAnalytics(callback) {
@ -74,7 +77,7 @@ function setupAnalytics(result) {
const debugMode = typeof process === "object" && process.versions['nw-flavor'] === 'sdk';
window.analytics = new Analytics('UA-123002063-1', userId, 'Betaflight Configurator', CONFIGURATOR.version, CONFIGURATOR.gitChangesetId, GUI.operating_system,
window.analytics = new Analytics('UA-123002063-1', userId, CONFIGURATOR.productName, CONFIGURATOR.version, CONFIGURATOR.gitRevision, GUI.operating_system,
checkForDebugVersions, optOut, debugMode, getBuildType());
function logException(exception) {
@ -165,9 +168,8 @@ function startProcess() {
// translate to user-selected language
i18n.localizePage();
GUI.log(i18n.getMessage('infoVersions', {
operatingSystem: GUI.operating_system,
configuratorVersion: CONFIGURATOR.version }));
GUI.log(i18n.getMessage('infoVersionOs', { operatingSystem: GUI.operating_system }));
GUI.log(i18n.getMessage('infoVersionConfigurator', { configuratorVersion: CONFIGURATOR.getDisplayVersion() }));
if (GUI.isNWJS()) {
let nwWindow = GUI.nwGui.Window.get();

View File

@ -408,7 +408,7 @@ function checkReportProblems() {
if (semver.gt(FC.CONFIG.apiVersion, CONFIGURATOR.API_VERSION_MAX_SUPPORTED)) {
const problemName = 'API_VERSION_MAX_SUPPORTED';
problemItemTemplate.clone().html(i18n.getMessage(`reportProblemsDialog${problemName}`,
[CONFIGURATOR.latestVersion, CONFIGURATOR.latestVersionReleaseUrl, CONFIGURATOR.version, FC.CONFIG.flightControllerVersion])).appendTo(problemDialogList);
[CONFIGURATOR.latestVersion, CONFIGURATOR.latestVersionReleaseUrl, CONFIGURATOR.getDisplayVersion(), FC.CONFIG.flightControllerVersion])).appendTo(problemDialogList);
needsProblemReportingDialog = true;
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, PROBLEM_ANALYTICS_EVENT,

View File

@ -162,7 +162,7 @@
<em class="fas fa-bars"></em>
</div>
<betaflight-logo
:configurator-version="CONFIGURATOR.version"
:configurator-version="CONFIGURATOR.getDisplayVersion()"
:firmware-version="FC.CONFIG.flightControllerVersion"
:firmware-id="FC.CONFIG.flightControllerIdentifier"
:hardware-id="FC.CONFIG.hardwareName"
@ -297,7 +297,7 @@
<div id="tab-content-container">
<div class="tab_container">
<betaflight-logo
:configurator-version="CONFIGURATOR.version"
:configurator-version="CONFIGURATOR.getDisplayVersion()"
:firmware-version="FC.CONFIG.flightControllerVersion"
:firmware-id="FC.CONFIG.flightControllerIdentifier"
:hardware-id="FC.CONFIG.hardwareName"
@ -373,11 +373,10 @@
:cycle-time="FC.CONFIG.cycleTime"
:cpu-load="FC.CONFIG.cpuload"
:configurator-version="CONFIGURATOR.version"
:configurator-version="CONFIGURATOR.getDisplayVersion()"
:firmware-version="FC.CONFIG.flightControllerVersion"
:firmware-id="FC.CONFIG.flightControllerIdentifier"
:hardware-id="FC.CONFIG.hardwareName"
:git-changeset-id="CONFIGURATOR.gitChangesetId"
></status-bar>
<div id="cache">
<div class="data-loading">

View File

@ -63,6 +63,18 @@
resolved "https://registry.yarnpkg.com/@korzio/djv-draft-04/-/djv-draft-04-2.0.1.tgz#2984289426cac5ed622b26a58c3af8584aefbdfe"
integrity sha512-MeTVcNsfCIYxK6T7jW1sroC7dBAb4IfLmQe6RoCqlxHN5NFkzNpgdnBPR+/0D2wJDUJHM9s9NQv+ouhxKjvUjg==
"@kwsites/file-exists@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@kwsites/file-exists/-/file-exists-1.1.1.tgz#ad1efcac13e1987d8dbaf235ef3be5b0d96faa99"
integrity sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==
dependencies:
debug "^4.1.1"
"@kwsites/promise-deferred@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz#8ace5259254426ccef57f3175bc64ed7095ed919"
integrity sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==
"@mrmlnc/readdir-enhanced@^2.2.1":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz#524af240d1a360527b730475ecfa1344aa540dde"
@ -514,11 +526,6 @@ any-promise@^1.0.0:
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
integrity sha1-q8av7tzqUugJzcA3au0845Y10X8=
any-shell-escape@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/any-shell-escape/-/any-shell-escape-0.1.1.tgz#d55ab972244c71a9a5e1ab0879f30bf110806959"
integrity sha1-1Vq5ciRMcaml4asIefML8RCAaVk=
anymatch@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb"
@ -2264,6 +2271,13 @@ debug@^4.1.1:
dependencies:
ms "^2.1.1"
debug@^4.3.1:
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
dependencies:
ms "2.1.2"
debug@~3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
@ -3352,13 +3366,6 @@ fined@^1.0.1:
object.pick "^1.2.0"
parse-filepath "^1.0.1"
first-chunk-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/first-chunk-stream/-/first-chunk-stream-2.0.0.tgz#1bdecdb8e083c0664b91945581577a43a9f31d70"
integrity sha1-G97NuOCDwGZLkZRVgVd6Q6nzHXA=
dependencies:
readable-stream "^2.0.2"
flagged-respawn@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/flagged-respawn/-/flagged-respawn-1.0.1.tgz#e7de6f1279ddd9ca9aac8a5971d618606b3aab41"
@ -3928,20 +3935,6 @@ gulp-debian@~0.1.8:
through2 "^2.0.1"
title-case "^2.1.0"
gulp-git@^2.10.0:
version "2.10.0"
resolved "https://registry.yarnpkg.com/gulp-git/-/gulp-git-2.10.0.tgz#ba96e596c79c3f864392285b5f5b3d951f5ea371"
integrity sha512-AYh0xXpKdDYS+ftCuyF9+LFXoltjtFlpfKITTCKDI0LunztpwVuHFtp31SvRSFVZikvRHTHUGMZ9Z0TnXjDIxQ==
dependencies:
any-shell-escape "^0.1.1"
fancy-log "^1.3.2"
lodash.template "^4.4.0"
plugin-error "^1.0.1"
require-dir "^1.0.0"
strip-bom-stream "^3.0.0"
through2 "^2.0.3"
vinyl "^2.0.1"
gulp-json-editor@^2.5.4:
version "2.5.4"
resolved "https://registry.yarnpkg.com/gulp-json-editor/-/gulp-json-editor-2.5.4.tgz#b77b46bca22d2dd1ac9f15bbec1eddbe5ef3567c"
@ -5435,14 +5428,6 @@ lodash.template@^3.0.0:
lodash.restparam "^3.0.0"
lodash.templatesettings "^3.0.0"
lodash.template@^4.4.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab"
integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A==
dependencies:
lodash._reinterpolate "^3.0.0"
lodash.templatesettings "^4.0.0"
lodash.templatesettings@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz#fb307844753b66b9f1afa54e262c745307dba8e5"
@ -5451,13 +5436,6 @@ lodash.templatesettings@^3.0.0:
lodash._reinterpolate "^3.0.0"
lodash.escape "^3.0.0"
lodash.templatesettings@^4.0.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.templatesettings/-/lodash.templatesettings-4.2.0.tgz#e481310f049d3cf6d47e912ad09313b154f0fb33"
integrity sha512-stgLz+i3Aa9mZgnjr/O+v9ruKZsPsndy7qPZOchbqk2cnTU1ZaldKK+v7m54WoKIyxiuMZTKT2H81F8BeAc3ZQ==
dependencies:
lodash._reinterpolate "^3.0.0"
lodash.union@^4.6.0:
version "4.6.0"
resolved "https://registry.yarnpkg.com/lodash.union/-/lodash.union-4.6.0.tgz#48bb5088409f16f1821666641c44dd1aaae3cd88"
@ -7400,11 +7378,6 @@ request@^2.88.0:
tunnel-agent "^0.6.0"
uuid "^3.3.2"
require-dir@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/require-dir/-/require-dir-1.2.0.tgz#0d443b75e96012d3ca749cf19f529a789ae74817"
integrity sha512-LY85DTSu+heYgDqq/mK+7zFHWkttVNRXC9NKcKGyuGLdlsfbjEPrIEYdCVrx6hqnJb+xSu3Lzaoo8VnmOhhjNA==
require-directory@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42"
@ -7814,6 +7787,15 @@ simple-concat@^1.0.0:
resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f"
integrity sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==
simple-git@^2.44.0:
version "2.44.0"
resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-2.44.0.tgz#94eca4162b7e21707b5a1a40b22e6f29b007d3a8"
integrity sha512-wIjcAmymhzgdaM0Y/a+XxmNGlivvHQTPZDYXVmyHMShVDwdeVqu3+OOyDbYu0DnfVzqLs2EOxRTgMNbC3YquwQ==
dependencies:
"@kwsites/file-exists" "^1.1.1"
"@kwsites/promise-deferred" "^1.1.1"
debug "^4.3.1"
simple-glob@~0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/simple-glob/-/simple-glob-0.2.0.tgz#95cf6a5fb5d84843a52a58529cba31b0f5c3478c"
@ -8253,21 +8235,6 @@ strip-ansi@^6.0.0:
dependencies:
ansi-regex "^5.0.0"
strip-bom-buf@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/strip-bom-buf/-/strip-bom-buf-1.0.0.tgz#1cb45aaf57530f4caf86c7f75179d2c9a51dd572"
integrity sha1-HLRar1dTD0yvhsf3UXnSyaUd1XI=
dependencies:
is-utf8 "^0.2.1"
strip-bom-stream@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/strip-bom-stream/-/strip-bom-stream-3.0.0.tgz#956bcc5d84430f69256a90ed823765cd858e159c"
integrity sha1-lWvMXYRDD2klapDtgjdlzYWOFZw=
dependencies:
first-chunk-stream "^2.0.0"
strip-bom-buf "^1.0.0"
strip-bom@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-2.0.0.tgz#6219a85616520491f35788bdbf1447a99c7e6b0e"
@ -9047,7 +9014,7 @@ vinyl@^0.5.0:
clone-stats "^0.0.1"
replace-ext "0.0.1"
vinyl@^2.0.0, vinyl@^2.0.1, vinyl@^2.1.0:
vinyl@^2.0.0, vinyl@^2.1.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-2.2.0.tgz#d85b07da96e458d25b2ffe19fece9f2caa13ed86"
integrity sha512-MBH+yP0kC/GQ5GwBqrTPTzEfiiLjta7hTtvQtbxBgTeSXsmKQRQecjibMbxIXzVT3Y9KJK+drOz1/k+vsu8Nkg==