feat: 事件详情页 URL ID 加密,防止用户遍历

- 新增 idEncoder.ts 工具:使用 Base64 + 前缀混淆加密 ID
- 路由改为查询参数形式:/event-detail?id=xxx
- 更新所有入口使用 getEventDetailUrl() 生成加密链接
- 兼容旧链接:纯数字 ID 仍可正常访问

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
zdl
2025-12-04 18:26:01 +08:00
parent 6cf92b6851
commit f64c1ffb19
7 changed files with 94 additions and 45 deletions

View File

@@ -19,6 +19,7 @@ import { notificationMetricsService } from '../services/notificationMetricsServi
import { notificationHistoryService } from '../services/notificationHistoryService';
import { PRIORITY_LEVELS, NOTIFICATION_CONFIG, NOTIFICATION_TYPES } from '../constants/notificationTypes';
import { usePermissionGuide, GUIDE_TYPES } from '../hooks/usePermissionGuide';
import { getEventDetailUrl } from '@/utils/idEncoder';
// 连接状态枚举
const CONNECTION_STATUS = {
@@ -460,7 +461,7 @@ export const NotificationProvider = ({ children }) => {
timestamp: Date.now(),
isAIGenerated: event.is_ai_generated || false,
clickable: true,
link: `/event-detail/${event.id}`,
link: getEventDetailUrl(event.id),
autoClose: autoClose,
extra: {
eventId: event.id,