mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-22 23:23:55 +08:00
17 lines
520 B
Python
17 lines
520 B
Python
from aiohttp import web
|
|||
|
|
from config.logger import setup_logging
|
||
|
|
|
||
|
|
|
||
|
|
class BaseHandler:
|
||
|
|
def __init__(self, config: dict):
|
||
|
|
self.config = config
|
||
|
|
self.logger = setup_logging()
|
||
|
|
|
||
|
|
def _add_cors_headers(self, response):
|
||
|
|
"""添加CORS头信息"""
|
||
|
|
response.headers["Access-Control-Allow-Headers"] = (
|
||
|
|
"client-id, content-type, device-id"
|
||
|
|
)
|
||
|
|
response.headers["Access-Control-Allow-Credentials"] = "true"
|
||
|
|
response.headers["Access-Control-Allow-Origin"] = "*"
|