diff --git a/app/web/templates/settings.html b/app/web/templates/settings.html index 287ea59..fe531cd 100644 --- a/app/web/templates/settings.html +++ b/app/web/templates/settings.html @@ -27,6 +27,7 @@

{% elif isolarcloud_auth_mode == "oauth2" %}

Checking connection status…

+

1. Open the authorization link below in your own browser, log in with your iSolarCloud account, and approve access.
@@ -254,6 +255,18 @@ async function checkIsolarcloudStatus() { el.textContent = status.connected ? 'Connected -- a valid token is cached.' : 'Not connected yet.'; + + // Only oauth2 mode has the connect-block/reconnect-toggle pair. + const connectBlock = document.getElementById('oauth-connect-block'); + const reconnectToggle = document.getElementById('oauth-reconnect-toggle'); + if (!connectBlock || !reconnectToggle) return; + if (status.connected) { + connectBlock.style.display = 'none'; + reconnectToggle.style.display = 'inline-block'; + } else { + connectBlock.style.display = 'block'; + reconnectToggle.style.display = 'none'; + } } function renderPlantPicker(plants) { @@ -305,6 +318,9 @@ if (oauthAuthorizeLink) { fetch('/api/isolarcloud/oauth/authorize-url').then(r => r.json()).then(data => { oauthAuthorizeLink.href = data.url; }); + document.getElementById('oauth-reconnect-toggle').addEventListener('click', () => { + document.getElementById('oauth-connect-block').style.display = 'block'; + }); document.getElementById('oauth-connect-btn').addEventListener('click', async () => { const flash = document.getElementById('isolarcloud-flash'); let code = document.getElementById('oauth-code-input').value.trim();