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