diff --git a/html/General/Settings-section-Archives.html b/html/General/Settings-section-Archives.html index 086b33d92..4ee9bd1e5 100644 --- a/html/General/Settings-section-Archives.html +++ b/html/General/Settings-section-Archives.html @@ -1,5 +1,6 @@
404 Redirect is disabled.

Disabled selections indicate that only one archive is available for that board and redirection type.

+

Last updated:

diff --git a/src/Archive/Redirect.coffee b/src/Archive/Redirect.coffee index f39721cd3..1061f087c 100644 --- a/src/Archive/Redirect.coffee +++ b/src/Archive/Redirect.coffee @@ -34,7 +34,7 @@ Redirect = Redirect.file[boardID] = archive return - update: -> + update: (cb) -> $.get 'lastarchivecheck', 0, ({lastarchivecheck}) -> now = Date.now() # Update the list of archives every 4 days. @@ -46,6 +46,7 @@ Redirect = $.set lastarchivecheck: now archives: Conf['archives'] + cb now if cb to: (dest, data) -> archive = (if dest is 'search' then Redirect.thread else Redirect[dest])[data.boardID] diff --git a/src/General/Settings.coffee b/src/General/Settings.coffee index bf4610001..4a42e183d 100644 --- a/src/General/Settings.coffee +++ b/src/General/Settings.coffee @@ -399,6 +399,20 @@ Settings = <%= grunt.file.read('html/General/Settings-section-Archives.html').replace(/>\s+<').trim() %> """ + showLastUpdateTime = (time) -> + $('time', section).textContent = new Date(time).toLocaleString() + + button = $ 'button', section + $.on button, 'click', -> + $.delete 'lastarchivecheck' + button.textContent = '...' + button.disabled = true + Redirect.update (time) -> + button.textContent = 'Updated' + showLastUpdateTime time + + $.get 'lastarchivecheck', 0, ({lastarchivecheck}) -> showLastUpdateTime lastarchivecheck + boards = {} for archive in Conf['archives'] for boardID in archive.boards
Archived boards