| 1260 | // ============== 动态代理设置 ============== |
| 1261 | |
| 1262 | async function handleSaveDynamicProxy(e) { |
| 1263 | e.preventDefault(); |
| 1264 | const data = { |
| 1265 | enabled: document.getElementById('dynamic-proxy-enabled').checked, |
| 1266 | api_url: document.getElementById('dynamic-proxy-api-url').value.trim(), |
| 1267 | api_key: document.getElementById('dynamic-proxy-api-key').value || null, |
| 1268 | api_key_header: document.getElementById('dynamic-proxy-api-key-header').value.trim() || 'X-API-Key', |
| 1269 | result_field: document.getElementById('dynamic-proxy-result-field').value.trim() |
| 1270 | }; |
| 1271 | try { |
| 1272 | await api.post('/settings/proxy/dynamic', data); |
| 1273 | toast.success('动态代理设置已保存'); |
| 1274 | document.getElementById('dynamic-proxy-api-key').value = ''; |
| 1275 | } catch (error) { |
| 1276 | toast.error('保存失败: ' + error.message); |
| 1277 | } |
| 1278 | } |
| 1279 | |
| 1280 | async function handleTestDynamicProxy() { |
| 1281 | const apiUrl = document.getElementById('dynamic-proxy-api-url').value.trim(); |