diff --git a/copyparty/svchub.py b/copyparty/svchub.py index c31f2ee5..8983d423 100644 --- a/copyparty/svchub.py +++ b/copyparty/svchub.py @@ -9,7 +9,6 @@ from datetime import datetime, timedelta import calendar from .__init__ import PY2, WINDOWS, MACOS, VT100 -from .authsrv import AuthSrv from .tcpsrv import TcpSrv from .up2k import Up2k from .util import mp diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 9c1f159b..86a90668 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -64,7 +64,7 @@ class Up2k(object): self.flags = {} self.cur = {} self.mtag = None - self.n_mtag_tags_added = 0 + self.n_mtag_tags_added = -1 self.mem_cur = None self.sqlite_ver = None @@ -461,7 +461,10 @@ class Up2k(object): # mp.pool.ThreadPool and concurrent.futures.ThreadPoolExecutor # both do crazy runahead so lets reinvent another wheel nw = os.cpu_count() if hasattr(os, "cpu_count") else 4 - self.log("using {}x {}".format(nw, self.mtag.backend)) + if self.n_mtag_tags_added == -1: + self.log("using {}x {}".format(nw, self.mtag.backend)) + self.n_mtag_tags_added = 0 + mpool = Queue(nw) for _ in range(nw): thr = threading.Thread(target=self._tag_thr, args=(mpool,)) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index d36c9cdf..cdf25ff3 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -467,8 +467,7 @@ function play(tid, call_depth) { var o = ebi(oid); o.setAttribute('id', 'thx_js'); if (window.history && history.replaceState) { - var nurl = (document.location + '').split('#')[0] + '#' + oid; - hist_replace(ebi('files').innerHTML, nurl); + hist_replace((document.location + '').split('#')[0] + '#' + oid); } else { document.location.hash = oid; @@ -726,7 +725,6 @@ function autoplay_blocked() { // tree (function () { - var treedata = null; var dyn = bcfg_get('dyntree', true); var treesz = icfg_get('treesz', 16); treesz = Math.min(Math.max(treesz, 4), 50); @@ -746,13 +744,15 @@ function autoplay_blocked() { treefiles.appendChild(ebi('epi')); swrite('entreed', 'tree'); - get_tree("", get_vpath()); + get_tree("", get_vpath(), true); } - function get_tree(top, dst) { + function get_tree(top, dst, rst) { var xhr = new XMLHttpRequest(); xhr.top = top; xhr.dst = dst; + xhr.rst = rst; + xhr.ts = new Date().getTime(); xhr.open('GET', dst + '?tree=' + top, true); xhr.onreadystatechange = recvtree; xhr.send(); @@ -768,6 +768,13 @@ function autoplay_blocked() { return; } + var cur = ebi('treeul').getAttribute('ts'); + if (cur && parseInt(cur) > this.ts) { + console.log("reject tree"); + return; + } + ebi('treeul').setAttribute('ts', this.ts); + var top = this.top == '.' ? this.dst : this.top, name = top.split('/').slice(-2)[0], rtop = top.replace(/^\/+/, ""); @@ -781,7 +788,7 @@ function autoplay_blocked() { var html = parsetree(res, rtop); if (!this.top) { html = '