mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-10 04:02:17 +00:00
Add CORS header on JSON responses only
This commit is contained in:
parent
b33e8ae6d1
commit
aedda4f642
@ -101,14 +101,6 @@ def get_client_prefs():
|
||||
|
||||
request.client = client
|
||||
|
||||
@app.after_request
|
||||
def set_headers(response):
|
||||
if not request.path.startswith('/rest/'):
|
||||
return response
|
||||
|
||||
response.headers['Access-Control-Allow-Origin'] = '*'
|
||||
return response
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found(error):
|
||||
if not request.path.startswith('/rest/'):
|
||||
|
@ -83,7 +83,9 @@ def value_tostring(value):
|
||||
return str(value)
|
||||
|
||||
def make_json_response(response, error = False):
|
||||
return jsonify(subsonicify(response, error))
|
||||
rv = jsonify(subsonicify(response, error))
|
||||
rv.headers.add('Access-Control-Allow-Origin', '*')
|
||||
return rv
|
||||
|
||||
def make_jsonp_response(response, callback, error = False):
|
||||
if not callback:
|
||||
|
Loading…
Reference in New Issue
Block a user