mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
ux snappiness + keepalive on http-1.0
This commit is contained in:
parent
c5c1e96cf8
commit
903b9e627a
|
@ -6,11 +6,13 @@ import time
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .__init__ import ANYWIN, MACOS
|
from .__init__ import ANYWIN, MACOS
|
||||||
from .util import RootLogger, min_ex, chkcmd
|
from .util import min_ex, chkcmd
|
||||||
from .authsrv import VFS, AXS
|
from .authsrv import VFS, AXS
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from typing import Optional, Union
|
from typing import Optional, Union
|
||||||
|
|
||||||
|
from .util import RootLogger
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,9 @@ class HttpCli(object):
|
||||||
self.is_ancient = self.ua.startswith("Mozilla/4.")
|
self.is_ancient = self.ua.startswith("Mozilla/4.")
|
||||||
|
|
||||||
zs = self.headers.get("connection", "").lower()
|
zs = self.headers.get("connection", "").lower()
|
||||||
self.keepalive = not zs.startswith("close") and self.http_ver != "HTTP/1.0"
|
self.keepalive = not zs.startswith("close") and (
|
||||||
|
self.http_ver != "HTTP/1.0" or zs == "keep-alive"
|
||||||
|
)
|
||||||
self.is_https = (
|
self.is_https = (
|
||||||
self.headers.get("x-forwarded-proto", "").lower() == "https" or self.tls
|
self.headers.get("x-forwarded-proto", "").lower() == "https" or self.tls
|
||||||
)
|
)
|
||||||
|
|
|
@ -97,6 +97,8 @@ class HttpConn(object):
|
||||||
self.log_func(self.log_src, msg, c)
|
self.log_func(self.log_src, msg, c)
|
||||||
|
|
||||||
def get_u2idx(self) -> U2idx:
|
def get_u2idx(self) -> U2idx:
|
||||||
|
# one u2idx per tcp connection;
|
||||||
|
# sqlite3 fully parallelizes under python threads
|
||||||
if not self.u2idx:
|
if not self.u2idx:
|
||||||
self.u2idx = U2idx(self)
|
self.u2idx = U2idx(self)
|
||||||
|
|
||||||
|
|
|
@ -1545,7 +1545,7 @@ html.y #tree.nowrap .ntree a+a:hover {
|
||||||
padding: 0 1.2em 0 0;
|
padding: 0 1.2em 0 0;
|
||||||
font-size: 4em;
|
font-size: 4em;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
animation: 1s linear .05s infinite forwards spin, .2s ease .05s 1 forwards fadein;
|
animation: 1s linear .15s infinite forwards spin, .2s ease .15s 1 forwards fadein;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 9;
|
z-index: 9;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3827,6 +3827,7 @@ function tree_neigh(n) {
|
||||||
|
|
||||||
treectl.dir_cb = tree_scrollto;
|
treectl.dir_cb = tree_scrollto;
|
||||||
links[act].click();
|
links[act].click();
|
||||||
|
links[act].focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4638,7 +4639,7 @@ var treectl = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload_tree() {
|
function reload_tree() {
|
||||||
var cdir = get_vpath(),
|
var cdir = r.nextdir || get_vpath(),
|
||||||
links = QSA('#treeul a+a'),
|
links = QSA('#treeul a+a'),
|
||||||
nowrap = QS('#tree.nowrap') && QS('#hovertree.on'),
|
nowrap = QS('#tree.nowrap') && QS('#hovertree.on'),
|
||||||
act = null;
|
act = null;
|
||||||
|
@ -4744,6 +4745,7 @@ var treectl = (function () {
|
||||||
if (hpush && !no_tree)
|
if (hpush && !no_tree)
|
||||||
get_tree('.', xhr.top);
|
get_tree('.', xhr.top);
|
||||||
|
|
||||||
|
r.nextdir = xhr.top;
|
||||||
enspin(thegrid.en ? '#gfiles' : '#files');
|
enspin(thegrid.en ? '#gfiles' : '#files');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4766,6 +4768,7 @@ var treectl = (function () {
|
||||||
if (!xhrchk(this, L.fl_xe1, L.fl_xe2))
|
if (!xhrchk(this, L.fl_xe1, L.fl_xe2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
r.nextdir = null;
|
||||||
var cur = ebi('files').getAttribute('ts');
|
var cur = ebi('files').getAttribute('ts');
|
||||||
if (cur && parseInt(cur) > this.ts) {
|
if (cur && parseInt(cur) > this.ts) {
|
||||||
console.log("reject ls");
|
console.log("reject ls");
|
||||||
|
|
|
@ -11,6 +11,7 @@ copyparty/broker_mp.py,
|
||||||
copyparty/broker_mpw.py,
|
copyparty/broker_mpw.py,
|
||||||
copyparty/broker_thr.py,
|
copyparty/broker_thr.py,
|
||||||
copyparty/broker_util.py,
|
copyparty/broker_util.py,
|
||||||
|
copyparty/fsutil.py,
|
||||||
copyparty/ftpd.py,
|
copyparty/ftpd.py,
|
||||||
copyparty/httpcli.py,
|
copyparty/httpcli.py,
|
||||||
copyparty/httpconn.py,
|
copyparty/httpconn.py,
|
||||||
|
|
Loading…
Reference in a new issue