MCPcopy Create free account
hub / github.com/su-kaka/gcli2api / downloadCred

Function downloadCred

front/common.js:1423–1436  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

1421}
1422function batchAction(action) { AppState.creds.batchAction(action); }
1423function 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}
1437async function downloadAllCreds() {
1438 try {
1439 const response = await fetch('./creds/download-all', {

Callers

nothing calls this directly

Calls 1

showStatusFunction · 0.85

Tested by

no test coverage detected