mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-05 20:28:23 +00:00
fmt
This commit is contained in:
@@ -516,6 +516,7 @@ async def redeem(cashu_token: str, lnurl: str) -> int:
|
||||
"amount": amount,
|
||||
"unit": unit,
|
||||
"lnurl_preview": lnurl[:20] + "..." if len(lnurl) > 20 else lnurl,
|
||||
"transaction_result": str(result),
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
import re
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
|
||||
from pythonjsonlogger import jsonlogger
|
||||
|
||||
|
||||
@@ -68,8 +69,8 @@ class SecurityFilter(logging.Filter):
|
||||
patterns = [
|
||||
rf"{key}[:\s=]+([a-zA-Z0-9_\-\.]+)", # key: value or key=value
|
||||
rf'{key}[:\s=]+["\']([^"\']+)["\']', # key: "value" or key='value'
|
||||
rf"Bearer\s+([a-zA-Z0-9_\-\.]+)", # Bearer token
|
||||
rf"cashu[A-Z]+([a-zA-Z0-9_\-\.=/+]+)", # Cashu tokens
|
||||
r"Bearer\s+([a-zA-Z0-9_\-\.]+)", # Bearer token
|
||||
r"cashu[A-Z]+([a-zA-Z0-9_\-\.=/+]+)", # Cashu tokens
|
||||
]
|
||||
|
||||
for pattern in patterns:
|
||||
|
||||
@@ -259,6 +259,13 @@ async def handle_streaming_response(
|
||||
},
|
||||
)
|
||||
|
||||
# Initialize response headers early so they can be modified during processing
|
||||
response_headers = dict(response.headers)
|
||||
if "transfer-encoding" in response_headers:
|
||||
del response_headers["transfer-encoding"]
|
||||
if "content-encoding" in response_headers:
|
||||
del response_headers["content-encoding"]
|
||||
|
||||
# For streaming responses, we'll extract the final usage data
|
||||
# and calculate cost based on that
|
||||
usage_data = None
|
||||
@@ -342,12 +349,6 @@ async def handle_streaming_response(
|
||||
},
|
||||
)
|
||||
|
||||
response_headers = dict(response.headers)
|
||||
if "transfer-encoding" in response_headers:
|
||||
del response_headers["transfer-encoding"]
|
||||
if "content-encoding" in response_headers:
|
||||
del response_headers["content-encoding"]
|
||||
|
||||
async def generate() -> AsyncGenerator[bytes, None]:
|
||||
for line in lines:
|
||||
yield (line + "\n").encode("utf-8")
|
||||
|
||||
Reference in New Issue
Block a user