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

Function handleProxyBatchImport

static/js/settings.js:1094–1131  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1092}
1093
1094async function handleProxyBatchImport(e) {
1095 e.preventDefault();
1096 const content = String(elements.proxyBatchImportText?.value || '').trim();
1097 if (!content) {
1098 toast.warning('请先粘贴代理文本');
1099 return;
1100 }
1101
1102 const submitBtn = document.getElementById('submit-proxy-batch-import-btn');
1103 if (submitBtn) {
1104 submitBtn.disabled = true;
1105 submitBtn.innerHTML = '<span class="loading-spinner"></span> 导入中...';
1106 }
1107
1108 try {
1109 const payload = {
1110 content,
1111 default_type: String(document.getElementById('proxy-batch-default-type')?.value || 'http'),
1112 enabled: Boolean(document.getElementById('proxy-batch-import-enabled')?.checked),
1113 overwrite_existing: Boolean(document.getElementById('proxy-batch-overwrite-existing')?.checked),
1114 };
1115 const result = await api.post('/settings/proxies/batch-import', payload);
1116 renderProxyBatchImportResult(result);
1117 await loadProxies();
1118 if ((result.failed || 0) > 0) {
1119 toast.warning(`导入完成:新增 ${result.created || 0},更新 ${result.updated || 0},失败 ${result.failed || 0}`);
1120 } else {
1121 toast.success(`导入完成:新增 ${result.created || 0},更新 ${result.updated || 0},跳过 ${result.skipped || 0}`);
1122 }
1123 } catch (error) {
1124 toast.error('批量导入失败: ' + error.message);
1125 } finally {
1126 if (submitBtn) {
1127 submitBtn.disabled = false;
1128 submitBtn.textContent = '📥 开始导入';
1129 }
1130 }
1131}
1132
1133// 保存代理
1134async function handleSaveProxyItem(e) {

Callers

nothing calls this directly

Calls 6

loadProxiesFunction · 0.85
warningMethod · 0.80
successMethod · 0.80
errorMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected