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

Function handleSaveProxyItem

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

Source from the content-addressed store, hash-verified

1132
1133// 保存代理
1134async function handleSaveProxyItem(e) {
1135 e.preventDefault();
1136
1137 const proxyId = document.getElementById('proxy-item-id').value;
1138 const data = {
1139 name: document.getElementById('proxy-item-name').value,
1140 type: document.getElementById('proxy-item-type').value,
1141 host: document.getElementById('proxy-item-host').value,
1142 port: parseInt(document.getElementById('proxy-item-port').value),
1143 username: document.getElementById('proxy-item-username').value || null,
1144 password: document.getElementById('proxy-item-password').value || null,
1145 enabled: true
1146 };
1147
1148 try {
1149 if (proxyId) {
1150 await api.patch(`/settings/proxies/${proxyId}`, data);
1151 toast.success('代理已更新');
1152 } else {
1153 await api.post('/settings/proxies', data);
1154 toast.success('代理已添加');
1155 }
1156 closeProxyModal();
1157 loadProxies();
1158 } catch (error) {
1159 toast.error('保存失败: ' + error.message);
1160 }
1161}
1162
1163// 编辑代理
1164async function editProxyItem(id) {

Callers

nothing calls this directly

Calls 6

closeProxyModalFunction · 0.85
loadProxiesFunction · 0.85
successMethod · 0.80
errorMethod · 0.80
patchMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected