feat: 别名/屏蔽移到 .env

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-25 18:17:58 +08:00
co-authored by Copilot
parent f7f0e2fb73
commit 520cfd96c7
8 changed files with 347 additions and 273 deletions
+1 -23
View File
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from 'next/server'
import { win32 } from 'path'
import { prisma } from '@/lib/prisma'
import { withCors } from '@/lib/middleware'
import { PROCESS_DISPLAY_NAME_PRESETS } from '@/lib/config'
import { Prisma } from '@prisma/client'
const MAX_GAP_MS = 5 * 60 * 1000
@@ -44,29 +45,6 @@ interface ScreenTimeRecordRow {
path: string | null
}
const PROCESS_DISPLAY_NAME_PRESETS = [
{ match: 'microsoft vs code\\code.exe', displayName: 'Visual Studio Code' },
{ match: 'msedge.exe', displayName: 'Microsoft Edge' },
{ match: 'windowsTerminal.exe', displayName: '终端' },
{ match: 'windowsterminal.exe', displayName: '终端' },
{ match: 'blender.exe', displayName: 'Blender' },
{ match: 'chrome.exe', displayName: 'Google Chrome' },
{ match: 'steamwebhelper.exe', displayName: 'Steam' },
{ match: 'steam.exe', displayName: 'Steam' },
{ match: 'bandizip.exe', displayName: 'Bandizip' },
{ match: 'explorer.exe', displayName: '文件资源管理器' },
{ match: 'devenv.exe', displayName: 'Visual Studio' },
{ match: 'idea64.exe', displayName: 'IntelliJ IDEA' },
{ match: 'pycharm64.exe', displayName: 'PyCharm' },
{ match: 'cursor.exe', displayName: 'Cursor' },
{ match: 'obsidian.exe', displayName: 'Obsidian' },
{ match: 'notion.exe', displayName: 'Notion' },
{ match: 'wechat.exe', displayName: '微信' },
{ match: 'qq.exe', displayName: 'QQ' },
{ match: 'teams.exe', displayName: 'Microsoft Teams' },
{ match: 'telegram.exe', displayName: 'Telegram' }
] as const
const cleanTitle = (title: string) => title.replace(/\s+/g, ' ').trim()
const trimLabelSeparators = (label: string) => label