chore: 优化本地开发环境配置
- 添加 .env.local 支持,app.sh 和 dev-migrate.sh 自动覆盖 - Docker Compose 使用 profiles 区分 dev/prod 环境 - 改进认证 dev session 判断逻辑,使用 test account 配置 - 修复 CoinPackageCard 重复代码问题 - 清理 opencode 配置,移除敏感信息 - 新增 infra/docker/README.md 文档 - 修复 ruff/pyright/flutter lint 错误 - 更新测试用例移除已删除的 country 字段
This commit is contained in:
@@ -189,8 +189,8 @@ class SensitiveWordSettings(BaseModel):
|
||||
|
||||
|
||||
class TestSettings(BaseModel):
|
||||
phone: str = ""
|
||||
password: str = ""
|
||||
email: str = ""
|
||||
code: str = ""
|
||||
|
||||
|
||||
class TaskiqSettings(BaseModel):
|
||||
|
||||
@@ -78,15 +78,18 @@ class SupabaseAuthGateway(AuthServiceGateway):
|
||||
async def create_email_session(
|
||||
self, request: EmailSessionCreateRequest
|
||||
) -> SessionResponse:
|
||||
if config.runtime.environment == "dev":
|
||||
return await create_dev_email_session(
|
||||
request=request,
|
||||
client=self._get_client(),
|
||||
admin_client=self._get_admin_client(),
|
||||
auth_unavailable_detail=AUTH_UNAVAILABLE_DETAIL,
|
||||
is_auth_upstream_unavailable=_is_auth_upstream_unavailable,
|
||||
map_auth_response=_map_auth_response,
|
||||
)
|
||||
test_email = config.test.email.strip()
|
||||
test_code = config.test.code.strip()
|
||||
if test_email and test_code:
|
||||
if request.email == test_email and request.token == test_code:
|
||||
return await create_dev_email_session(
|
||||
request=request,
|
||||
client=self._get_client(),
|
||||
admin_client=self._get_admin_client(),
|
||||
auth_unavailable_detail=AUTH_UNAVAILABLE_DETAIL,
|
||||
is_auth_upstream_unavailable=_is_auth_upstream_unavailable,
|
||||
map_auth_response=_map_auth_response,
|
||||
)
|
||||
|
||||
client = self._get_client()
|
||||
payload: dict[str, Any] = {
|
||||
|
||||
@@ -434,19 +434,16 @@ class PaymentService:
|
||||
return
|
||||
|
||||
try:
|
||||
import jwt as pyjwt
|
||||
|
||||
parts = signed_payload.split(".")
|
||||
if len(parts) < 2:
|
||||
logger.warning("Malformed Apple notification signed_payload")
|
||||
return
|
||||
|
||||
payload_bytes = parts[1] + "=" * (-len(parts[1]) % 4)
|
||||
import base64
|
||||
|
||||
decoded = base64.urlsafe_b64decode(payload_bytes)
|
||||
import json
|
||||
|
||||
payload_bytes = parts[1] + "=" * (-len(parts[1]) % 4)
|
||||
decoded = base64.urlsafe_b64decode(payload_bytes)
|
||||
notification_data: Any = json.loads(decoded)
|
||||
except Exception:
|
||||
logger.exception("Failed to decode Apple server notification payload")
|
||||
|
||||
@@ -500,9 +500,9 @@ class PointsService:
|
||||
id=str(row.id),
|
||||
direction=row.direction,
|
||||
amount=row.amount,
|
||||
balance_after=row.balance_after,
|
||||
change_type=row.change_type,
|
||||
created_at=row.created_at.isoformat(),
|
||||
balanceAfter=row.balance_after,
|
||||
changeType=row.change_type,
|
||||
createdAt=row.created_at.isoformat(),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user