-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added update check via github release api
- Loading branch information
Showing
6 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
} | ||
|
||
.navbar-status-label { | ||
width: 75px; | ||
min-width: 75px; | ||
display: block; | ||
float: left; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
'use strict'; | ||
|
||
var EiskaltApp = angular.module('EiskaltApp', ['ngRoute', 'ngStorage', 'ngSanitize', 'luegg.directives', 'ui.bootstrap', | ||
'angularBootstrapNavTree', 'EiskaltRPC', 'EiskaltFilters']); | ||
'angularBootstrapNavTree', 'UpdateCheck', 'EiskaltRPC', 'EiskaltFilters']); | ||
|
||
EiskaltApp.value('settings', { | ||
version: '0.3.0', | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
kraiz
Author
Collaborator
|
||
updateUrl: 'https://api.github.com/repos/kraiz/icecult/releases', | ||
chatMessagesKept: 250, | ||
refresh: { | ||
hashAndRatio: 5000, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
angular.module('UpdateCheck', []).factory('UpdateCheck', function($http, settings) { | ||
|
||
var api = settings.updateUrl + '?callback=JSON_CALLBACK'; | ||
|
||
var find = function(arr, name) { | ||
console.log(name, arr); | ||
var filtered = arr.filter(function(e) { return e.name === name}); | ||
console.log(filtered); | ||
return filtered.length ? filtered[0] : null | ||
} | ||
|
||
var newVersion = function(currentVersion) { | ||
var promise = $http.jsonp(api); | ||
promise.success = function(fn) { | ||
promise.then(function(response) { | ||
if (response.status !== 200) { | ||
fn(null); | ||
} | ||
var versions = response.data.data; | ||
var latest = versions[0]; | ||
var current = find(versions, currentVersion.client); | ||
fn(new Date(current.published_at) < new Date(latest.published_at) ? latest : null); | ||
}); | ||
} | ||
return promise; | ||
} | ||
|
||
return { | ||
getNewerVersion: newVersion | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Since the commit tag indicates a version 0.4.0, should this also be version 0.4.0?