()
| 4269 | }; |
| 4270 | |
| 4271 | const loadMcpServiceStatus = async () => { |
| 4272 | try { |
| 4273 | const data = await apiGet('/api/pro/gateways/mcp/service/status.php'); |
| 4274 | const svc = data?.service || {}; |
| 4275 | state.mcpService = svc; |
| 4276 | if (mcpSvcListenEl) mcpSvcListenEl.value = String(svc.listenAddr || '127.0.0.1'); |
| 4277 | if (mcpSvcPortEl) mcpSvcPortEl.value = String(svc.port || 3030); |
| 4278 | if (mcpSvcAllowPublicEl) mcpSvcAllowPublicEl.checked = !!svc.allowPublicBind; |
| 4279 | if (mcpSvcAutostartEl) mcpSvcAutostartEl.checked = !!svc.autostart; |
| 4280 | const statusText = svc.running ? tf('gateway_running', 'Running') : tf('gateway_stopped', 'Stopped'); |
| 4281 | const pidText = svc.pid ? ` pid=${svc.pid}` : ''; |
| 4282 | const runtimeMode = String(svc.runtimeMode || '').trim(); |
| 4283 | const runtimeText = runtimeMode ? ` • ${runtimeMode}` : ''; |
| 4284 | const runtimeWarning = String(svc.runtimeWarning || '').trim(); |
| 4285 | const warningText = runtimeWarning ? ` • ${runtimeWarning}` : ''; |
| 4286 | const tone = runtimeWarning ? 'warning' : (svc.running ? 'success' : 'warning'); |
| 4287 | setMcpServiceStatus(`${statusText}${pidText} • ${String(svc.listenAddr || '127.0.0.1')}:${String(svc.port || 3030)}${runtimeText}${warningText}`, tone); |
| 4288 | seedMcpTemplateDefaults(); |
| 4289 | } catch (err) { |
| 4290 | setMcpServiceStatus(err?.message || tf('error', 'Error'), 'danger'); |
| 4291 | } |
| 4292 | }; |
| 4293 | |
| 4294 | const runMcpServiceAction = async (action, extra = {}) => { |
| 4295 | const data = await apiPost('/api/pro/gateways/mcp/service/action.php', { action, ...extra }); |
no test coverage detected