better handling of python builds without sqlite3

This commit is contained in:
ed 2021-11-16 01:13:04 +01:00
parent 223b7af2ce
commit 6efb8b735a
2 changed files with 9 additions and 2 deletions

View file

@ -256,6 +256,7 @@ some improvement ideas
* is it possible to block read-access to folders unless you know the exact URL for a particular file inside? * is it possible to block read-access to folders unless you know the exact URL for a particular file inside?
* yes, using the [`g` permission](#accounts-and-volumes), see the examples there * yes, using the [`g` permission](#accounts-and-volumes), see the examples there
* you can also do this with linux filesystem permissions; `chmod 111 music` will make it possible to access files and folders inside the `music` folder but not list the immediate contents -- also works with other software, not just copyparty
* can I make copyparty download a file to my server if I give it a URL? * can I make copyparty download a file to my server if I give it a URL?
* not officially, but there is a [terrible hack](https://github.com/9001/copyparty/blob/hovudstraum/bin/mtag/wget.py) which makes it possible * not officially, but there is a [terrible hack](https://github.com/9001/copyparty/blob/hovudstraum/bin/mtag/wget.py) which makes it possible

View file

@ -794,6 +794,10 @@ class HttpCli(object):
return True return True
def handle_search(self, body): def handle_search(self, body):
idx = self.conn.get_u2idx()
if not hasattr(idx, "p_end"):
raise Pebkac(500, "sqlite3 is not available on the server; cannot search")
vols = [] vols = []
seen = {} seen = {}
for vtop in self.rvol: for vtop in self.rvol:
@ -805,7 +809,6 @@ class HttpCli(object):
seen[vfs] = True seen[vfs] = True
vols.append([vfs.vpath, vfs.realpath, vfs.flags]) vols.append([vfs.vpath, vfs.realpath, vfs.flags])
idx = self.conn.get_u2idx()
t0 = time.time() t0 = time.time()
if idx.p_end: if idx.p_end:
penalty = 0.7 penalty = 0.7
@ -1830,13 +1833,16 @@ class HttpCli(object):
if not self.args.unpost: if not self.args.unpost:
raise Pebkac(400, "the unpost feature is disabled in server config") raise Pebkac(400, "the unpost feature is disabled in server config")
idx = self.conn.get_u2idx()
if not hasattr(idx, "p_end"):
raise Pebkac(500, "sqlite3 is not available on the server; cannot unpost")
filt = self.uparam.get("filter") filt = self.uparam.get("filter")
lm = "ups [{}]".format(filt) lm = "ups [{}]".format(filt)
self.log(lm) self.log(lm)
ret = [] ret = []
t0 = time.time() t0 = time.time()
idx = self.conn.get_u2idx()
lim = time.time() - self.args.unpost lim = time.time() - self.args.unpost
for vol in self.asrv.vfs.all_vols.values(): for vol in self.asrv.vfs.all_vols.values():
cur = idx.get_cur(vol.realpath) cur = idx.get_cur(vol.realpath)