From 2381692aba8b9c301b4aa9773b314f2a3f3625a7 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 6 Mar 2021 02:30:36 +0100 Subject: [PATCH] js cfg --- copyparty/u2idx.py | 6 +++++- copyparty/web/browser.js | 10 +++++----- copyparty/web/util.js | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/copyparty/u2idx.py b/copyparty/u2idx.py index ee3a0001..84918d04 100644 --- a/copyparty/u2idx.py +++ b/copyparty/u2idx.py @@ -37,7 +37,11 @@ class U2idx(object): fsize = body["size"] fhash = body["hash"] wark = up2k_wark_from_hashlist(self.args.salt, fsize, fhash) - return self.run_query(vols, "w = ?", [wark], "", [])[0] + + uq = "substr(w,1,16) = ? and w = ?" + uv = [wark[:16], wark] + + return self.run_query(vols, uq, uv, "", [])[0] def get_cur(self, ptop): cur = self.cur.get(ptop) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 91b2b9e6..d36c9cdf 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -590,7 +590,7 @@ function autoplay_blocked() { if (document.querySelector('#srch_form.tags')) sconf.push(["tags", - ["tags", "tags", "tags contains", "46"] + ["tags", "tags", "tags contains   (^=start, end=$)", "46"] ]); var html = []; @@ -654,7 +654,7 @@ function autoplay_blocked() { return; if (this.status !== 200) { - alert('ah fug\n' + this.status + ": " + this.responseText); + alert("http " + this.status + ": " + this.responseText); return; } @@ -729,7 +729,7 @@ function autoplay_blocked() { var treedata = null; var dyn = bcfg_get('dyntree', true); var treesz = icfg_get('treesz', 16); - treesz = isNaN(treesz) ? 16 : Math.min(Math.max(treesz, 4), 50); + treesz = Math.min(Math.max(treesz, 4), 50); console.log('treesz [' + treesz + ']'); function entree(e) { @@ -764,7 +764,7 @@ function autoplay_blocked() { return; if (this.status !== 200) { - alert('ah fug\n' + this.status + ": " + this.responseText); + alert("http " + this.status + ": " + this.responseText); return; } @@ -870,7 +870,7 @@ function autoplay_blocked() { return; if (this.status !== 200) { - alert('ah fug\n' + this.status + ": " + this.responseText); + alert("http " + this.status + ": " + this.responseText); return; } diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 660aa33b..719f608a 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -156,7 +156,7 @@ function opclick(e) { var dest = this.getAttribute('data-dest'); goto(dest); - swrite('opmode', dest || undefined); + swrite('opmode', dest || null); var input = document.querySelector('.opview.act input:not([type="hidden"])') if (input) @@ -262,12 +262,12 @@ function sread(key) { if (window.localStorage) return localStorage.getItem(key); - return ''; + return null; } function swrite(key, val) { if (window.localStorage) { - if (val === undefined) + if (val === undefined || val === null) localStorage.removeItem(key); else localStorage.setItem(key, val); @@ -293,7 +293,7 @@ function icfg_get(name, defval) { var o = ebi(name); var val = parseInt(sread(name)); - if (val === null) + if (isNaN(val)) return parseInt(o ? o.value : defval); if (o)