mirror of
https://git.0x0.st/mia/0x0.git
synced 2024-11-22 08:57:11 +01:00
Add NSFW filter to address query commands
This commit is contained in:
parent
7bbeb2d144
commit
ebfbc6b153
1 changed files with 7 additions and 4 deletions
11
fhost.py
11
fhost.py
|
@ -459,9 +459,12 @@ def queryhash(h):
|
||||||
query(su.enbase(f.id, 1))
|
query(su.enbase(f.id, 1))
|
||||||
|
|
||||||
@manager.command
|
@manager.command
|
||||||
def queryaddr(a):
|
def queryaddr(a, nsfw=False):
|
||||||
res = File.query.filter_by(addr=a)
|
res = File.query.filter_by(addr=a)
|
||||||
|
|
||||||
|
if nsfw:
|
||||||
|
res = res.filter(File.nsfw_score > app.config["NSFW_THRESHOLD"])
|
||||||
|
|
||||||
for f in res:
|
for f in res:
|
||||||
query(su.enbase(f.id, 1))
|
query(su.enbase(f.id, 1))
|
||||||
|
|
||||||
|
@ -497,15 +500,15 @@ def update_nsfw():
|
||||||
|
|
||||||
|
|
||||||
@manager.command
|
@manager.command
|
||||||
def querybl():
|
def querybl(nsfw=False):
|
||||||
if os.path.isfile(app.config["FHOST_UPLOAD_BLACKLIST"]):
|
if os.path.isfile(app.config["FHOST_UPLOAD_BLACKLIST"]):
|
||||||
with open(app.config["FHOST_UPLOAD_BLACKLIST"], "r") as bl:
|
with open(app.config["FHOST_UPLOAD_BLACKLIST"], "r") as bl:
|
||||||
for l in bl.readlines():
|
for l in bl.readlines():
|
||||||
if not l.startswith("#"):
|
if not l.startswith("#"):
|
||||||
if not ":" in l:
|
if not ":" in l:
|
||||||
queryaddr("::ffff:" + l.rstrip())
|
queryaddr("::ffff:" + l.rstrip(), nsfw)
|
||||||
else:
|
else:
|
||||||
queryaddr(l.strip())
|
queryaddr(l.strip(), nsfw)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
manager.run()
|
manager.run()
|
||||||
|
|
Loading…
Reference in a new issue