mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2025-03-03 14:31:25 +03:00
fix: set utf-8 encoding for config
This commit is contained in:
parent
4f70c6c0e3
commit
52d85edd41
2 changed files with 4 additions and 4 deletions
2
main.py
2
main.py
|
@ -22,7 +22,7 @@ from starlette.responses import FileResponse
|
||||||
from src.middleware.plausible_analytics import PlausibleAnalytics
|
from src.middleware.plausible_analytics import PlausibleAnalytics
|
||||||
from src.routes import index, wallpaper
|
from src.routes import index, wallpaper
|
||||||
|
|
||||||
config = yaml.safe_load(open('config.yaml'))
|
config = yaml.safe_load(open('config.yaml', encoding='utf-8'))
|
||||||
|
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,14 @@ import yaml
|
||||||
import httpx
|
import httpx
|
||||||
from user_agents import parse as ua_parse
|
from user_agents import parse as ua_parse
|
||||||
|
|
||||||
config = yaml.safe_load(open('./config.yaml'))
|
config = yaml.safe_load(open('./config.yaml', encoding='utf-8'))
|
||||||
|
|
||||||
class PlausibleAnalytics:
|
class PlausibleAnalytics:
|
||||||
"""
|
"""
|
||||||
Middleware for sending analytics data to Plausible Analytics
|
Middleware for sending analytics data to Plausible Analytics
|
||||||
after processing each request.
|
after processing each request.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
async def __call__(self, request, call_next):
|
async def __call__(self, request, call_next):
|
||||||
"""
|
"""
|
||||||
Called for each request, sends an event to Plausible with
|
Called for each request, sends an event to Plausible with
|
||||||
|
@ -37,7 +37,7 @@ class PlausibleAnalytics:
|
||||||
Returns:
|
Returns:
|
||||||
Response: FastAPI response object.
|
Response: FastAPI response object.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
response = await call_next(request)
|
response = await call_next(request)
|
||||||
|
|
||||||
user_agent = request.headers.get('user-agent', 'unknown')
|
user_agent = request.headers.get('user-agent', 'unknown')
|
||||||
|
|
Loading…
Add table
Reference in a new issue