Avoid version conflicts between sync'd devices.

Also fix some notification lifetime, teehee~.
This commit is contained in:
Nicolas Stepien 2013-03-29 17:09:03 +01:00
parent f930f5ccdd
commit 0ab6af2a01
2 changed files with 9 additions and 2 deletions

View File

@ -212,10 +212,17 @@ Settings =
$.get 'previousversion', null, (item) ->
return if item['previousversion'] is g.VERSION
# Avoid conflicts between sync'd newer versions
# and out of date extension on this device.
prev = item['previousversion'].match(/\d+/g).map Number
curr = g.VERSION.match(/\d+/g).map Number
return unless prev[0] >= curr[0] and prev[1] >= curr[1] and prev[2] >= curr[2]
changelog = "<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md##{g.VERSION.replace(/\./g, '')}"
el = $.el 'span',
innerHTML: "<%= meta.name %> has been updated to <a href='#{changelog}' target=_blank>version #{g.VERSION}</a>."
new Notification 'info', el, 1 * $.MINUTE
new Notification 'info', el, 60
$.set 'lastupdate', Date.now()
$.set 'previousversion', g.VERSION
$.on d, '4chanXInitFinished', Settings.open unless item['previousversion']

View File

@ -519,7 +519,7 @@ Main =
$.set 'lastchecked', now
el = $.el 'span',
innerHTML: "Update: <%= meta.name %> v#{version} is out, get it <a href=<%= meta.page %> target=_blank>here</a>."
new Notification 'info', el, 2 * $.MINUTE
new Notification 'info', el, 120
handleErrors: (errors) ->
unless 'length' of errors