Restore forced If-Modified-Since for intra-site thread watcher requests.
This commit is contained in:
parent
4ca1b1450c
commit
52128775e1
@ -77,6 +77,7 @@ ThreadStats =
|
||||
ThreadStats.timeout = setTimeout ThreadStats.fetchPage, 2 * $.MINUTE
|
||||
$.ajax "#{location.protocol}//a.4cdn.org/#{ThreadStats.thread.board}/threads.json", onload: ThreadStats.onThreadsLoad,
|
||||
whenModified: 'ThreadStats'
|
||||
bypassCache: true
|
||||
|
||||
onThreadsLoad: ->
|
||||
if @status is 200
|
||||
|
||||
@ -236,6 +236,7 @@ ThreadUpdater =
|
||||
timeout: $.MINUTE
|
||||
,
|
||||
whenModified: 'ThreadUpdater'
|
||||
bypassCache: true
|
||||
|
||||
updateThreadStatus: (type, status) ->
|
||||
return if not (hasChanged = ThreadUpdater.thread["is#{type}"] isnt status)
|
||||
|
||||
@ -224,6 +224,8 @@ ThreadWatcher =
|
||||
onloadend: ->
|
||||
ThreadWatcher.parseStatus.call @, thread
|
||||
timeout: $.MINUTE
|
||||
,
|
||||
whenModified: if force then false else 'ThreadWatcher'
|
||||
else
|
||||
req = {abort: () -> req.aborted = true}
|
||||
CrossOrigin.json url, ->
|
||||
|
||||
@ -51,7 +51,7 @@ $.ajax = do ->
|
||||
pageXHR = XMLHttpRequest
|
||||
|
||||
(url, options={}, extra={}) ->
|
||||
{type, whenModified, upCallbacks, form} = extra
|
||||
{type, whenModified, bypassCache, upCallbacks, form} = extra
|
||||
options.responseType ?= 'json' if /\.json$/.test url
|
||||
# XXX https://forums.lanik.us/viewtopic.php?f=64&t=24173&p=78310
|
||||
url = url.replace /^((?:https?:)?\/\/(?:\w+\.)?4c(?:ha|d)n\.org)\/adv\//, '$1//adv/'
|
||||
@ -59,7 +59,7 @@ $.ajax = do ->
|
||||
params = []
|
||||
# XXX https://bugs.chromium.org/p/chromium/issues/detail?id=643659
|
||||
params.push "s=#{whenModified}" if $.engine is 'blink'
|
||||
params.push "t=#{Date.now()}" if Site.software is 'yotsuba'
|
||||
params.push "t=#{Date.now()}" if Site.software is 'yotsuba' and bypassCache
|
||||
url0 = url
|
||||
url += '?' + params.join('&') if params.length
|
||||
r = new pageXHR()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user