MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / handleOutlookBatchImport

Function handleOutlookBatchImport

static/js/settings.js:833–924  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

831
832// Outlook 批量导入
833async function handleOutlookBatchImport() {
834 const data = elements.outlookImportData.value.trim();
835 if (!data) {
836 toast.warning('请输入要导入的数据');
837 return;
838 }
839
840 const enabled = document.getElementById('outlook-import-enabled').checked;
841 const priority = parseInt(document.getElementById('outlook-import-priority').value) || 0;
842
843 // 解析数据
844 const lines = data.split('\n').filter(line => line.trim() && !line.trim().startsWith('#'));
845 const accounts = [];
846 const errors = [];
847
848 lines.forEach((line, index) => {
849 const parts = line.split('----').map(p => p.trim());
850 if (parts.length < 2) {
851 errors.push(`第 ${index + 1} 行格式错误`);
852 return;
853 }
854
855 const account = {
856 email: parts[0],
857 password: parts[1],
858 client_id: parts[2] || null,
859 refresh_token: parts[3] || null,
860 enabled: enabled,
861 priority: priority
862 };
863
864 if (!account.email.includes('@')) {
865 errors.push(`第 ${index + 1} 行邮箱格式错误: ${account.email}`);
866 return;
867 }
868
869 accounts.push(account);
870 });
871
872 if (errors.length > 0) {
873 elements.importResult.style.display = 'block';
874 elements.importResult.innerHTML = `
875 <div class="import-errors">${errors.map(e => `<div>${e}</div>`).join('')}</div>
876 `;
877 return;
878 }
879
880 elements.outlookImportBtn.disabled = true;
881 elements.outlookImportBtn.innerHTML = '<span class="loading-spinner"></span> 导入中...';
882
883 let successCount = 0;
884 let failCount = 0;
885
886 try {
887 for (const account of accounts) {
888 try {
889 await api.post('/email-services', {
890 service_type: 'outlook',

Callers

nothing calls this directly

Calls 6

loadEmailServicesFunction · 0.85
warningMethod · 0.80
successMethod · 0.80
errorMethod · 0.80
filterMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected