mirror of
https://github.com/nikdoof/simple-webfinger.git
synced 2025-12-13 10:22:15 +00:00
Add CORS support
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from urllib.parse import urlparse
|
||||
|
||||
import yaml
|
||||
from flask import Flask, abort, request
|
||||
from flask import Flask, abort, request, Response
|
||||
from prometheus_flask_exporter import PrometheusMetrics
|
||||
|
||||
from simple_webfinger.models.webfinger import JSONResourceDefinition
|
||||
@@ -84,6 +84,11 @@ def create_app(config={}):
|
||||
"No domain is configured for webfinger, this instance will not operate correctly."
|
||||
)
|
||||
|
||||
@app.after_request
|
||||
def inject_cors(response: Response) -> Response:
|
||||
response.headers["Access-Control-Allow-Origin"] = "*"
|
||||
return response
|
||||
|
||||
@app.route("/.well-known/webfinger")
|
||||
def webfinger():
|
||||
resource = request.args.get("resource")
|
||||
|
||||
Reference in New Issue
Block a user