From 75fd737baa692d90521198e312c4938f455479cc Mon Sep 17 00:00:00 2001 From: Ed Date: Mon, 8 May 2023 22:08:44 +0200 Subject: [PATCH] Added support for propic expiration --- propic.py | 6 +++++- tpl/blocks/badge.html | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/propic.py b/propic.py index cc62c84..88e6244 100644 --- a/propic.py +++ b/propic.py @@ -2,12 +2,13 @@ from sanic.response import html, redirect, text from sanic import Blueprint, exceptions from random import choice from ext import * -from config import headers +from config import headers, PROPIC_DEADLINE from PIL import Image from os.path import isfile from os import unlink from io import BytesIO from hashlib import sha224 +from time import time bp = Blueprint("propic", url_prefix="/manage/propic") @@ -17,6 +18,9 @@ async def upload_propic(request, order: Order): if order.propic_locked: raise exceptions.BadRequest("You have been limited from further editing the propic.") + + if time() > PROPIC_DEADLINE: + raise exceptions.BadRequest("You are beyond the file upload deadline. No more changes are allowed.") if request.form.get('submit') == 'Delete main image': await order.edit_answer('propic', None) diff --git a/tpl/blocks/badge.html b/tpl/blocks/badge.html index c7d69ab..92fe1ef 100644 --- a/tpl/blocks/badge.html +++ b/tpl/blocks/badge.html @@ -35,7 +35,7 @@ {% if time() > PROPIC_DEADLINE %} -

⚠️ The deadline to upload pictures for the badge has expired. For last-minute changes, please contact the support over at info@furizon.net. If your badge has been printed already, changing it will incur in a 2€ fee.

+

⚠️ The deadline to upload pictures for the badge has expired. For last-minute changes, please contact the support over at info@furizon.net. If your badge has been printed already, changing it will incur in a 2€ fee. You can also get extra badges at the reception for the same price.

{% else %}

Min size: 64x64 - Max Size: 5MB, 2048x2048 - Formats: jpg, png