()
| 2390 | } |
| 2391 | |
| 2392 | async function deduplicateByEmail() { |
| 2393 | if (!confirm('确定要对凭证进行凭证一键去重吗?\n\n相同邮箱的凭证只保留一个,其他将被删除。\n此操作不可撤销!')) return; |
| 2394 | |
| 2395 | try { |
| 2396 | showStatus('正在进行凭证一键去重...', 'info'); |
| 2397 | const response = await fetch('./creds/deduplicate-by-email', { |
| 2398 | method: 'POST', |
| 2399 | headers: getAuthHeaders() |
| 2400 | }); |
| 2401 | const data = await response.json(); |
| 2402 | if (response.ok) { |
| 2403 | const msg = `去重完成:删除 ${data.deleted_count} 个重复凭证,保留 ${data.kept_count} 个凭证(${data.unique_emails_count} 个唯一邮箱)`; |
| 2404 | showStatus(msg, 'success'); |
| 2405 | await AppState.creds.refresh(); |
| 2406 | |
| 2407 | // 显示详细信息 |
| 2408 | if (data.duplicate_groups && data.duplicate_groups.length > 0) { |
| 2409 | let details = '去重详情:\n\n'; |
| 2410 | data.duplicate_groups.forEach(group => { |
| 2411 | details += `邮箱: ${group.email}\n保留: ${group.kept_file}\n删除: ${group.deleted_files.join(', ')}\n\n`; |
| 2412 | }); |
| 2413 | console.log(details); |
| 2414 | } |
| 2415 | } else { |
| 2416 | showStatus(data.message || '去重失败', 'error'); |
| 2417 | } |
| 2418 | } catch (error) { |
| 2419 | showStatus(`去重网络错误: ${error.message}`, 'error'); |
| 2420 | } |
| 2421 | } |
| 2422 | |
| 2423 | async function deduplicateAntigravityByEmail() { |
| 2424 | if (!confirm('确定要对Antigravity凭证进行凭证一键去重吗?\n\n相同邮箱的凭证只保留一个,其他将被删除。\n此操作不可撤销!')) return; |
nothing calls this directly
no test coverage detected