mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 00:05:22 +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:
parent
b6d8efc9f8
commit
e8ef9418e1
2 changed files with 17 additions and 17 deletions
|
@ -90,7 +90,6 @@ class ReleaseLoader {
|
|||
contentType: "application/json",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
data.url = `/api/builds/${data.key}/hex`;
|
||||
onSuccess(data);
|
||||
},
|
||||
}).fail(xhr => {
|
||||
|
|
|
@ -784,7 +784,7 @@ firmware_flasher.initialize = function (callback) {
|
|||
classicBuild: false,
|
||||
};
|
||||
|
||||
request.classicBuild = $('input[name="classicBuildModeCheckbox"]').is(':checked');
|
||||
request.classicBuild = !summary.cloudBuild || $('input[name="classicBuildModeCheckbox"]').is(':checked');
|
||||
if (!request.classicBuild) {
|
||||
$('select[name="radioProtocols"] option:selected').each(function () {
|
||||
request.radioProtocols.push($(this).val());
|
||||
|
@ -801,18 +801,27 @@ firmware_flasher.initialize = function (callback) {
|
|||
$('select[name="motorProtocols"] option:selected').each(function () {
|
||||
request.motorProtocols.push($(this).val());
|
||||
});
|
||||
}
|
||||
|
||||
if (summary.releaseType === "Unstable") {
|
||||
request.commit = $('select[name="commits"] option:selected').val();
|
||||
$('input[name="customDefines"]').val().split(' ').map(element => element.trim()).forEach(v => {
|
||||
request.options.push(v);
|
||||
});
|
||||
if ($('input[name="expertModeCheckbox"]').is(':checked')) {
|
||||
if (summary.releaseType === "Unstable") {
|
||||
request.commit = $('select[name="commits"] option:selected').val();
|
||||
}
|
||||
|
||||
$('input[name="customDefines"]').val().split(' ').map(element => element.trim()).forEach(v => {
|
||||
request.options.push(v);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
self.releaseLoader.requestBuild(request, (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);
|
||||
let retries = 1;
|
||||
self.releaseLoader.requestBuildStatus(info.key, (status) => {
|
||||
|
@ -855,21 +864,13 @@ firmware_flasher.initialize = function (callback) {
|
|||
}, 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
|
||||
$("a.load_remote_file").text(i18n.getMessage('firmwareFlasherButtonDownloading'));
|
||||
$("a.load_remote_file").addClass('disabled');
|
||||
|
||||
showReleaseNotes(self.summary);
|
||||
|
||||
if (self.summary.cloudBuild === true) {
|
||||
requestCloudBuild(self.summary);
|
||||
} else {
|
||||
requestLegacyBuild(self.summary);
|
||||
}
|
||||
requestCloudBuild(self.summary);
|
||||
} else {
|
||||
$('span.progressLabel').attr('i18n','firmwareFlasherFailedToLoadOnlineFirmware').removeClass('i18n-replaced');
|
||||
i18n.localizePage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue