add join clan page
This commit is contained in:
@@ -1,13 +1,24 @@
|
||||
from fastapi import FastAPI
|
||||
from fastapi.routing import APIRoute
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from .assets import asset_path
|
||||
from .routers import health, machines, root, vms
|
||||
|
||||
origins = [
|
||||
"http://localhost:3000",
|
||||
]
|
||||
|
||||
def setup_app() -> FastAPI:
|
||||
app = FastAPI()
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=origins,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
app.include_router(health.router)
|
||||
app.include_router(machines.router)
|
||||
app.include_router(root.router)
|
||||
|
||||
@@ -55,17 +55,25 @@ def start_server(args: argparse.Namespace) -> None:
|
||||
with ExitStack() as stack:
|
||||
headers: list[tuple[str, str]] = []
|
||||
if args.dev:
|
||||
stack.enter_context(spawn_node_dev_server(args.dev_host, args.dev_port))
|
||||
# stack.enter_context(spawn_node_dev_server(args.dev_host, args.dev_port))
|
||||
|
||||
open_url = f"http://{args.dev_host}:{args.dev_port}"
|
||||
host = args.dev_host
|
||||
if ":" in host:
|
||||
host = f"[{host}]"
|
||||
headers = [
|
||||
(
|
||||
"Access-Control-Allow-Origin",
|
||||
f"http://{host}:{args.dev_port}",
|
||||
)
|
||||
# (
|
||||
# "Access-Control-Allow-Origin",
|
||||
# f"http://{host}:{args.dev_port}",
|
||||
# ),
|
||||
# (
|
||||
# "Access-Control-Allow-Methods",
|
||||
# "DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT"
|
||||
# ),
|
||||
# (
|
||||
# "Allow",
|
||||
# "DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT"
|
||||
# )
|
||||
]
|
||||
else:
|
||||
open_url = f"http://[{args.host}]:{args.port}"
|
||||
|
||||
Reference in New Issue
Block a user