use STARS const

pull/138/head
Aevann 2023-03-06 22:49:01 +02:00
parent aae979066e
commit 2ac830467b
4 changed files with 14 additions and 6 deletions

View File

@ -1063,3 +1063,5 @@ if AEVANN_ID:
GLOBAL = environ.get("GLOBAL", "").strip()
else:
GLOBAL = None
STARS = '\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n'

View File

@ -37,7 +37,9 @@ def media_ratelimit(v):
count = g.db.query(Media).filter(Media.user_id == v.id, Media.created_utc > t).count()
if count > 50:
abort(500)
print(f'\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n@{v.username} hit the 50 files daily limit!\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n', flush=True)
print(STARS, flush=True)
print(f'@{v.username} hit the 50 file daily limit!')
print(STARS, flush=True)
def process_files(files, v, body):
if g.is_tor or not files.get("file"): return body
@ -218,10 +220,10 @@ def process_image(filename:str, v, resize=0, trim=False, uploader_id:Optional[in
i_hash = str(imagehash.phash(i))
if i_hash in hashes.keys():
print(f'\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\nRemove one of these existing duplicates please:\n\n', flush=True)
print(STARS, flush=True)
print(hashes[i_hash], flush=True)
print(img_path, flush=True)
print(f'\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n', flush=True)
print(STARS, flush=True)
else: hashes[i_hash] = img_path
with Image.open(filename) as i:

View File

@ -1407,7 +1407,9 @@ def gumroad():
data = request.values
ip = request.headers.get('CF-Connecting-IP')
if ip != '34.193.146.117':
print(f'\n\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n\n/gumroad fail: {ip}\n\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n\n', flush=True)
print(STARS, flush=True)
print(f'/gumroad fail: {ip}')
print(STARS, flush=True)
abort(400)
id = data['sale_id']

View File

@ -1,3 +1,5 @@
STARS = '\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n'
bind = '0.0.0.0:5000'
worker_class = 'gevent'
@ -13,14 +15,14 @@ def worker_abort(worker):
try:
from flask import g, request
if g and request:
worker.log.warning(f"\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★")
worker.log.warning(STARS)
worker.log.warning(f"While serving {request.method} {request.url}")
u = getattr(g, 'v', None)
if u:
worker.log.warning(f"User: {u.username!r} id:{u.id}")
else:
worker.log.warning(f"User: not logged in")
worker.log.warning(f"\n\n★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★\n\n")
worker.log.warning(STARS)
else:
worker.log.warning("No request info")
except: