From 0b288d9a94df5662d87fa23dc41f04cf5323aeb0 Mon Sep 17 00:00:00 2001 From: Martin Herkt Date: Wed, 8 Nov 2017 11:29:02 +0100 Subject: [PATCH] Add command to delete all files uploaded by address --- fhost.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/fhost.py b/fhost.py index 622298f..02d957a 100755 --- a/fhost.py +++ b/fhost.py @@ -476,6 +476,17 @@ def queryaddr(a, nsfw=False, removed=False): for f in res: f.pprint() +@manager.command +def deladdr(a): + res = File.query.filter_by(addr=a).filter(File.removed != True) + + for f in res: + if os.path.exists(getpath(f.sha256)): + os.remove(getpath(f.sha256)) + f.removed = True + + db.session.commit() + def nsfw_detect(f): try: open(f["path"], 'r').close()