generated from nathanwoodburn/python-webserver-template
feat: Add og image and fix int parsing for blocks
All checks were successful
Build Docker / BuildImage (push) Successful in 2m19s
All checks were successful
Build Docker / BuildImage (push) Successful in 2m19s
This commit is contained in:
@@ -174,6 +174,15 @@ def addNotification(notificationtype: str):
|
||||
|
||||
notification = data
|
||||
|
||||
# Convert blocks to integer
|
||||
try:
|
||||
blocks = int(notification['blocks'])
|
||||
if blocks <= 0:
|
||||
return jsonify({"error": "Blocks must be a positive integer"}), 400
|
||||
except ValueError:
|
||||
return jsonify({"error": "Invalid blocks value"}), 400
|
||||
|
||||
notification['blocks'] = blocks # type: ignore
|
||||
notification['type'] = notificationtype
|
||||
notification['id'] = os.urandom(16).hex() # Generate a random ID for the notification
|
||||
notification['user_name'] = username
|
||||
|
||||
Reference in New Issue
Block a user