Allow multiple CORS origins (#2031)

* Permit cmd override for CORS modification

* Enable multiple origins for CORS

* Remove CMD_OVERRIDE

* Revert executable bit change

* Defensively convert list into string

* Bad if statement

* Retry rebase

* Retry rebase

Co-authored-by: Chris Dawson <chris@vivoh.com>
This commit is contained in:
Chris Dawson 2023-01-04 14:26:42 -05:00 committed by GitHub
parent 5d69bd408b
commit 91eb84c5d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,7 +85,14 @@ class InvokeAIWebServer:
}
if opt.cors:
socketio_args["cors_allowed_origins"] = opt.cors
_cors = opt.cors
# convert list back into comma-separated string,
# be defensive here, not sure in what form this arrives
if isinstance(_cors, list):
_cors = ",".join(_cors)
if "," in _cors:
_cors = _cors.split(",")
socketio_args["cors_allowed_origins"] = _cors
frontend_path = self.find_frontend()
self.app = Flask(