Socket CORS (#173)
This commit is contained in:
parent
e32ffb6aed
commit
3e8f6ffbb3
631
poetry.lock
generated
631
poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -60,6 +60,7 @@ class App(Base):
|
||||
self.state_manager.setup(state=self.state)
|
||||
|
||||
# Set up the API.
|
||||
|
||||
self.api = FastAPI()
|
||||
self.add_cors()
|
||||
self.add_default_endpoints()
|
||||
@ -93,6 +94,7 @@ class App(Base):
|
||||
self.api.add_middleware(
|
||||
cors.CORSMiddleware,
|
||||
allow_origins=["*"],
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
@ -165,7 +165,7 @@ class Endpoint(Enum):
|
||||
# The event endpoint is a websocket.
|
||||
if self == Endpoint.EVENT:
|
||||
# Replace the protocol with ws.
|
||||
url = url.replace("https://", "ws://").replace("http://", "ws://")
|
||||
url = url.replace("https://", "wss://").replace("http://", "ws://")
|
||||
|
||||
# Return the url.
|
||||
return url
|
||||
|
@ -71,7 +71,7 @@ def run(
|
||||
raise typer.Exit()
|
||||
|
||||
# Check that the template is up to date.
|
||||
if not utils.is_latest_template():
|
||||
if frontend and not utils.is_latest_template():
|
||||
utils.console.print(
|
||||
"[red]The base app template has updated. Run [bold]pc init[/bold] again."
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user