allow deux jannies to add badges

master
Aevann1 2022-07-13 14:56:30 +02:00
parent f585597401
commit f7c2befeed
3 changed files with 25 additions and 7 deletions

View File

@ -195,6 +195,24 @@ LOTTERY_TICKET_COST = 12
LOTTERY_SINK_RATE = 3
LOTTERY_DURATION = 60 * 60 * 24 * 7
SIDEBAR_THREAD = 0
BANNER_THREAD = 0
BADGE_THREAD = 0
SNAPPY_THREAD = 0
MARSEY_THREAD = 0
GAMBLING_THREAD = 0
if SITE in ('rdrama.net', 'devrama.xyz'):
SIDEBAR_THREAD = 37696
BANNER_THREAD = 37697
BADGE_THREAD = 37833
SNAPPY_THREAD = 37749
MARSEY_THREAD = 37838
GAMBLING_THREAD = 39413
elif SITE == 'deuxrama.net':
BADGE_THREAD = 142
if SITE in {'rdrama.net', 'devrama.xyz', 'deuxrama.net'}:
HOLE_COST = 50000
HOLE_INACTIVITY_DELETION = True
@ -882,7 +900,7 @@ if path.exists(f'snappy_{snappy_name}.txt'):
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
ADMIGGERS = (37696,37697,37749,37833,37838,39413)
ADMIGGERS = {SIDEBAR_THREAD,BANNER_THREAD,BADGE_THREAD,SNAPPY_THREAD,MARSEY_THREAD,GAMBLING_THREAD}
proxies = {"http":"http://127.0.0.1:18080","https":"http://127.0.0.1:18080"}

View File

@ -53,7 +53,7 @@ def inject_constants():
"AUTOJANNY_ID":AUTOJANNY_ID, "PUSHER_ID":PUSHER_ID,
"CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID,
"PIZZASHILL_ID":PIZZASHILL_ID, "DEFAULT_COLOR":DEFAULT_COLOR,
"COLORS":COLORS, "ADMIGGERS":ADMIGGERS, "time":time,
"COLORS":COLORS, "time":time,
"HOLE_NAME": HOLE_NAME, "HOLE_STYLE_FLAIR": HOLE_STYLE_FLAIR, "HOLE_REQUIRED": HOLE_REQUIRED,
"LOTTERY_ENABLED": LOTTERY_ENABLED, "GUMROAD_LINK": GUMROAD_LINK,
"DEFAULT_THEME": DEFAULT_THEME, "DESCRIPTION": DESCRIPTION, "PERMS": PERMS,

View File

@ -196,21 +196,21 @@ def api_comment(v):
image = process_image(oldname)
if image == "": return {"error":"Image upload failed"}
if v.admin_level > 2 and level == 1:
if parent_post.id == 37696:
if parent_post.id == SIDEBAR_THREAD:
li = sorted(os.listdir(f'files/assets/images/{SITE_NAME}/sidebar'),
key=lambda e: int(e.split('.webp')[0]))[-1]
num = int(li.split('.webp')[0]) + 1
filename = f'files/assets/images/{SITE_NAME}/sidebar/{num}.webp'
copyfile(oldname, filename)
process_image(filename, 400)
elif parent_post.id == 37697:
elif parent_post.id == BANNER_THREAD:
li = sorted(os.listdir(f'files/assets/images/{SITE_NAME}/banners'),
key=lambda e: int(e.split('.webp')[0]))[-1]
num = int(li.split('.webp')[0]) + 1
filename = f'files/assets/images/{SITE_NAME}/banners/{num}.webp'
copyfile(oldname, filename)
process_image(filename)
elif parent_post.id == 37833:
elif parent_post.id == BADGE_THREAD:
try:
badge_def = loads(body)
name = badge_def["name"]
@ -228,7 +228,7 @@ def api_comment(v):
data=f'{{"files": ["https://{request.host}/assets/images/badges/{badge.id}.webp"]}}', timeout=5)
except Exception as e:
return {"error": str(e)}, 400
elif v.admin_level > 2 and parent_post.id == 37838:
elif v.admin_level > 2 and parent_post.id == MARSEY_THREAD:
try:
marsey = loads(body.lower())
@ -277,7 +277,7 @@ def api_comment(v):
body = body.strip()
if v.admin_level > 2 and parent_post.id == 37749 and level == 1:
if v.admin_level > 2 and parent_post.id == SNAPPY_THREAD and level == 1:
with open(f"snappy_{SITE_NAME}.txt", "a", encoding="utf-8") as f:
f.write('\n{[para]}\n' + body)