(id)
| 1841 | |
| 1842 | // 统一上传入口:弹出目标选择 |
| 1843 | async function uploadAccount(id) { |
| 1844 | const targets = [ |
| 1845 | { label: '☁️ 上传到 CPA', value: 'cpa' }, |
| 1846 | { label: '🔗 上传到 Sub2API', value: 'sub2api' }, |
| 1847 | { label: '🔐 上传到 Codex2API', value: 'codex2api' }, |
| 1848 | ]; |
| 1849 | |
| 1850 | const choice = await new Promise((resolve) => { |
| 1851 | const modal = document.createElement('div'); |
| 1852 | modal.className = 'modal active'; |
| 1853 | modal.innerHTML = ` |
| 1854 | <div class="modal-content" style="max-width:360px;"> |
| 1855 | <div class="modal-header"> |
| 1856 | <h3>☁️ 选择上传目标</h3> |
| 1857 | <button class="modal-close" id="_upload-close">×</button> |
| 1858 | </div> |
| 1859 | <div class="modal-body" style="display:flex;flex-direction:column;gap:8px;"> |
| 1860 | ${targets.map(t => ` |
| 1861 | <button class="btn btn-secondary" data-val="${t.value}" style="text-align:left;">${t.label}</button> |
| 1862 | `).join('')} |
| 1863 | </div> |
| 1864 | </div>`; |
| 1865 | document.body.appendChild(modal); |
| 1866 | modal.querySelector('#_upload-close').addEventListener('click', () => { modal.remove(); resolve(null); }); |
| 1867 | modal.addEventListener('click', (e) => { if (e.target === modal) { modal.remove(); resolve(null); } }); |
| 1868 | modal.querySelectorAll('button[data-val]').forEach(btn => { |
| 1869 | btn.addEventListener('click', () => { modal.remove(); resolve(btn.dataset.val); }); |
| 1870 | }); |
| 1871 | }); |
| 1872 | |
| 1873 | if (!choice) return; |
| 1874 | if (choice === 'cpa') return uploadToCpa(id); |
| 1875 | if (choice === 'sub2api') return uploadToSub2Api(id); |
| 1876 | if (choice === 'codex2api') return uploadToCodex2api(id); |
| 1877 | } |
| 1878 | |
| 1879 | // 上传单个账号到CPA |
| 1880 | async function uploadToCpa(id) { |
nothing calls this directly
no test coverage detected