Add command to delete all files uploaded by address

This commit is contained in:
Martin Herkt 2017-11-08 11:29:02 +01:00
parent 5608c72e03
commit 0b288d9a94
No known key found for this signature in database
GPG Key ID: C24B9CD04DC6AE7F

View File

@ -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()