forked from MarseyWorld/MarseyWorld
Merge branch 'frost' of https://github.com/Aevann1/rDrama into frost
commit
60dd29bc6b
|
@ -75,6 +75,7 @@ if not path.isfile(f'/site_settings.json'):
|
||||||
|
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def before_request():
|
def before_request():
|
||||||
|
if SITE != 'localhost':
|
||||||
app.config['SESSION_COOKIE_DOMAIN'] = f'.{request.host}'
|
app.config['SESSION_COOKIE_DOMAIN'] = f'.{request.host}'
|
||||||
if request.host == 'marsey.world' and request.path != '/kofi':
|
if request.host == 'marsey.world' and request.path != '/kofi':
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 826 KiB After Width: | Height: | Size: 191 KiB |
Binary file not shown.
Before Width: | Height: | Size: 955 KiB After Width: | Height: | Size: 356 KiB |
Binary file not shown.
Before Width: | Height: | Size: 664 KiB After Width: | Height: | Size: 336 KiB |
|
@ -154,17 +154,13 @@ def process_image(filename=None, resize=0, trim=False, uploader=None, patron=Fal
|
||||||
i.save(filename, format="WEBP", method=6, quality=88)
|
i.save(filename, format="WEBP", method=6, quality=88)
|
||||||
|
|
||||||
|
|
||||||
if resize in (300,400,1200):
|
if resize:
|
||||||
if os.stat(filename).st_size > MAX_IMAGE_SIZE_BANNER_RESIZED_KB * 1024:
|
if os.stat(filename).st_size > MAX_IMAGE_SIZE_BANNER_RESIZED_KB * 1024:
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
abort(413, f"Max size for banners, sidebars, and badges is {MAX_IMAGE_SIZE_BANNER_RESIZED_KB} KB")
|
abort(413, f"Max size for banners, sidebars, and badges is {MAX_IMAGE_SIZE_BANNER_RESIZED_KB} KB")
|
||||||
|
|
||||||
if resize == 1200:
|
if filename.startswith('files/assets/images/'):
|
||||||
path = f'files/assets/images/{SITE_NAME}/banners'
|
path = filename.rsplit('/', 1)[0]
|
||||||
elif resize == 400:
|
|
||||||
path = f'files/assets/images/{SITE_NAME}/sidebar'
|
|
||||||
else:
|
|
||||||
path = f'files/assets/images/badges'
|
|
||||||
|
|
||||||
hashes = {}
|
hashes = {}
|
||||||
|
|
||||||
|
|
|
@ -843,7 +843,7 @@ def agendaposter(user_id, v):
|
||||||
g.db.add(user)
|
g.db.add(user)
|
||||||
|
|
||||||
if days:
|
if days:
|
||||||
days_txt = str(days).rstrip('.0')
|
days_txt = str(days).split('.0')[0]
|
||||||
note = f"for {days_txt} days"
|
note = f"for {days_txt} days"
|
||||||
else: note = "permanently"
|
else: note = "permanently"
|
||||||
|
|
||||||
|
@ -1013,7 +1013,7 @@ def ban_user(user_id, v):
|
||||||
|
|
||||||
duration = "permanently"
|
duration = "permanently"
|
||||||
if days:
|
if days:
|
||||||
days_txt = str(days).rstrip('.0')
|
days_txt = str(days).split('.0')[0]
|
||||||
duration = f"for {days_txt} day"
|
duration = f"for {days_txt} day"
|
||||||
if days != 1: duration += "s"
|
if days != 1: duration += "s"
|
||||||
if reason: text = f"@{v.username} (Admin) has banned you for **{days_txt}** days for the following reason:\n\n> {reason}"
|
if reason: text = f"@{v.username} (Admin) has banned you for **{days_txt}** days for the following reason:\n\n> {reason}"
|
||||||
|
|
|
@ -244,7 +244,7 @@ if SITE not in ('pcmemes.net', 'watchpeopledie.tv'):
|
||||||
|
|
||||||
filename = f'/asset_submissions/hats/{name}.webp'
|
filename = f'/asset_submissions/hats/{name}.webp'
|
||||||
copyfile(highquality, filename)
|
copyfile(highquality, filename)
|
||||||
process_image(filename)
|
process_image(filename, resize=100)
|
||||||
|
|
||||||
hat = HatDef(name=name, author_id=author.id, description=description, price=price, submitter_id=v.id)
|
hat = HatDef(name=name, author_id=author.id, description=description, price=price, submitter_id=v.id)
|
||||||
g.db.add(hat)
|
g.db.add(hat)
|
||||||
|
@ -451,7 +451,7 @@ if SITE not in ('pcmemes.net', 'watchpeopledie.tv'):
|
||||||
|
|
||||||
filename = f"files/assets/images/hats/{name}.webp"
|
filename = f"files/assets/images/hats/{name}.webp"
|
||||||
copyfile(new_path, filename)
|
copyfile(new_path, filename)
|
||||||
process_image(filename)
|
process_image(filename, resize=100)
|
||||||
purge_files_in_cache([f"https://{SITE}/i/hats/{name}.webp", f"https://{SITE}/assets/images/hats/{name}.webp", f"https://{SITE}/asset_submissions/hats/original/{name}.{format}"])
|
purge_files_in_cache([f"https://{SITE}/i/hats/{name}.webp", f"https://{SITE}/assets/images/hats/{name}.webp", f"https://{SITE}/asset_submissions/hats/original/{name}.{format}"])
|
||||||
ma = ModAction(
|
ma = ModAction(
|
||||||
kind="update_hat",
|
kind="update_hat",
|
||||||
|
|
|
@ -480,7 +480,7 @@ def sub_banner(v, sub):
|
||||||
|
|
||||||
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
||||||
file.save(name)
|
file.save(name)
|
||||||
bannerurl = process_image(name, patron=v.patron)
|
bannerurl = process_image(name, patron=v.patron, resize=1200)
|
||||||
|
|
||||||
if bannerurl:
|
if bannerurl:
|
||||||
if sub.bannerurl and '/images/' in sub.bannerurl:
|
if sub.bannerurl and '/images/' in sub.bannerurl:
|
||||||
|
@ -512,7 +512,7 @@ def sub_sidebar(v, sub):
|
||||||
file = request.files["sidebar"]
|
file = request.files["sidebar"]
|
||||||
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
||||||
file.save(name)
|
file.save(name)
|
||||||
sidebarurl = process_image(name, patron=v.patron)
|
sidebarurl = process_image(name, patron=v.patron, resize=400)
|
||||||
|
|
||||||
if sidebarurl:
|
if sidebarurl:
|
||||||
if sub.sidebarurl and '/images/' in sub.sidebarurl:
|
if sub.sidebarurl and '/images/' in sub.sidebarurl:
|
||||||
|
@ -544,7 +544,7 @@ def sub_marsey(v, sub):
|
||||||
file = request.files["marsey"]
|
file = request.files["marsey"]
|
||||||
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
name = f'/images/{time.time()}'.replace('.','') + '.webp'
|
||||||
file.save(name)
|
file.save(name)
|
||||||
marseyurl = process_image(name, patron=v.patron)
|
marseyurl = process_image(name, patron=v.patron, resize=200)
|
||||||
|
|
||||||
if marseyurl:
|
if marseyurl:
|
||||||
if sub.marseyurl and '/images/' in sub.marseyurl:
|
if sub.marseyurl and '/images/' in sub.marseyurl:
|
||||||
|
|
Loading…
Reference in New Issue