1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-14 11:59:53 +03:00

Added version information to Unified Targets when they are flashed.

This commit is contained in:
mikeller 2020-03-29 04:07:03 +13:00
parent 3faab9cedc
commit 153fa2b486
7 changed files with 155 additions and 95 deletions

27
src/js/GitHubApi.js Normal file
View file

@ -0,0 +1,27 @@
'use strict';
const GitHubApi = function ()
{
const self = this;
self.GITHUB_API_URL = "https://api.github.com/";
};
GitHubApi.prototype.getFileLastCommitInfo = function (project, branch, filename, callback)
{
const self = this;
$.getJSON(`${self.GITHUB_API_URL}repos/${encodeURI(project)}/commits?sha=${encodeURIComponent(branch)}&path=${encodeURIComponent(filename)}`, function (commits) {
const result = {};
try {
result.commitHash = commits[0].sha.substring(0, 8);
result.date = commits[0].commit.author.date;
} catch (exception) {
console.log(`Error while parsing commit: ${exception}`);
}
console.log(`Found commit info for file ${filename}:`, result);
callback(result);
});
};