0x0

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

commit ebfbc6b153b8e6e4314ce14b4f1fe73c47d9cca2
parent 7bbeb2d1442af00b3dc658af30c442d83cd767c0
Author: Martin Herkt <lachs0r@srsfckn.biz>
Date:   Fri, 27 Oct 2017 08:36:36 +0200

Add NSFW filter to address query commands

Diffstat:
Mfhost.py | 11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fhost.py b/fhost.py @@ -459,9 +459,12 @@ def queryhash(h): query(su.enbase(f.id, 1)) @manager.command -def queryaddr(a): +def queryaddr(a, nsfw=False): res = File.query.filter_by(addr=a) + if nsfw: + res = res.filter(File.nsfw_score > app.config["NSFW_THRESHOLD"]) + for f in res: query(su.enbase(f.id, 1)) @@ -497,15 +500,15 @@ def update_nsfw(): @manager.command -def querybl(): +def querybl(nsfw=False): if os.path.isfile(app.config["FHOST_UPLOAD_BLACKLIST"]): with open(app.config["FHOST_UPLOAD_BLACKLIST"], "r") as bl: for l in bl.readlines(): if not l.startswith("#"): if not ":" in l: - queryaddr("::ffff:" + l.rstrip()) + queryaddr("::ffff:" + l.rstrip(), nsfw) else: - queryaddr(l.strip()) + queryaddr(l.strip(), nsfw) if __name__ == "__main__": manager.run()