dodge pushstate size limit

This commit is contained in:
ed 2021-03-04 21:06:59 +01:00
parent 7a7c832000
commit f7196ac773
4 changed files with 29 additions and 12 deletions

View file

@ -1228,7 +1228,7 @@ class HttpCli(object):
fspath = fsroot + "/" + fn
try:
inf = stats.get(fn, os.stat(fsenc(fspath)))
inf = stats.get(fn) or os.stat(fsenc(fspath))
except:
self.log("broken symlink: {}".format(repr(fspath)))
continue

View file

@ -67,6 +67,7 @@ a,
#files a:hover {
color: #fff;
background: #161616;
text-decoration: underline;
}
#files thead a {
color: #999;
@ -305,7 +306,7 @@ a,
width: calc(100% - 10.5em);
background: rgba(0,0,0,0.2);
}
@media (min-width: 100em) {
@media (min-width: 90em) {
#barpos,
#barbuf {
width: calc(100% - 24em);
@ -535,7 +536,7 @@ input[type="checkbox"]:checked+label {
#files>thead>tr>th.min span {
position: absolute;
transform: rotate(270deg);
background: linear-gradient(90deg, #222, #444);
background: linear-gradient(90deg, rgba(68,68,68,0), rgba(68,68,68,0.5) 70%, #444);
margin-left: -4.6em;
padding: .4em;
top: 5.4em;
@ -554,4 +555,11 @@ input[type="checkbox"]:checked+label {
border-color: transparent;
color: #400;
text-shadow: none;
}
}
#files tr.play a {
color: inherit;
}
#files tr.play a:hover {
color: #300;
background: #fea;
}

View file

@ -462,7 +462,7 @@ function play(tid, call_depth) {
o.setAttribute('id', 'thx_js');
if (window.history && history.replaceState) {
var nurl = (document.location + '').split('#')[0] + '#' + oid;
history.replaceState(ebi('files').innerHTML, nurl, nurl);
hist_push(ebi('files').innerHTML, nurl);
}
else {
document.location.hash = oid;
@ -898,7 +898,7 @@ function autoplay_blocked() {
html = html.join('\n');
ebi('files').innerHTML = html;
history.pushState(html, this.top, this.top);
hist_push(html, this.top);
apply_perms(res.perms);
despin('#files');
@ -960,16 +960,18 @@ function autoplay_blocked() {
window.onpopstate = function (e) {
console.log(e.url + ' ,, ' + ((e.state + '').slice(0, 64)));
if (e.state) {
ebi('files').innerHTML = e.state;
reload_tree();
reload_browser();
}
var html = sessionStorage.getItem(e.state || 1);
if (!html)
return;
ebi('files').innerHTML = html;
reload_tree();
reload_browser();
};
if (window.history && history.pushState) {
var u = get_vpath() + window.location.hash;
history.replaceState(ebi('files').innerHTML, u, u);
hist_push(ebi('files').innerHTML, u);
}
})();

View file

@ -292,3 +292,10 @@ function jwrite(key, val) {
else
swrite(key, JSON.stringify(val));
}
function hist_push(html, url) {
var key = new Date().getTime();
sessionStorage.setItem(key, html);
history.pushState(key, url, url);
}