(filename)
| 1421 | } |
| 1422 | function batchAction(action) { AppState.creds.batchAction(action); } |
| 1423 | function downloadCred(filename) { |
| 1424 | fetch(`./creds/download/${filename}`, { headers: { 'Authorization': `Bearer ${AppState.authToken}` } }) |
| 1425 | .then(r => r.ok ? r.blob() : Promise.reject()) |
| 1426 | .then(blob => { |
| 1427 | const url = window.URL.createObjectURL(blob); |
| 1428 | const a = document.createElement('a'); |
| 1429 | a.href = url; |
| 1430 | a.download = filename; |
| 1431 | a.click(); |
| 1432 | window.URL.revokeObjectURL(url); |
| 1433 | showStatus(`已下载文件: ${filename}`, 'success'); |
| 1434 | }) |
| 1435 | .catch(() => showStatus(`下载失败: ${filename}`, 'error')); |
| 1436 | } |
| 1437 | async function downloadAllCreds() { |
| 1438 | try { |
| 1439 | const response = await fetch('./creds/download-all', { |
nothing calls this directly
no test coverage detected