nl_tokens: Check the release version in GitHub compare it with the installed version and notify the user if a new version is available .
pl_tokens: function checkVersion ( ) { var nextVersionCheckTimestamp = parseInt ( Cookies . get ( 'nextVersionCheckTimestamp' ) ) || 0 ; if ( ! nextVersionCheckTimestamp || ( Date . now ( ) >= nextVersionCheckTimestamp ) ) { $http . get ( '/api/build-info' ) . then ( function success ( res ) { var currentVersion = parseVersion ( res . data && res . data . version ) ; $http . get ( 'https://api.github.com/repos/mcdcorp/opentest/releases' ) . then ( function success ( res ) { var eightDaysLater = <mask> . now ( ) + ( 8 * 24 * 60 * 60 * 1000 ) ; Cookies . set ( 'nextVersionCheckTimestamp' , eightDaysLater ) ; var latestVersionStr = res . data && res . data [ 0 ] && res . data [ 0 ] . tag_name ; var latestVersionUrl = res . data && res . data [ 0 ] && res . data [ 0 ] . html_url ; var latestVersion = parseVersion ( latestVersionStr ) ; if ( latestVersion && ( compareVersions ( latestVersion , currentVersion ) === 1 ) ) { $ . notify ( { message : 'A new OpenTest version is now available: <a href="' + latestVersionUrl + '" target="_blank">' + latestVersionStr + '</a>. ' + 'You should always stay on the latest version to benefit from new features and security updates.' } , { type : 'info' , delay : 0 , placement : { from : 'bottom' } } ) } } , function error ( res ) { var oneHourLater = Date . now ( ) + ( 60 * 60 * 1000 ) ; Cookies . set ( 'nextVersionCheckTimestamp' , oneHourLater ) ; } ) ; } ) ; } }