fix: Add headers to options response
All checks were successful
Build Docker / BuildImage (push) Successful in 38s

This commit is contained in:
Nathan Woodburn 2024-07-10 18:03:43 +10:00
parent 860d070c55
commit 6bf45b9c2b
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -187,7 +187,7 @@ def actionsJson():
} }
]}) ]})
@app.route('/api/donate', methods=['GET','OPTIONS']) @app.route('/api/donate')
def donateAPI(): def donateAPI():
data = { data = {
"icon": "https://nathan.woodburn.au/assets/img/profile.png", "icon": "https://nathan.woodburn.au/assets/img/profile.png",
@ -223,6 +223,46 @@ def donateAPI():
} }
return jsonify(data) return jsonify(data)
@app.route('/api/donate', methods=['OPTIONS'])
def donateOptions():
data = {
"icon": "https://nathan.woodburn.au/assets/img/profile.png",
"label": "Donate to Nathan.Woodburn/",
"title": "Donate to Nathan.Woodburn/",
"description": "Student, developer, and crypto enthusiast",
"links": {
"actions": [
{
"label": "0.01 SOL",
"href": "/api/donate/0.01"
},
{
"label": "0.1 SOL",
"href": "/api/donate/0.1"
},
{
"label": "1 SOL",
"href": "/api/donate/1"
},
{
"href": "/api/donate/{amount}",
"label": "Donate",
"parameters": [
{
"name": "amount",
"label": "Enter a custom SOL amount"
}
]
}
]
}
}
response = make_response(jsonify(data), 200, {'Content-Type': 'application/json'})
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = 'GET, POST, PUT, OPTIONS'
response.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization, Content-Encoding, Accept-Encoding'
return response
@app.route('/api/donate/<amount>') @app.route('/api/donate/<amount>')
def donateAmount(amount): def donateAmount(amount):
data = { data = {