diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 2c057277..f837c287 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -2125,6 +2125,7 @@ class HttpCli(object): "taglist": [], "srvinf": srv_info, "acct": self.uname, + "idx": ("e2d" in vn.flags), "perms": perms, "logues": logues, "readme": readme, diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index f701f54c..8b64b097 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -8,13 +8,9 @@ function dbg(msg) { // toolbar ebi('ops').innerHTML = ( '--\n' + - (have_up2k_idx ? ( - 'πŸ”Ž\n' + - (have_del && have_unpost ? '🧯\n' : '') + - 'πŸš€\n' - ) : ( - 'πŸš€\n' - )) + + 'πŸ”Ž\n' + + (have_del && have_unpost ? '🧯\n' : '') + + 'πŸš€\n' + '🎈\n' + 'πŸ“‚\n' + 'πŸ“\n' + @@ -68,12 +64,10 @@ ebi('op_up2k').innerHTML = ( ' \n' + ' \n' + ' \n' + - (have_up2k_idx ? ( - ' \n' + - ' \n' + - ' \n' + - ' \n' - ) : '') + + ' \n' + + ' \n' + + ' \n' + + ' \n' + ' \n' + ' \n' + ' \n' + @@ -1934,10 +1928,6 @@ var fileman = (function () { (function (a) { f[a].inew.onkeydown = function (e) { rn_ok(a, true); - - if (e.key == 'Escape') - return rn_cancel(); - if (e.key == 'Enter') return rn_apply(); }; @@ -2970,6 +2960,9 @@ document.onkeydown = function (e) { if (k == 'Escape') { ae && ae.blur(); + if (ebi('rn_cancel')) + return ebi('rn_cancel').click(); + if (QS('.opview.act')) return QS('#ops>a').click(); @@ -3875,6 +3868,7 @@ var treectl = (function () { r.gentab(this.top, res); acct = res.acct; + have_up2k_idx = res.idx; apply_perms(res.perms); despin('#files'); despin('#gfiles'); @@ -4065,6 +4059,17 @@ function despin(sel) { function apply_perms(newperms) { perms = newperms || []; + var a = QS('#ops a[data-dest="up2k"]'); + if (have_up2k_idx) { + a.removeAttribute('data-perm'); + a.setAttribute('tt', 'up2k: upload files (if you have write-access) or toggle into the search-mode to see if they exist somewhere on the server'); + } + else { + a.setAttribute('data-perm', 'write'); + a.setAttribute('tt', 'up2k: upload files with resume support (close your browser and drop the same files in later)'); + } + tt.att(QS('#ops')); + var axs = [], aclass = '>', chk = ['read', 'write', 'move', 'delete', 'get']; @@ -4094,6 +4099,12 @@ function apply_perms(newperms) { o[a].style.display = display; } + var o = QSA('#ops>a[data-dep], #u2conf td[data-dep]'); + for (var a = 0; a < o.length; a++) + o[a].style.display = ( + o[a].getAttribute('data-dep') != 'idx' || have_up2k_idx + ) ? '' : 'none'; + var act = QS('#ops>a.act'); if (act && act.style.display === 'none') goto(); diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 94212115..b172f056 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -2038,7 +2038,7 @@ function up2k_init(subtle) { new_state = true; fixed = true; } - if (!has(perms, 'read')) { + if (!has(perms, 'read') || !have_up2k_idx) { new_state = false; fixed = true; }