Compare commits
No commits in common. "f3eb905298e5234426a2c296da97050552da36d5" and "456361c5850356b8d01e146aa2665909418343b0" have entirely different histories.
f3eb905298
...
456361c585
2
app.py
2
app.py
|
@ -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, access_log=ACCESS_LOG)
|
app.run(host="0.0.0.0", port=8188, dev=DEV_MODE)
|
||||||
|
|
|
@ -16,8 +16,6 @@ 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"
|
||||||
|
|
|
@ -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 (EXTRA_PRINTS):
|
if (DEV_MODE):
|
||||||
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 EXTRA_PRINTS: print(traceback.format_exc())
|
if DEV_MODE: 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")
|
||||||
|
|
|
@ -124,7 +124,7 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<footer>
|
<footer>
|
||||||
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>
|
Made in 🇮🇹 by <img src="/res/icons/silhouette.svg" class="icon" /> · <a href="/manage/privacy">Privacy</a>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
6
utils.py
6
utils.py
|
@ -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 (EXTRA_PRINTS):
|
if (DEV_MODE):
|
||||||
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 EXTRA_PRINTS:
|
if not itemName and DEV_MODE:
|
||||||
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 EXTRA_PRINTS:
|
if not categoryName and DEV_MODE:
|
||||||
print (type + ' ' + q['id'] + ' has no category set.')
|
print (type + ' ' + q['id'] + ' has no category set.')
|
||||||
return categoryName
|
return categoryName
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue