()
| 324 | } |
| 325 | |
| 326 | function pollOAuthStatus() { |
| 327 | const interval = setInterval(async () => { |
| 328 | const res = await fetch("/api/oauth/status"); |
| 329 | const { connected } = await res.json(); |
| 330 | if (connected) { |
| 331 | clearInterval(interval); |
| 332 | updateOAuthUI(true); |
| 333 | state.config.oauthConnected = true; |
| 334 | state.restartRequired = true; |
| 335 | updateApiKeyButton(); |
| 336 | refreshWebSocketConnectionPreference(); |
| 337 | setStatus("Connected successfully!", "success"); |
| 338 | updateRestartButton(true); |
| 339 | } |
| 340 | }, 2000); |
| 341 | |
| 342 | // Timeout after 5 minutes |
| 343 | setTimeout(() => clearInterval(interval), 300000); |
| 344 | } |
| 345 | |
| 346 | function updateOAuthUI(connected) { |
| 347 | if (connected) { |
no test coverage detected