mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
fix md-editor lastmod cmp when browsercache is belligerent
This commit is contained in:
parent
0896c5295c
commit
4c843c6df9
|
@ -2634,7 +2634,7 @@ class HttpCli(object):
|
||||||
#
|
#
|
||||||
# if request is for foo.js, check if we have foo.js.{gz,br}
|
# if request is for foo.js, check if we have foo.js.{gz,br}
|
||||||
|
|
||||||
file_ts = 0
|
file_ts = 0.0
|
||||||
editions: dict[str, tuple[str, int]] = {}
|
editions: dict[str, tuple[str, int]] = {}
|
||||||
for ext in ["", ".gz", ".br"]:
|
for ext in ["", ".gz", ".br"]:
|
||||||
try:
|
try:
|
||||||
|
@ -2652,7 +2652,7 @@ class HttpCli(object):
|
||||||
else:
|
else:
|
||||||
sz = st.st_size
|
sz = st.st_size
|
||||||
|
|
||||||
file_ts = max(file_ts, int(st.st_mtime))
|
file_ts = max(file_ts, st.st_mtime)
|
||||||
editions[ext or "plain"] = (fs_path, sz)
|
editions[ext or "plain"] = (fs_path, sz)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -2665,11 +2665,14 @@ class HttpCli(object):
|
||||||
#
|
#
|
||||||
# if-modified
|
# if-modified
|
||||||
|
|
||||||
file_lastmod, do_send = self._chk_lastmod(file_ts)
|
file_lastmod, do_send = self._chk_lastmod(int(file_ts))
|
||||||
self.out_headers["Last-Modified"] = file_lastmod
|
self.out_headers["Last-Modified"] = file_lastmod
|
||||||
if not do_send:
|
if not do_send:
|
||||||
status = 304
|
status = 304
|
||||||
|
|
||||||
|
if self.can_write:
|
||||||
|
self.out_headers["X-Lastmod3"] = str(int(file_ts * 1000))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Accept-Encoding and UA decides which edition to send
|
# Accept-Encoding and UA decides which edition to send
|
||||||
|
|
||||||
|
|
|
@ -278,6 +278,7 @@ function Modpoll() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var new_md = this.responseText,
|
var new_md = this.responseText,
|
||||||
|
new_mt = this.getResponseHeader('X-Lastmod3') || r.lastmod,
|
||||||
server_ref = server_md.replace(/\r/g, ''),
|
server_ref = server_md.replace(/\r/g, ''),
|
||||||
server_now = new_md.replace(/\r/g, '');
|
server_now = new_md.replace(/\r/g, '');
|
||||||
|
|
||||||
|
@ -285,6 +286,7 @@ function Modpoll() {
|
||||||
if (r.initial && server_ref != server_now)
|
if (r.initial && server_ref != server_now)
|
||||||
return modal.confirm('Your browser decided to show an outdated copy of the document!\n\nDo you want to load the latest version from the server instead?', function () {
|
return modal.confirm('Your browser decided to show an outdated copy of the document!\n\nDo you want to load the latest version from the server instead?', function () {
|
||||||
dom_src.value = server_md = new_md;
|
dom_src.value = server_md = new_md;
|
||||||
|
last_modified = new_mt;
|
||||||
draw_md();
|
draw_md();
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue