mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 09:22:31 -06:00
rm works
This commit is contained in:
parent
0d634345ac
commit
daa9dedcaa
|
@ -1285,7 +1285,9 @@ class Up2k(object):
|
||||||
adir, fn = os.path.split(atop)
|
adir, fn = os.path.split(atop)
|
||||||
st = bos.lstat(atop)
|
st = bos.lstat(atop)
|
||||||
if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode):
|
if stat.S_ISLNK(st.st_mode) or stat.S_ISREG(st.st_mode):
|
||||||
g = [[os.path.dirname(vpath), adir, [[fn, 0]], [], []]]
|
dbv, vrem = self.asrv.vfs.get(vpath, uname, *permsets[0])
|
||||||
|
dbv, vrem = dbv.get_dbv(vrem)
|
||||||
|
g = [[dbv, vrem, os.path.dirname(vpath), adir, [[fn, 0]], [], []]]
|
||||||
else:
|
else:
|
||||||
scandir = not self.args.no_scandir
|
scandir = not self.args.no_scandir
|
||||||
g = vn.walk("", rem, [], uname, permsets, True, scandir, True)
|
g = vn.walk("", rem, [], uname, permsets, True, scandir, True)
|
||||||
|
@ -1297,9 +1299,7 @@ class Up2k(object):
|
||||||
n_files += 1
|
n_files += 1
|
||||||
abspath = os.path.join(atop, fn)
|
abspath = os.path.join(atop, fn)
|
||||||
vpath = "{}/{}".format(vrem, fn).strip("/")
|
vpath = "{}/{}".format(vrem, fn).strip("/")
|
||||||
self.log("rm file {}\n vpath: {}".format(abspath, vpath))
|
self.log("rm {}\n {}".format(vpath, abspath))
|
||||||
# dbv, vrem = self.asrv.vfs.get(vpath, uname, *permsets[0])
|
|
||||||
# dbv, vrem = dbv.get_dbv(vrem)
|
|
||||||
_ = dbv.get(vrem, uname, *permsets[0])
|
_ = dbv.get(vrem, uname, *permsets[0])
|
||||||
with self.mutex:
|
with self.mutex:
|
||||||
try:
|
try:
|
||||||
|
@ -1482,7 +1482,7 @@ class Up2k(object):
|
||||||
self._symlink(sabs, dabs)
|
self._symlink(sabs, dabs)
|
||||||
full[vp1] = sabs
|
full[vp1] = sabs
|
||||||
|
|
||||||
dvp = vp2 if vp2 else full.keys()[0]
|
dvp = vp2 if vp2 else list(sorted(full.keys()))[0]
|
||||||
dabs = gabs(dvp)
|
dabs = gabs(dvp)
|
||||||
for alink in links.values():
|
for alink in links.values():
|
||||||
self.log("relinking [{}] to [{}]".format(alink, dabs))
|
self.log("relinking [{}] to [{}]".format(alink, dabs))
|
||||||
|
|
|
@ -1507,7 +1507,7 @@ var fileman = (function () {
|
||||||
vps = [];
|
vps = [];
|
||||||
|
|
||||||
for (var a = 0; a < sel.length; a++)
|
for (var a = 0; a < sel.length; a++)
|
||||||
vps.push(sel.vp);
|
vps.push(sel[a].vp);
|
||||||
|
|
||||||
if (!sel.length)
|
if (!sel.length)
|
||||||
return alert('select at least 1 item to delete');
|
return alert('select at least 1 item to delete');
|
||||||
|
@ -1518,7 +1518,33 @@ var fileman = (function () {
|
||||||
if (!confirm('Last chance! Delete?'))
|
if (!confirm('Last chance! Delete?'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
toast.show(vps.length + ' deletes left', 2000);
|
function deleter() {
|
||||||
|
var xhr = new XMLHttpRequest(),
|
||||||
|
vp = vps.shift();
|
||||||
|
|
||||||
|
if (!vp) {
|
||||||
|
toast.show('delete OK', 2000);
|
||||||
|
treectl.goto(get_evpath());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
toast.show('deleting ' + (vps.length + 1) + ' items<br /><br />' + vp, 2000);
|
||||||
|
|
||||||
|
xhr.open('GET', vp + '?delete', true);
|
||||||
|
xhr.onreadystatechange = delete_cb;
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
function delete_cb() {
|
||||||
|
if (this.readyState != XMLHttpRequest.DONE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (this.status !== 200) {
|
||||||
|
var msg = this.responseText;
|
||||||
|
toast.show('delete failed:<br />' + msg, 2000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
deleter();
|
||||||
|
}
|
||||||
|
deleter();
|
||||||
};
|
};
|
||||||
|
|
||||||
r.cut = function (e) {
|
r.cut = function (e) {
|
||||||
|
|
Loading…
Reference in a new issue