Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit 782b2b5

Browse files
Info: check for newer releases of Keira2
1 parent b81f826 commit 782b2b5

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

js/app/info.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*jslint browser: true, white: true, plusplus: true, es5: true*/
1+
/*jslint browser: true, white: true, plusplus: true, es5: true, eqeq: true*/
22
/*global angular, console, alert, squel*/
33

44
(function () {
@@ -14,6 +14,7 @@
1414
// Keira version
1515
$scope.keiraVersion = "2.1.1";
1616
$scope.keiraBranch = "3.3.5";
17+
$scope.keiraTag = "v" + $scope.keiraVersion;
1718

1819
// API min required version
1920
$scope.apiRequiredVersion = 0.4;
@@ -44,6 +45,25 @@
4445
console.log("[ERROR] /version/ $http.get request failed");
4546
});
4647

48+
// Check for newer versions
49+
$scope.updateAvaialable = false;
50+
51+
if ($scope.keiraVersion != "DEV") {
52+
$http.get( "https://api.github.com/repos/Helias/Keira2/releases" )
53+
.success(function (data, status, header, config) {
54+
55+
var latestReleaseTag = data[0].tag_name;
56+
57+
if ($scope.keiraTag != latestReleaseTag) {
58+
$scope.updateAvaialable = true;
59+
}
60+
61+
})
62+
.error(function (data, status, header, config) {
63+
console.log("[ERROR] https://api.github.com/repos/Helias/Keira2/releases $http.get request failed");
64+
});
65+
}
66+
4767
});
4868

4969
}());

partials/info.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<p class="text-success h4" ng-show="updateAvaialable">A newer version of Keira2 has been released, please <a target="_blank" href="https://github.com/Helias/Keira2/releases">download and install the latest version</a>.</p>
12
<p class="text-error">{{ errorText }}</p>
23

34
<p class="h3">Informations</p>

0 commit comments

Comments
 (0)