1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-22 15:55:33 +03:00

Always request hex via the post to API mechanism (#3149)

* Always request hex via the post to API mechanism

- enables logging of requests for older versions via API rather than GA,
- gives flexibility in future if we need to return alternative hex files for any reason.

* The URL for the hex is now returned by the API

* Only apply these settings if expertmode is enabled.
This commit is contained in:
J Blackman 2022-12-16 16:46:49 +11:00 committed by GitHub
parent b6d8efc9f8
commit e8ef9418e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 17 deletions

View file

@ -90,7 +90,6 @@ class ReleaseLoader {
contentType: "application/json", contentType: "application/json",
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
data.url = `/api/builds/${data.key}/hex`;
onSuccess(data); onSuccess(data);
}, },
}).fail(xhr => { }).fail(xhr => {

View file

@ -784,7 +784,7 @@ firmware_flasher.initialize = function (callback) {
classicBuild: false, classicBuild: false,
}; };
request.classicBuild = $('input[name="classicBuildModeCheckbox"]').is(':checked'); request.classicBuild = !summary.cloudBuild || $('input[name="classicBuildModeCheckbox"]').is(':checked');
if (!request.classicBuild) { if (!request.classicBuild) {
$('select[name="radioProtocols"] option:selected').each(function () { $('select[name="radioProtocols"] option:selected').each(function () {
request.radioProtocols.push($(this).val()); request.radioProtocols.push($(this).val());
@ -801,18 +801,27 @@ firmware_flasher.initialize = function (callback) {
$('select[name="motorProtocols"] option:selected').each(function () { $('select[name="motorProtocols"] option:selected').each(function () {
request.motorProtocols.push($(this).val()); request.motorProtocols.push($(this).val());
}); });
}
if (summary.releaseType === "Unstable") { if ($('input[name="expertModeCheckbox"]').is(':checked')) {
request.commit = $('select[name="commits"] option:selected').val(); if (summary.releaseType === "Unstable") {
$('input[name="customDefines"]').val().split(' ').map(element => element.trim()).forEach(v => { request.commit = $('select[name="commits"] option:selected').val();
request.options.push(v); }
});
$('input[name="customDefines"]').val().split(' ').map(element => element.trim()).forEach(v => {
request.options.push(v);
});
}
} }
self.releaseLoader.requestBuild(request, (info) => { self.releaseLoader.requestBuild(request, (info) => {
console.info("Build requested:", info); console.info("Build requested:", info);
if (!summary.cloudBuild) {
// it is a previous release, so simply load the hex
self.releaseLoader.loadTargetHex(info.url, (hex) => onLoadSuccess(hex, info.file), onLoadFailed);
return;
}
updateStatus('Pending', info.key, 0, false); updateStatus('Pending', info.key, 0, false);
let retries = 1; let retries = 1;
self.releaseLoader.requestBuildStatus(info.key, (status) => { self.releaseLoader.requestBuildStatus(info.key, (status) => {
@ -855,21 +864,13 @@ firmware_flasher.initialize = function (callback) {
}, onLoadFailed); }, onLoadFailed);
} }
function requestLegacyBuild(summary) {
self.releaseLoader.loadTargetHex(summary.url, (hex) => onLoadSuccess(hex, summary.file), onLoadFailed);
}
if (self.summary) { // undefined while list is loading or while running offline if (self.summary) { // undefined while list is loading or while running offline
$("a.load_remote_file").text(i18n.getMessage('firmwareFlasherButtonDownloading')); $("a.load_remote_file").text(i18n.getMessage('firmwareFlasherButtonDownloading'));
$("a.load_remote_file").addClass('disabled'); $("a.load_remote_file").addClass('disabled');
showReleaseNotes(self.summary); showReleaseNotes(self.summary);
if (self.summary.cloudBuild === true) { requestCloudBuild(self.summary);
requestCloudBuild(self.summary);
} else {
requestLegacyBuild(self.summary);
}
} else { } else {
$('span.progressLabel').attr('i18n','firmwareFlasherFailedToLoadOnlineFirmware').removeClass('i18n-replaced'); $('span.progressLabel').attr('i18n','firmwareFlasherFailedToLoadOnlineFirmware').removeClass('i18n-replaced');
i18n.localizePage(); i18n.localizePage();