From f90953d914e6d3d0d989975ea40742027c608455 Mon Sep 17 00:00:00 2001 From: saihgupr <121105543+saihgupr@users.noreply.github.com> Date: Fri, 20 Nov 2026 13:14:23 -0500 Subject: [PATCH 1/3] Prompt for auth before the app loads --- README.md | 4 ++-- homeassistant-version-control/CHANGELOG.md | 5 +++++ homeassistant-version-control/README.md | 4 ++-- homeassistant-version-control/config.json | 4 ++-- homeassistant-version-control/package.json | 2 +- homeassistant-version-control/server.js | 18 ++++++++++++++---- .../tests/api-security.test.mjs | 11 ++++++++--- 7 files changed, 34 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index c0a170a..f43d054 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Home Assistant Version Control provides complete version history for your setup. v1.7 adds API authentication for standalone Docker and cuts idle CPU. -* **API Authentication for Docker:** The standalone container now asks for HTTP Basic auth on `/api/*`. It is on by default there. The username is `havc`, and the password is generated on first start and saved to `/data/api-password`. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to choose your own, or `HAVC_API_AUTH=off` behind an authenticating reverse proxy. The add-on behind Ingress is unchanged. +* **API Authentication for Docker:** The standalone container now asks for HTTP Basic auth before the app loads. It is on by default there. The username is `havc`, and the password is generated on first start and saved to `/data/api-password`. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to choose your own, or `HAVC_API_AUTH=off` behind an authenticating reverse proxy. The add-on behind Ingress is unchanged. * **Lower Idle CPU:** The watcher now ignores files HAVC can never commit, so polling no longer stats dependency folders, model caches, and other large directories. * **Faster Startup Recovery:** A stale `.git/index.lock` is cleared after ten minutes, and startup and watcher retries now share one initialization run instead of racing for the git lock. @@ -161,7 +161,7 @@ There are two ways to install Home Assistant Version Control: as a Home Assistan ### 2. Standalone Docker Installation > [!WARNING] -> The standalone container requires API authentication by default. Requests to `/api/*` need HTTP Basic auth, while static files and the `/` healthcheck stay open. If you don't set `HAVC_PASSWORD`, a password is generated on first start, printed in the container logs as `[auth] API password: ...`, and saved to `/data/api-password` inside the container. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to use your own credentials. Set `HAVC_API_AUTH=off` only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks. +> The standalone container requires API authentication by default. The container asks for HTTP Basic auth before the app loads. The `/healthz` endpoint stays open for the container healthcheck. If you don't set `HAVC_PASSWORD`, a password is generated on first start, printed in the container logs as `[auth] API password: ...`, and saved to `/data/api-password` inside the container. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to use your own credentials. Set `HAVC_API_AUTH=off` only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks.
Click to expand Docker deployment options diff --git a/homeassistant-version-control/CHANGELOG.md b/homeassistant-version-control/CHANGELOG.md index 6960739..0350b71 100644 --- a/homeassistant-version-control/CHANGELOG.md +++ b/homeassistant-version-control/CHANGELOG.md @@ -2,6 +2,11 @@ ## [Unreleased] +## [1.7.1] + +### Fixed & Improved +- **Login Prompt on Mobile:** With API auth enabled, the app now asks for credentials before the interface loads instead of only protecting `/api/*`. Mobile browsers and embedded webviews no longer load a blank panel because they could not show a login dialog for background requests. The container healthcheck moved to the unauthenticated `/healthz` endpoint. + ## [1.7.0] ### Security Hardening diff --git a/homeassistant-version-control/README.md b/homeassistant-version-control/README.md index 54a01ad..3aaa0c2 100644 --- a/homeassistant-version-control/README.md +++ b/homeassistant-version-control/README.md @@ -18,7 +18,7 @@ Home Assistant Version Control provides complete version history for your setup. v1.7 adds API authentication for standalone Docker and cuts idle CPU. -* **API Authentication for Docker:** The standalone container now asks for HTTP Basic auth on `/api/*`. It is on by default there. The username is `havc`, and the password is generated on first start and saved to `/data/api-password`. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to choose your own, or `HAVC_API_AUTH=off` behind an authenticating reverse proxy. The add-on behind Ingress is unchanged. +* **API Authentication for Docker:** The standalone container now asks for HTTP Basic auth before the app loads. It is on by default there. The username is `havc`, and the password is generated on first start and saved to `/data/api-password`. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to choose your own, or `HAVC_API_AUTH=off` behind an authenticating reverse proxy. The add-on behind Ingress is unchanged. * **Lower Idle CPU:** The watcher now ignores files HAVC can never commit, so polling no longer stats dependency folders, model caches, and other large directories. * **Faster Startup Recovery:** A stale `.git/index.lock` is cleared after ten minutes, and startup and watcher retries now share one initialization run instead of racing for the git lock. @@ -162,7 +162,7 @@ There are two ways to install Home Assistant Version Control: as a Home Assistan ### 2. Standalone Docker Installation > [!WARNING] -> The standalone container requires API authentication by default. Requests to `/api/*` need HTTP Basic auth, while static files and the `/` healthcheck stay open. If you don't set `HAVC_PASSWORD`, a password is generated on first start, printed in the container logs as `[auth] API password: ...`, and saved to `/data/api-password` inside the container. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to use your own credentials. Set `HAVC_API_AUTH=off` only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks. +> The standalone container requires API authentication by default. The container asks for HTTP Basic auth before the app loads. The `/healthz` endpoint stays open for the container healthcheck. If you don't set `HAVC_PASSWORD`, a password is generated on first start, printed in the container logs as `[auth] API password: ...`, and saved to `/data/api-password` inside the container. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to use your own credentials. Set `HAVC_API_AUTH=off` only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks. For Docker users who aren't using the Home Assistant app, you have three deployment options: diff --git a/homeassistant-version-control/config.json b/homeassistant-version-control/config.json index 58920a7..c5ff618 100644 --- a/homeassistant-version-control/config.json +++ b/homeassistant-version-control/config.json @@ -1,6 +1,6 @@ { "name": "Home Assistant Version Control", - "version": "1.7.0", + "version": "1.7.1", "slug": "home-assistant-version-control", "description": "Git-powered version control and automated backup for your Home Assistant configuration files.", "url": "https://github.com/saihgupr/HomeAssistantVersionControl", @@ -95,7 +95,7 @@ "CMD", "node", "-e", - "fetch('http://localhost:54001/').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" + "fetch('http://localhost:54001/healthz').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" ], "interval": "5s", "timeout": "3s", diff --git a/homeassistant-version-control/package.json b/homeassistant-version-control/package.json index 76f9de0..cb6b9c1 100644 --- a/homeassistant-version-control/package.json +++ b/homeassistant-version-control/package.json @@ -1,6 +1,6 @@ { "name": "home-assistant-version-control", - "version": "1.7.0", + "version": "1.7.1", "description": "Home Assistant Version Control - Git-powered time travel for your HA config", "main": "server.js", "type": "module", diff --git a/homeassistant-version-control/server.js b/homeassistant-version-control/server.js index 3a52e82..c678359 100644 --- a/homeassistant-version-control/server.js +++ b/homeassistant-version-control/server.js @@ -331,10 +331,20 @@ app.use((req, res, next) => { next(); }); -// API authentication runs after the ingress rewrite above so req.url is -// already stripped of the /api prefix path prefix. It only guards /api:*, -// leaving the SPA, static assets and the root healthcheck reachable. -app.use('/api', basicAuth); +// Container healthcheck. Kept unauthenticated so Docker and the Supervisor +// can verify the app without credentials. It exposes no configuration. +app.get('/healthz', (req, res) => { + res.json({ status: 'ok' }); +}); + +// Authentication runs after the ingress rewrite above. When enabled it guards +// the app itself as well as /api/*, so mobile browsers and embedded webviews +// get a login prompt on the initial page load instead of failing silently on +// the first background API request. +app.use((req, res, next) => { + if (req.path === '/healthz') return next(); + return basicAuth(req, res, next); +}); // Static files - serve public directory at root // Add cache control headers for JSON files to prevent stale translations diff --git a/homeassistant-version-control/tests/api-security.test.mjs b/homeassistant-version-control/tests/api-security.test.mjs index 5eb11d2..71f8ee4 100644 --- a/homeassistant-version-control/tests/api-security.test.mjs +++ b/homeassistant-version-control/tests/api-security.test.mjs @@ -119,7 +119,7 @@ async function waitFor(predicate, timeoutMs, message) { return false; } -test('API requires basic auth and does not protect the SPA', async () => { +test('API and app require basic auth, healthz stays open', async () => { const unauthorized = await fetch(`${base}/app-settings`); assert.equal(unauthorized.status, 401); assert.match(unauthorized.headers.get('www-authenticate') || '', /^Basic\b/); @@ -128,9 +128,14 @@ test('API requires basic auth and does not protect the SPA', async () => { error: 'Authentication required', }); - // Static shell stays reachable without credentials. + // The app itself is protected too, so mobile webviews get a prompt on load. const spa = await fetch(base.replace(/\/api$/, '/')); - assert.equal(spa.status, 200); + assert.equal(spa.status, 401); + + // The container healthcheck stays unauthenticated. + const healthz = await fetch(base.replace(/\/api$/, '/healthz')); + assert.equal(healthz.status, 200); + assert.deepEqual(await healthz.json(), { status: 'ok' }); }); test('wrong credentials are rejected, correct credentials are accepted', async () => { From 58205d07df865ff4223adbd03b655d9db0574797 Mon Sep 17 00:00:00 2001 From: saihgupr <121105543+saihgupr@users.noreply.github.com> Date: Fri, 20 Nov 2026 13:26:47 -0500 Subject: [PATCH 2/3] Add an in-app login for API auth --- README.md | 4 +- homeassistant-version-control/CHANGELOG.md | 2 +- homeassistant-version-control/README.md | 4 +- homeassistant-version-control/public/auth.js | 138 +++++++++++ .../public/css/auth.css | 231 ++++++++++++++++++ .../public/index.html | 17 ++ homeassistant-version-control/server.js | 22 +- .../tests/api-security.test.mjs | 13 +- 8 files changed, 414 insertions(+), 17 deletions(-) create mode 100644 homeassistant-version-control/public/auth.js create mode 100644 homeassistant-version-control/public/css/auth.css diff --git a/README.md b/README.md index f43d054..137fb39 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Home Assistant Version Control provides complete version history for your setup. v1.7 adds API authentication for standalone Docker and cuts idle CPU. -* **API Authentication for Docker:** The standalone container now asks for HTTP Basic auth before the app loads. It is on by default there. The username is `havc`, and the password is generated on first start and saved to `/data/api-password`. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to choose your own, or `HAVC_API_AUTH=off` behind an authenticating reverse proxy. The add-on behind Ingress is unchanged. +* **API Authentication for Docker:** The standalone container now asks for a username and password in the app. It is on by default there. The username is `havc`, and the password is generated on first start and saved to `/data/api-password`. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to choose your own, or `HAVC_API_AUTH=off` behind an authenticating reverse proxy. The add-on behind Ingress is unchanged. * **Lower Idle CPU:** The watcher now ignores files HAVC can never commit, so polling no longer stats dependency folders, model caches, and other large directories. * **Faster Startup Recovery:** A stale `.git/index.lock` is cleared after ten minutes, and startup and watcher retries now share one initialization run instead of racing for the git lock. @@ -161,7 +161,7 @@ There are two ways to install Home Assistant Version Control: as a Home Assistan ### 2. Standalone Docker Installation > [!WARNING] -> The standalone container requires API authentication by default. The container asks for HTTP Basic auth before the app loads. The `/healthz` endpoint stays open for the container healthcheck. If you don't set `HAVC_PASSWORD`, a password is generated on first start, printed in the container logs as `[auth] API password: ...`, and saved to `/data/api-password` inside the container. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to use your own credentials. Set `HAVC_API_AUTH=off` only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks. +> The standalone container requires API authentication by default. The app asks for a username and password when API auth is enabled. The login form works in the Home Assistant Companion app as well as a normal browser. The `/healthz` endpoint stays open for the container healthcheck. If you don't set `HAVC_PASSWORD`, a password is generated on first start, printed in the container logs as `[auth] API password: ...`, and saved to `/data/api-password` inside the container. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to use your own credentials. Set `HAVC_API_AUTH=off` only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks.
Click to expand Docker deployment options diff --git a/homeassistant-version-control/CHANGELOG.md b/homeassistant-version-control/CHANGELOG.md index 0350b71..2455997 100644 --- a/homeassistant-version-control/CHANGELOG.md +++ b/homeassistant-version-control/CHANGELOG.md @@ -5,7 +5,7 @@ ## [1.7.1] ### Fixed & Improved -- **Login Prompt on Mobile:** With API auth enabled, the app now asks for credentials before the interface loads instead of only protecting `/api/*`. Mobile browsers and embedded webviews no longer load a blank panel because they could not show a login dialog for background requests. The container healthcheck moved to the unauthenticated `/healthz` endpoint. +- **In-App Login for API Auth:** When API auth is enabled, the app now shows its own username and password form instead of relying on the browser's HTTP Basic dialog. This works in the Home Assistant Companion app and other embedded webviews, where the native dialog is unavailable. The container healthcheck moved to the unauthenticated `/healthz` endpoint. ## [1.7.0] diff --git a/homeassistant-version-control/README.md b/homeassistant-version-control/README.md index 3aaa0c2..7bd68e9 100644 --- a/homeassistant-version-control/README.md +++ b/homeassistant-version-control/README.md @@ -18,7 +18,7 @@ Home Assistant Version Control provides complete version history for your setup. v1.7 adds API authentication for standalone Docker and cuts idle CPU. -* **API Authentication for Docker:** The standalone container now asks for HTTP Basic auth before the app loads. It is on by default there. The username is `havc`, and the password is generated on first start and saved to `/data/api-password`. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to choose your own, or `HAVC_API_AUTH=off` behind an authenticating reverse proxy. The add-on behind Ingress is unchanged. +* **API Authentication for Docker:** The standalone container now asks for a username and password in the app. It is on by default there. The username is `havc`, and the password is generated on first start and saved to `/data/api-password`. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to choose your own, or `HAVC_API_AUTH=off` behind an authenticating reverse proxy. The add-on behind Ingress is unchanged. * **Lower Idle CPU:** The watcher now ignores files HAVC can never commit, so polling no longer stats dependency folders, model caches, and other large directories. * **Faster Startup Recovery:** A stale `.git/index.lock` is cleared after ten minutes, and startup and watcher retries now share one initialization run instead of racing for the git lock. @@ -162,7 +162,7 @@ There are two ways to install Home Assistant Version Control: as a Home Assistan ### 2. Standalone Docker Installation > [!WARNING] -> The standalone container requires API authentication by default. The container asks for HTTP Basic auth before the app loads. The `/healthz` endpoint stays open for the container healthcheck. If you don't set `HAVC_PASSWORD`, a password is generated on first start, printed in the container logs as `[auth] API password: ...`, and saved to `/data/api-password` inside the container. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to use your own credentials. Set `HAVC_API_AUTH=off` only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks. +> The standalone container requires API authentication by default. The app asks for a username and password when API auth is enabled. The login form works in the Home Assistant Companion app as well as a normal browser. The `/healthz` endpoint stays open for the container healthcheck. If you don't set `HAVC_PASSWORD`, a password is generated on first start, printed in the container logs as `[auth] API password: ...`, and saved to `/data/api-password` inside the container. Set `HAVC_USERNAME` and `HAVC_PASSWORD` to use your own credentials. Set `HAVC_API_AUTH=off` only when an authenticating reverse proxy already sits in front of the container. For internet exposure, keep an authenticating reverse proxy in front and leave the port closed on untrusted networks. For Docker users who aren't using the Home Assistant app, you have three deployment options: diff --git a/homeassistant-version-control/public/auth.js b/homeassistant-version-control/public/auth.js new file mode 100644 index 0000000..e2bf3e5 --- /dev/null +++ b/homeassistant-version-control/public/auth.js @@ -0,0 +1,138 @@ +// In-app login for API auth. +// +// The browser's HTTP Basic dialog works in Safari and desktop browsers, but +// Home Assistant Ingress loads this app inside a frame in the Companion app, +// where iOS does not surface the dialog. This wrapper sends the credentials +// with every API request and shows a form when the server returns 401. +(function () { + 'use strict'; + + const AUTH_KEY = 'havc-api-auth'; + const FAILED_KEY = 'havc-api-auth-failed'; + const DEFAULT_USERNAME = 'havc'; + + function readStorage(key) { + try { + return sessionStorage.getItem(key) || ''; + } catch (error) { + return ''; + } + } + + function writeStorage(key, value) { + try { + sessionStorage.setItem(key, value); + } catch (error) { + // Private mode or a locked-down webview. The form still works for this page. + } + } + + function removeStorage(key) { + try { + sessionStorage.removeItem(key); + } catch (error) { + // Ignore. + } + } + + function getStoredAuth() { + return readStorage(AUTH_KEY); + } + + function isApiRequest(url) { + try { + const path = new URL(url, window.location.href).pathname; + return path === '/api' || path.startsWith('/api/'); + } catch (error) { + return false; + } + } + + function showLogin() { + const overlay = document.getElementById('authOverlay'); + if (!overlay) return; + + const form = document.getElementById('authForm'); + const username = document.getElementById('authUsername'); + const password = document.getElementById('authPassword'); + const errorBox = document.getElementById('authError'); + + overlay.hidden = false; + document.body.classList.add('auth-locked'); + + // Keep the error message across the app's several parallel 401s. Only the + // first call after a failed attempt sets it; later calls leave it alone. + const failed = readStorage(FAILED_KEY) === '1'; + if (failed) { + removeStorage(FAILED_KEY); + if (errorBox) errorBox.textContent = 'Wrong username or password.'; + } + if (username && !username.value) { + username.value = DEFAULT_USERNAME; + } + if (password) { + password.value = ''; + } + + if (form && !form.dataset.authBound) { + form.dataset.authBound = '1'; + form.addEventListener('submit', function (event) { + event.preventDefault(); + + const user = (username && username.value ? username.value : '').trim(); + const pass = password && password.value ? password.value : ''; + + if (!user || !pass) { + if (errorBox) errorBox.textContent = 'Enter a username and password.'; + return; + } + + writeStorage(AUTH_KEY, btoa(user + ':' + pass)); + window.location.reload(); + }); + } + + if (password) { + window.setTimeout(function () { + password.focus(); + }, 50); + } + } + + const nativeFetch = window.fetch.bind(window); + + window.fetch = function (input, init) { + const options = init ? Object.assign({}, init) : {}; + const url = typeof input === 'string' ? input : (input && input.url) || ''; + const apiRequest = isApiRequest(url); + + if (apiRequest) { + const headers = new Headers(options.headers || (input instanceof Request ? input.headers : undefined)); + headers.set('X-Requested-With', 'XMLHttpRequest'); + + const auth = getStoredAuth(); + if (auth) { + headers.set('Authorization', 'Basic ' + auth); + } + options.headers = headers; + } + + return nativeFetch(input, options).then(function (response) { + if (apiRequest && response.status === 401) { + if (getStoredAuth()) { + removeStorage(AUTH_KEY); + writeStorage(FAILED_KEY, '1'); + } + showLogin(); + } + return response; + }); + }; + + window.havcAuth = { + show: showLogin, + clear: function () { + removeStorage(AUTH_KEY); + } + }; +})(); diff --git a/homeassistant-version-control/public/css/auth.css b/homeassistant-version-control/public/css/auth.css new file mode 100644 index 0000000..1e5fbc6 --- /dev/null +++ b/homeassistant-version-control/public/css/auth.css @@ -0,0 +1,231 @@ +/* === In-app sign in === */ +/* Shown when the API returns 401. Home Assistant Ingress runs in an iframe + on iOS, where the native HTTP Basic dialog never appears, so this replaces it. */ + +.auth-overlay { + position: fixed; + inset: 0; + z-index: 20000; + display: flex; + align-items: center; + justify-content: center; + overflow-y: auto; + overflow-x: hidden; + overscroll-behavior: contain; + padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); + /* Soft accent glow over the scrim so the backdrop does not read as flat black */ + background: + radial-gradient(circle at 50% 42%, rgba(59, 130, 246, 0.1), transparent 62%), + rgba(0, 0, 0, 0.72); + -webkit-backdrop-filter: blur(8px); + backdrop-filter: blur(8px); + animation: authOverlayIn 0.18s ease-out; +} + +/* The hidden attribute must win over display: flex */ +.auth-overlay[hidden] { + display: none; +} + +body.auth-locked { + overflow: hidden; +} + +.auth-card { + position: relative; + z-index: 1; + width: 100%; + max-width: 360px; + margin: auto; + padding: 24px; + background: var(--bg-elevated); + border: 1px solid var(--border-subtle); + border-radius: var(--radius-lg); + box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.35); + text-align: left; + animation: authCardIn 0.24s cubic-bezier(0.22, 1, 0.36, 1); +} + +.auth-title { + margin: 0 0 6px; + font-family: inherit; + font-size: 20px; + font-weight: 600; + letter-spacing: -0.02em; + color: var(--text-primary); +} + +.auth-subtitle { + margin: 0 0 18px; + font-size: 13px; + line-height: 1.45; + color: var(--text-secondary); +} + +.auth-label { + display: block; + margin-bottom: 6px; + font-size: 12px; + font-weight: 600; + letter-spacing: 0.02em; + color: var(--text-secondary); +} + +.auth-input { + width: 100%; + box-sizing: border-box; + margin-bottom: 14px; + padding: 10px 12px; + background: var(--bg-secondary); + border: 1px solid var(--border-medium); + border-radius: var(--radius-md); + color: var(--text-primary); + font-family: inherit; + font-size: 16px; /* 16px keeps iOS from zooming the field on focus */ + line-height: 1.4; + -webkit-appearance: none; + appearance: none; + transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease; +} + +.auth-input::placeholder { + color: var(--text-tertiary); +} + +.auth-input:focus { + outline: none; + border-color: var(--accent-primary); + box-shadow: 0 0 0 3px var(--accent-light, rgba(59, 130, 246, 0.15)); +} + +/* Keep autofilled fields inside the dark theme instead of a white block */ +.auth-input:-webkit-autofill, +.auth-input:-webkit-autofill:hover, +.auth-input:-webkit-autofill:focus { + -webkit-text-fill-color: var(--text-primary); + -webkit-box-shadow: 0 0 0 1000px var(--bg-secondary) inset; + caret-color: var(--text-primary); +} + +/* Autofill would otherwise hide the focus ring, so draw both shadows */ +.auth-input:-webkit-autofill:focus { + -webkit-box-shadow: 0 0 0 3px var(--accent-light, rgba(59, 130, 246, 0.15)), 0 0 0 1000px var(--bg-secondary) inset; +} + +.auth-error { + min-height: 18px; + margin: 0 0 12px; + font-size: 13px; + line-height: 1.35; + color: var(--danger, #ef4444); +} + +.auth-submit { + width: 100%; + display: flex; + align-items: center; + justify-content: center; + padding: 11px 16px; + background: var(--accent-primary); + color: #ffffff; + border: 0; + border-radius: var(--radius-md); + font-family: inherit; + font-size: 15px; + font-weight: 600; + letter-spacing: -0.01em; + cursor: pointer; + -webkit-appearance: none; + appearance: none; + -webkit-tap-highlight-color: transparent; + touch-action: manipulation; + transition: background 0.2s ease, filter 0.2s ease, transform 0.1s ease; +} + +.auth-submit:hover { + background: var(--accent-hover); +} + +.auth-submit:active { + background: var(--accent-hover); + transform: scale(0.995); +} + +.auth-submit:focus-visible { + outline: 2px solid var(--accent-primary); + outline-offset: 2px; +} + +.auth-submit:disabled { + background: var(--bg-tertiary); + color: var(--text-tertiary); + cursor: not-allowed; + transform: none; +} + +/* Light mode (body without dark-mode) needs a softer scrim */ +body:not(.dark-mode) .auth-overlay { + background: + radial-gradient(circle at 50% 42%, rgba(37, 99, 235, 0.08), transparent 62%), + rgba(15, 15, 15, 0.35); +} + +body:not(.dark-mode) .auth-card { + box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08); +} + +@keyframes authOverlayIn { + from { + opacity: 0; + } + + to { + opacity: 1; + } +} + +@keyframes authCardIn { + from { + opacity: 0; + transform: translateY(8px) scale(0.985); + } + + to { + opacity: 1; + transform: translateY(0) scale(1); + } +} + +/* Narrow phones (320px wide and below): keep the card inside the viewport */ +@media (max-width: 360px) { + .auth-card { + padding: 20px; + } +} + +/* Short landscape or split view: tighten spacing so nothing gets cut off */ +@media (max-height: 520px) { + .auth-card { + padding: 20px; + } + + .auth-subtitle { + margin-bottom: 12px; + } + + .auth-input { + margin-bottom: 10px; + } +} + +@media (prefers-reduced-motion: reduce) { + + .auth-overlay, + .auth-card { + animation: none; + } + + .auth-submit { + transition: none; + } +} diff --git a/homeassistant-version-control/public/index.html b/homeassistant-version-control/public/index.html index 1126a3e..a4bfa53 100644 --- a/homeassistant-version-control/public/index.html +++ b/homeassistant-version-control/public/index.html @@ -12,6 +12,7 @@ +