Compare commits

..

2 Commits

Author SHA1 Message Date
Stranck f3eb905298 Updated footer credits 2024-01-11 18:44:48 +01:00
Stranck dafe98dfbb Updated prints 2024-01-11 18:15:56 +01:00
5 changed files with 9 additions and 7 deletions

2
app.py
View File

@ -176,4 +176,4 @@ async def logour(request):
raise exceptions.Forbidden("You have been logged out.") raise exceptions.Forbidden("You have been logged out.")
if __name__ == "__main__": if __name__ == "__main__":
app.run(host="0.0.0.0", port=8188, dev=DEV_MODE) app.run(host="0.0.0.0", port=8188, dev=DEV_MODE, access_log=ACCESS_LOG)

View File

@ -16,6 +16,8 @@ FILL_CACHE = True
CACHE_EXPIRE_TIME = 60 * 60 * 4 CACHE_EXPIRE_TIME = 60 * 60 * 4
DEV_MODE = True DEV_MODE = True
ACCESS_LOG = True
EXTRA_PRINTS = True
# Metadata property for item-id mapping # Metadata property for item-id mapping
METADATA_NAME = "item_name" METADATA_NAME = "item_name"

View File

@ -12,7 +12,7 @@ bp = Blueprint("propic", url_prefix="/manage/propic")
async def resetDefaultPropic(request, order: Order, isFursuiter, sendAnswer=True): async def resetDefaultPropic(request, order: Order, isFursuiter, sendAnswer=True):
s = "_fursuiter" if isFursuiter else "" s = "_fursuiter" if isFursuiter else ""
if (DEV_MODE): if (EXTRA_PRINTS):
print("Resetting {fn} picture for {orderCod}".format(fn="Badge" if not isFursuiter else "fursuit", orderCod = order.code)) print("Resetting {fn} picture for {orderCod}".format(fn="Badge" if not isFursuiter else "fursuit", orderCod = order.code))
with open("res/propic/default.png", "rb") as f: with open("res/propic/default.png", "rb") as f:
data = f.read() data = f.read()
@ -100,7 +100,7 @@ async def upload_propic(request, order: Order):
await order.edit_answer_fileUpload(f'{fn}_file', f'{fn}_file_{order.code}.jpg', 'image/jpeg', imgBytes) await order.edit_answer_fileUpload(f'{fn}_file', f'{fn}_file_{order.code}.jpg', 'image/jpeg', imgBytes)
except Exception: except Exception:
import traceback import traceback
if DEV_MODE: print(traceback.format_exc()) if EXTRA_PRINTS: print(traceback.format_exc())
raise exceptions.BadRequest(errorDetails if errorDetails else "The image you uploaded is not valid.") raise exceptions.BadRequest(errorDetails if errorDetails else "The image you uploaded is not valid.")
else: else:
await order.edit_answer(fn, f"{fn}_{order.code}.jpg") await order.edit_answer(fn, f"{fn}_{order.code}.jpg")

View File

@ -124,7 +124,7 @@
}); });
</script> </script>
<footer> <footer>
Made in 🇮🇹 by <img src="/res/icons/silhouette.svg" class="icon" /> · <a href="/manage/privacy">Privacy</a> Made in 🇮🇹 by <a href="https://lab.foxo.me"><img src="/res/icons/silhouette.svg" class="icon" /></a> and maintained by <a href="https://twitter.com/stranckV2">Stranck</a> and <a href="https://about.woffo.ovh/">DrewThaWoof</a><br><a href="/manage/privacy">Privacy</a>
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -73,7 +73,7 @@ async def loadItems():
categoryName = checkAndGetCategory ('item', q) categoryName = checkAndGetCategory ('item', q)
if not categoryName: continue if not categoryName: continue
CATEGORIES_LIST_MAP[categoryName].append(q['id']) CATEGORIES_LIST_MAP[categoryName].append(q['id'])
if (DEV_MODE): if (EXTRA_PRINTS):
print (f'Mapped Items:') print (f'Mapped Items:')
print (ITEMS_ID_MAP) print (ITEMS_ID_MAP)
print (f'Mapped Variations:') print (f'Mapped Variations:')
@ -86,13 +86,13 @@ async def loadItems():
# Tries to get an item name from metadata. Prints a warning if an item has no metadata # Tries to get an item name from metadata. Prints a warning if an item has no metadata
def checkAndGetName(type, q): def checkAndGetName(type, q):
itemName = extractMetadataName(q) itemName = extractMetadataName(q)
if not itemName and DEV_MODE: if not itemName and EXTRA_PRINTS:
print (type + ' ' + q['id'] + ' has not been mapped.') print (type + ' ' + q['id'] + ' has not been mapped.')
return itemName return itemName
def checkAndGetCategory (type, q): def checkAndGetCategory (type, q):
categoryName = extractCategory (q) categoryName = extractCategory (q)
if not categoryName and DEV_MODE: if not categoryName and EXTRA_PRINTS:
print (type + ' ' + q['id'] + ' has no category set.') print (type + ' ' + q['id'] + ' has no category set.')
return categoryName return categoryName