fix: 总览筛选竞态守卫 + 时间戳统一上海时间序列化
- dashboard loadOverview 加请求令牌:快速切换站点时丢弃过期响应, 防旧数据覆盖与旧 finally 提前清 loading - 后端序列化统一 timezone.localtime:sites.created_at 与 visitors 的 first/last_seen_at、会话 started/ended_at、时间线事件 time—— USE_TZ 下 isoformat() 是 UTC,与上海自然日口径同屏矛盾(差 8 小时) - 站点弹窗域名加轻量主机名正则校验与实时提示(拦含空格等垃圾输入) Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils import timezone
|
||||
from rest_framework.views import APIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.permissions import IsAdminUser
|
||||
@@ -33,9 +34,12 @@ def _to_bool(v) -> bool:
|
||||
|
||||
|
||||
def _serialize(site: Site) -> dict:
|
||||
# USE_TZ=True 下 isoformat() 是 UTC("+00:00"),前端直接切串显示会与
|
||||
# Dashboard 的上海自然日口径同屏矛盾——统一按上海时区序列化。
|
||||
return {"id": site.pk, "name": site.name, "site_id": site.site_id,
|
||||
"domains": site.domains, "allow_no_origin": site.allow_no_origin,
|
||||
"is_active": site.is_active, "created_at": site.created_at.isoformat()}
|
||||
"is_active": site.is_active,
|
||||
"created_at": timezone.localtime(site.created_at).isoformat()}
|
||||
|
||||
|
||||
class SiteListView(EnvelopeMixin, APIView):
|
||||
|
||||
Reference in New Issue
Block a user