()
| 2421 | } |
| 2422 | |
| 2423 | async function deduplicateAntigravityByEmail() { |
| 2424 | if (!confirm('确定要对Antigravity凭证进行凭证一键去重吗?\n\n相同邮箱的凭证只保留一个,其他将被删除。\n此操作不可撤销!')) return; |
| 2425 | |
| 2426 | try { |
| 2427 | showStatus('正在进行凭证一键去重...', 'info'); |
| 2428 | const response = await fetch('./creds/deduplicate-by-email?mode=antigravity', { |
| 2429 | method: 'POST', |
| 2430 | headers: getAuthHeaders() |
| 2431 | }); |
| 2432 | const data = await response.json(); |
| 2433 | if (response.ok) { |
| 2434 | const msg = `去重完成:删除 ${data.deleted_count} 个重复凭证,保留 ${data.kept_count} 个凭证(${data.unique_emails_count} 个唯一邮箱)`; |
| 2435 | showStatus(msg, 'success'); |
| 2436 | await AppState.antigravityCreds.refresh(); |
| 2437 | |
| 2438 | // 显示详细信息 |
| 2439 | if (data.duplicate_groups && data.duplicate_groups.length > 0) { |
| 2440 | let details = '去重详情:\n\n'; |
| 2441 | data.duplicate_groups.forEach(group => { |
| 2442 | details += `邮箱: ${group.email}\n保留: ${group.kept_file}\n删除: ${group.deleted_files.join(', ')}\n\n`; |
| 2443 | }); |
| 2444 | console.log(details); |
| 2445 | } |
| 2446 | } else { |
| 2447 | showStatus(data.message || '去重失败', 'error'); |
| 2448 | } |
| 2449 | } catch (error) { |
| 2450 | showStatus(`去重网络错误: ${error.message}`, 'error'); |
| 2451 | } |
| 2452 | } |
| 2453 | |
| 2454 | // ===================================================================== |
| 2455 | // WebSocket日志相关 |
nothing calls this directly
no test coverage detected