Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Complete account settings and authenticated permission onboarding

webadderallc3bc809a1f56
diff --git a/docs/authentication.md b/docs/authentication.md
index 96e7b30b..a4b1462f 100644
--- a/docs/authentication.md
+++ b/docs/authentication.md
@@ -1,6 +1,12 @@
# Recordly authentication setup
-Recordly uses Supabase Auth for one shared session across email/password and Google. The desktop application uses PKCE and returns from the system browser through a loopback callback in development and `recordly://auth/callback` in production. X is shown in the sign-in dialog and requires its provider to be enabled in Supabase. SAML is intentionally hidden until configured.
+Recordly requires a non-anonymous Supabase Auth session before onboarding can advance to permissions or recording can start. The sign-in dialog uses email magic links and whichever of Google, Microsoft, or GitHub OAuth are enabled in the configured project; there is no guest or local demo login. Sessions persist across app restarts. The desktop application uses PKCE and returns from the system browser through a loopback callback in development and `recordly://auth/callback` in production. The dialog reads `/auth/v1/settings` and shows only enabled OAuth providers. SAML is intentionally hidden until configured.
+
+## Account and permission settings
+
+**Settings → Account** is available in both the editor and Projects dashboard. Display-name changes update Supabase user metadata and refresh the account avatar everywhere. Email changes use Supabase's email confirmation flow and the same desktop PKCE callback as sign-in; the existing email stays active until confirmation completes. Pending email changes are shown after reopening Settings. Connected sign-in methods reflect the user's actual account identities. Sign out clears the local session, revokes refresh sessions on all devices, and brings back mandatory sign-in; local projects remain on disk.
+
+**Settings → Permissions** shows live macOS Screen Recording and Accessibility statuses, refreshes when the app regains focus, and links to the onboarding permission setup. Microphone and camera permission requests remain tied to enabling those devices for recording. On other platforms, capture selection remains part of starting a recording.
## 1. Create the project
@@ -9,7 +15,7 @@ Recordly uses Supabase Auth for one shared session across email/password and Goo
3. Copy `.env.example` to `.env.local` and fill in both values. Never use the service-role key in the desktop application.
4. In **Authentication → URL configuration**, add `recordly://auth/callback` and `http://127.0.0.1:43821/auth/callback` to the redirect allow list.
-Email/password works once email authentication is enabled and a user has been created. Password-reset emails use the same desktop callback.
+Enable email authentication and allow new sign-ups for magic links. Request the email from Recordly, then open it on the same computer with Recordly running. Configure production SMTP as described in `services/supabase/EMAIL_SETUP.md`.
## 2. Google
@@ -18,11 +24,9 @@ Email/password works once email authentication is enabled and a user has been cr
3. Enable Google under **Supabase → Authentication → Sign In / Providers** and paste the Google client ID and secret.
4. Keep the requested scopes to `openid`, email, and profile unless Recordly genuinely needs more.
-## 3. X
+## 3. Microsoft and GitHub
-1. Create an OAuth 2.0 app in the X Developer Dashboard and enable requesting the user's email.
-2. Set its callback URL to `https://YOUR_PROJECT_REF.supabase.co/auth/v1/callback`.
-3. Enable X/Twitter OAuth 2.0 in Supabase and paste the client ID and secret.
+Enable Azure and GitHub under **Authentication → Sign In / Providers**, supply their client credentials, and use `https://YOUR_PROJECT_REF.supabase.co/auth/v1/callback` as the provider callback. Microsoft sign-in requests the `email` scope.
## 4. SAML SSO (currently hidden)
@@ -38,15 +42,19 @@ SAML is configured per customer workspace. Supabase's SAML support requires Pro
--domains customer.example
```
-The Recordly modal extracts the domain from the entered email address and starts the matching SAML connection.
+The auth helper supports extracting a work email domain for SAML; this option is currently hidden in the modal.
## 5. Verify locally
Restart `npm run dev` after creating `.env.local`. Open an editor and verify:
-1. The account button opens **Sign into Recordly**.
-2. Email/password creates a persistent Supabase session.
-3. Google opens the system browser and returns to Recordly.
-4. Clicking **Create link** while signed out opens this modal; after successful authentication it continues to the share dialog.
+1. Without a session, **Welcome to Recordly** opens and cannot be skipped or dismissed.
+2. Request an email magic link. Sending the email alone must not grant access. Opening the link exchanges its PKCE code for a persistent Supabase session and advances to **Permissions**.
+3. OAuth opens the system browser and returns to Recordly through the same callback.
+4. On Permissions, **Start recording** opens the recording controls after required system permissions are granted.
+5. Restart the app to verify session restoration. Sign out from the account dialog and verify that mandatory sign-in returns.
+6. **Show onboarding** opens Permissions directly for signed-in users. The recording HUD also checks for a Supabase session before preparing a recording.
+
+Automated UI tests use an isolated Supabase URL and mocked Auth HTTP responses; no production auth bypass is enabled in development or tests.
Add the same `SUPABASE_URL` and `SUPABASE_PUBLISHABLE_KEY` values to the share Worker's secrets or variables. Set `OWNER_USER_ID` to the owner’s Supabase user ID. The Worker validates the access token with Supabase and requires that owner identity before accepting API requests. `API_SECRET` is server-side only and remains available for library administration and explicitly enabled local integration tests; it is never entered into or exposed by the desktop app.
diff --git a/electron/ipc/cloudShareContract.ts b/electron/ipc/cloudShareContract.ts
index 00b44bd0..d8dfc8d7 100644
--- a/electron/ipc/cloudShareContract.ts
+++ b/electron/ipc/cloudShareContract.ts
@@ -9,6 +9,7 @@ export type CloudShareTicket = {
const TRUSTED_SHARE_ORIGINS = new Set([
"https://videos.recordly.dev",
+ "https://recordly-share-staging.youngchen3442.workers.dev",
"http://localhost:8787",
"http://127.0.0.1:8787",
]);
diff --git a/electron/ipc/register/cloudShare.test.ts b/electron/ipc/register/cloudShare.test.ts
index 394e6685..3346e9b4 100644
--- a/electron/ipc/register/cloudShare.test.ts
+++ b/electron/ipc/register/cloudShare.test.ts
@@ -6,7 +6,12 @@ import {
} from "../cloudShareContract";
describe("cloud share contract", () => {
- it("accepts only Recordly production and local development endpoints", () => {
+ it("accepts only Recordly production, isolated staging, and local development endpoints", () => {
+ expect(
+ normalizeCloudEndpoint(
+ "https://recordly-share-staging.youngchen3442.workers.dev/api/upload",
+ ),
+ ).toBe("https://recordly-share-staging.youngchen3442.workers.dev/api/upload");
expect(normalizeCloudEndpoint("https://videos.recordly.dev/api/upload#ignored")).toBe(
"https://videos.recordly.dev/api/upload",
);
@@ -33,6 +38,14 @@ describe("cloud share contract", () => {
});
it("rejects insecure and untrusted remote endpoints", () => {
+ expect(() =>
+ normalizeCloudEndpoint("https://other.youngchen3442.workers.dev/api/upload"),
+ ).toThrow("only allowed through the Recordly service");
+ expect(() =>
+ normalizeCloudEndpoint(
+ "https://recordly-share-staging.youngchen3442.workers.dev.attacker.example/api/upload",
+ ),
+ ).toThrow("only allowed through the Recordly service");
expect(() => normalizeCloudEndpoint("https://untrusted.example.test/api/upload")).toThrow(
"only allowed through the Recordly service",
);
diff --git a/electron/native/bin/darwin-arm64/recordly-native-cursor-monitor b/electron/native/bin/darwin-arm64/recordly-native-cursor-monitor
index 192f8719..99f3555a 100755
Binary files a/electron/native/bin/darwin-arm64/recordly-native-cursor-monitor and b/electron/native/bin/darwin-arm64/recordly-native-cursor-monitor differ
diff --git a/electron/native/bin/darwin-arm64/recordly-screencapturekit-helper b/electron/native/bin/darwin-arm64/recordly-screencapturekit-helper
index 54835c5a..b34ba7c3 100755
Binary files a/electron/native/bin/darwin-arm64/recordly-screencapturekit-helper and b/electron/native/bin/darwin-arm64/recordly-screencapturekit-helper differ
diff --git a/electron/native/bin/darwin-arm64/recordly-system-cursors b/electron/native/bin/darwin-arm64/recordly-system-cursors
index a51c8e1a..c3cfed07 100755
Binary files a/electron/native/bin/darwin-arm64/recordly-system-cursors and b/electron/native/bin/darwin-arm64/recordly-system-cursors differ
diff --git a/electron/native/bin/darwin-arm64/recordly-window-list b/electron/native/bin/darwin-arm64/recordly-window-list
index d8028716..a0779592 100755
Binary files a/electron/native/bin/darwin-arm64/recordly-window-list and b/electron/native/bin/darwin-arm64/recordly-window-list differ
diff --git a/electron/native/bin/darwin-x64/recordly-native-cursor-monitor b/electron/native/bin/darwin-x64/recordly-native-cursor-monitor
index b375827a..b7c380f4 100755
Binary files a/electron/native/bin/darwin-x64/recordly-native-cursor-monitor and b/electron/native/bin/darwin-x64/recordly-native-cursor-monitor differ
diff --git a/electron/native/bin/darwin-x64/recordly-screencapturekit-helper b/electron/native/bin/darwin-x64/recordly-screencapturekit-helper
index 1a05cf27..17e171ef 100755
Binary files a/electron/native/bin/darwin-x64/recordly-screencapturekit-helper and b/electron/native/bin/darwin-x64/recordly-screencapturekit-helper differ
diff --git a/electron/native/bin/darwin-x64/recordly-system-cursors b/electron/native/bin/darwin-x64/recordly-system-cursors
index d7852055..a89e6df4 100755
Binary files a/electron/native/bin/darwin-x64/recordly-system-cursors and b/electron/native/bin/darwin-x64/recordly-system-cursors differ
diff --git a/electron/native/bin/darwin-x64/recordly-window-list b/electron/native/bin/darwin-x64/recordly-window-list
index 85d6ef65..c2db47eb 100755
Binary files a/electron/native/bin/darwin-x64/recordly-window-list and b/electron/native/bin/darwin-x64/recordly-window-list differ
diff --git a/playwright.config.ts b/playwright.config.ts
index a264222e..34932abb 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -8,9 +8,13 @@ export default defineConfig({
trace: "retain-on-failure",
},
webServer: {
- env: { RECORDLY_RENDERER_ONLY: "1" },
+ env: {
+ RECORDLY_RENDERER_ONLY: "1",
+ VITE_SUPABASE_URL: "https://auth.recordly.test",
+ VITE_SUPABASE_PUBLISHABLE_KEY: "sb_publishable_ui_test",
+ },
command: "npx vite --host 127.0.0.1 --port 5178 --strictPort",
url: "http://127.0.0.1:5178",
- reuseExistingServer: !process.env.CI,
+ reuseExistingServer: false,
},
});
diff --git a/services/recordly-share/worker/STAGING.md b/services/recordly-share/worker/STAGING.md
new file mode 100644
index 00000000..f9248258
--- /dev/null
+++ b/services/recordly-share/worker/STAGING.md
@@ -0,0 +1,90 @@
+# Cloudflare staging
+
+Provisioned on 2026-09-23 in account `b000d832666fb4eb4bc63df58fecbb11`:
+
+- D1: `recordly-share-staging-db`, ID `1d930cc5-644f-4b29-932d-ef75257b2f8c`.
+- R2: `recordly-videos-staging`, Standard storage, automatically placed in Oceania. Public access is disabled; the bucket is empty.
+- D1 initialized using `schema.sql`. Verified tables: chapters, comment_sessions, comment_users, comments, password_attempts, reactions, transcript_segments, videos. No customer data inserted.
+
+The owner-approved staging Worker is deployed at `https://recordly-share-staging.youngchen3442.workers.dev`, version `81cf4abb-5703-4f4c-b74b-54ff428009d7`. Existing `landingvideos` storage and DNS were not changed. Wrangler uses an approved OAuth grant limited to account/user read, Worker-script write, and background access; no DNS/zone/D1 write scopes were granted.
+
+## Local validation
+
+Use `wrangler.staging.jsonc` explicitly. The default self-host configuration is unchanged. The owner approved an isolated public staging deployment on 2026-09-23. Staging enables workers.dev but disables preview URLs, custom-domain routes and API-secret uploads. The ignored `.wrangler/staging-deploy.json` includes the existing Supabase URL and publishable key; no service-role key is used. The deployment is live. Use `--experimental-provision=false` with Wrangler 4.99.0: existing resources are already configured and verified, so automatic provisioning is unnecessary and requires additional R2 permissions. The local-only `service_binding_extra_handlers` flag must not be included in deployments.
+
+From this directory, build the web assets if needed, then validate the Worker without publishing:
+
+```sh
+npm --prefix web run build
+npx wrangler deploy --dry-run --experimental-provision=false --config wrangler.staging.jsonc --outdir /tmp/recordly-share-staging-build
+```
+
+## Environment separation
+
+Production should use separate resources. The local development endpoint now points to staging through ignored `.env.development.local`; packaged production configuration is unchanged. The desktop trusts only this exact staging origin alongside its existing origins. Payments remain a later step.
+
+## Deployed hosted behavior
+
+`HOSTED_MODE=true` selects the multi-account path. Staging opts into it; existing self-host configurations keep their current behavior. Hosted mode validates the bearer with Supabase, requires a confirmed email and a non-anonymous user, and ignores shared API secrets/dashboard cookies. Legacy comment account and shared-password dashboard routes are disabled in hosted mode.
+
+Schema v4 / migration `0008_recording_owners.sql` adds nullable `videos.owner_id` and its index. Existing unowned rows remain inaccessible to hosted users; no ownership is guessed or backfilled. Runtime migration supports existing v3 databases. The remote staging database received migrations 0008 and 0009 through its console on 2026-09-23. Verified owner column = 1, upload tracking tables = 2, recordings = 0. These manual changes are not registered in Wrangler migration history. Do not blindly rerun the ALTER migration.
+
+Recording creation binds the owner from the verified session, never the request body. One atomic conditional insert caps each owner at five stored rows, including pending and expired rows. Explicit owner deletion frees a slot. Library/view queries are scoped; all upload, metadata, renew, and delete routes check ownership before handling storage. Public share-link playback remains intentional.
+
+Validation: all 83 local Worker tests passed, including all nine mutation routes against a different account, unowned-row isolation, five-slot concurrent reservations, slot release after deletion, and legacy migration/self-host regressions.
+
+## Upload limits and cleanup
+
+Hosted mode caps recordings at the owner-approved 1 GB (1,000,000,000 bytes), five stored rows per account, and thumbnails at 2 MiB. The limit is enforced on reservation and actual streamed bytes using FixedLengthStream. Direct uploads are capped at 50 MiB; multipart uses the desktop's fixed 25 MiB chunks with a bounded final chunk and an exact manifest. Transfers time out after five minutes. Completed objects are checked before publication and cannot be overwritten.
+
+Schema v5 / `0009_upload_sessions.sql` adds `recording_uploads` and `recording_locks`. Multipart starts are idempotent, supplied upload IDs must match the stored session, and record mutations are serialized across isolates. Deletion aborts multipart sessions and removes R2 objects before freeing the slot; storage failures keep the row for retry. Metadata payloads and transcript/chapter counts are bounded, and retrying publication does not duplicate transcript rows.
+
+Cleanup code removes unfinished reservations older than 24 hours and recordings whose 14-day free-plan expiry has elapsed, in batches of 100. It rechecks eligibility under the mutation lock and recovers crash locks older than one day. **The owner explicitly approved automatic staging cleanup. Deployed hourly at minute 17 UTC (`17 * * * *`), removing expired recordings and unfinished reservations older than 24 hours.** Verified in the R2 dashboard on 2026-09-23: the enabled Default Multipart Abort Rule aborts unfinished multipart uploads after seven days, across the bucket. This covers orphaned sessions left by a crash between R2 creation and D1 persistence. Public R2 access remains disabled and no custom domain is assigned. No lifecycle mutation was needed.
+
+Hosted mode requires native Worker rate-limit bindings: 120 requests/minute per IP before auth/storage, and 60 requests/minute per verified account. These are permissive per-location abuse controls, not an exact global spend cap. The five-slot reservation remains atomic in D1. Staging namespaces are `2026092301` and `2026092302`; production must use distinct namespaces. References: [Cloudflare rate limits](https://developers.cloudflare.com/workers/runtime-apis/bindings/rate-limit/) and [FixedLengthStream](https://developers.cloudflare.com/workers/runtime-apis/streams/transformstream/).
+
+## Desktop and verification
+
+The share dialog now has a HeroUI recordings manager with pending-upload visibility and explicit delete confirmation. It calls authenticated main-process IPC, which validates trusted origins and forbids redirects. `VITE_CLOUD_SHARE_ENDPOINT` controls the endpoint; development falls back to localhost, while packaged builds fail clearly until configured. UI preview at `tests/ui/shared-recordings.html` uses disposable in-memory data only; expansion, confirmation, and deletion/slot count were checked in the browser.
+
+A local backend is running at `127.0.0.1:8787` with isolated D1/R2 state under `/tmp/recordly-hosted-test-state` and the app's existing public Supabase configuration. Its generated config is ignored under `.wrangler/hosted-local.json`. No service-role key is used. Live unsigned health requests returned 401. The local server is no longer the development app endpoint. A fresh owner-approved magic-link request was followed by a signed-in native app session, and the real staging library loaded successfully as zero of five recordings. The owner-approved disposable native upload/playback/delete test subsequently passed.
+
+Latest validation: 83 Worker tests, 12 auth/desktop contract tests, TypeScript checking, and staging deployment dry run passed. Deliberately truncated streams and injected storage failures emit expected runtime diagnostics in negative tests.
+
+## Remaining external steps
+
+1. Verify an authenticated feedback submission. Owner sign-in and native staging upload/playback/deletion are verified.
+2. Free links expire after 14 days and hourly staging cleanup is deployed. Configure usage alerts before launch. The R2 bucket already aborts incomplete multipart uploads after seven days.
+3. Plan separate production resources, verify another-account isolation live, and configure production builds before release. Payments remain last.
+
+## Staging deployment verification (2026-09-23)
+
+- Deployed with existing D1/R2 bindings, Supabase public auth settings, owner allowlist, and both native rate-limit bindings. No service-role key was supplied.
+- Live unsigned `/api/health` and `/api/videos` return 401 with `Verified sign-in required`; an invalid bearer also returns 401. Legacy `/library` and `/auth/register` return 404. These checks exercise remote D1 schema initialization without creating recordings.
+- The exact staging origin was added to the desktop allowlist. Six desktop contract tests passed, including rejection of a sibling workers.dev origin and a lookalike hostname. TypeScript checking passed.
+- Fixed a development startup failure by explicitly prebundling React Aria's CommonJS `use-sync-external-store/shim` dependency. Verified the native HUD, project dashboard, and sign-in form render again.
+- The user approved one fresh magic-link email to their existing owner account for the desktop callback test. Do not substitute a dashboard-generated link or extract session credentials.
+
+The Home dashboard Shared tab now uses the real HeroUI recordings manager with refresh, quota usage, open-share controls, and explicit deletion confirmation. Verified visually in the signed-in native app: `0 of 5 recordings · 1 GB each`, `No shared recordings yet.` No existing project was uploaded.
+
+## Native end-to-end test passed (2026-09-23)
+
+The owner approved uploading a generated two-second 1920×1080 colour-pattern source and deleting its disposable cloud recording. Imported `/tmp/recordly-staging-test-20260923.mp4`, named the local project **Disposable staging test**, and published through the normal desktop share flow. The selected High export setting produced 1554×972 video with the editor's default 16:10 canvas; this was not a full-resolution 1080p output or a 1 GB stress test.
+
+The public share page rendered the correct title and decoded all two seconds (`ended=true`, no video error). The signed-in library showed one of five slots and a 1.4 MB recording. Deleted only that approved disposable cloud recording through its confirmation UI. The library returned to zero of five, and reloading its public link showed **Recording unavailable**. The local synthetic project/source remain for repeat testing. No user recording was uploaded or deleted.
+
+Still unverified live: large multipart uploads, 1 GB boundary under real network conditions, another-account rejection, feedback diagnostics/attachments, and packaged desktop protocol callbacks. Local boundary/concurrency/isolation tests are documented above. Free-plan links expire after 14 days. The next successful hourly cleanup removes stored objects and releases slots, in batches of 100; cleanup backlog or storage failures may delay this.
+
+## Free-plan expiry policy (2026-09-23)
+
+The owner selected 14 days. New hosted upload reservations get a server-assigned expiry 14 days from creation. All hosted accounts currently use the free policy; client-supplied plan/expiry claims are ignored. Paid entitlements are not wired yet. Free renewal is denied (403) to prevent indefinite extensions. The separate self-host mode keeps its existing 30-day setting. Desktop publishing and library copy disclose the free-plan expiry. Twenty-seven hosted/library tests passed, including expiry, renewal bypass prevention, expired playback denial, and self-host regressions.
+
+The 14-day policy was deployed successfully to staging as version `2a38fbd4-a3c9-4028-a5ca-68a32b95a60a`.
+
+## Publish UI and cleanup (2026-09-23)
+
+The desktop toolbar now opens **Publish**, with HeroUI Link/Local choices. Link expands inline notes and Share using Motion (Framer Motion's `motion/react` package) and reduced-motion support. Local retains export settings and save flow. Share preparation no longer closes the popover; busy sharing disables destination switching and dismissal while preserving cancellation. Native UI inspection verified both modes and the complete notes/expiry disclosure layout.
+
+Hourly cleanup was explicitly approved after automatic approval review required separate confirmation for permanent cloud deletion. Deployed version `81cf4abb-5703-4f4c-b74b-54ff428009d7`; Wrangler confirmed `17 * * * *`. The scheduled handler now reports failures to Cloudflare instead of swallowing them. Local scheduler tests verify expired bytes/rows are deleted while active recordings remain. 28 Worker tests and 15 export/feedback tests passed, plus TypeScript checking. A real scheduled run has not yet been observed.
+
+The shared player now uses uploaded first-frame posters and falls back to the video’s decoded first frame when an older recording has no poster. Deployed to staging on 2026-09-23; Framer and custom domains are unchanged.
diff --git a/services/recordly-share/worker/wrangler.staging.jsonc b/services/recordly-share/worker/wrangler.staging.jsonc
new file mode 100644
index 00000000..92b74968
--- /dev/null
+++ b/services/recordly-share/worker/wrangler.staging.jsonc
@@ -0,0 +1,28 @@
+{
+ // Owner-approved isolated staging endpoint; no custom-domain routes.
+ "$schema": "./node_modules/wrangler/config-schema.json",
+ "name": "recordly-share-staging",
+ "account_id": "b000d832666fb4eb4bc63df58fecbb11",
+ "main": "src/index.js",
+ "compatibility_date": "2024-11-01",
+ "workers_dev": true,
+ "preview_urls": false,
+ "routes": [],
+ "assets": {
+ "directory": "./web/dist",
+ "binding": "ASSETS",
+ "run_worker_first": true
+ },
+ "d1_databases": [{
+ "binding": "DB",
+ "database_name": "recordly-share-staging-db",
+ "database_id": "1d930cc5-644f-4b29-932d-ef75257b2f8c"
+ }],
+ "r2_buckets": [{
+ "binding": "VIDEOS_BUCKET",
+ "bucket_name": "recordly-videos-staging"
+ }],
+ "vars": { "ALLOW_API_SECRET_UPLOADS": "false", "HOSTED_MODE": "true", "STAGING_ALLOWED_USER_ID": "5053639f-395a-4435-a0fa-c394cf14f51f" },
+ "ratelimits": [{"name": "REQUEST_RATE_LIMIT", "namespace_id": "2026092301", "simple": {"limit": 120, "period": 60}}, {"name": "ACCOUNT_RATE_LIMIT", "namespace_id": "2026092302", "simple": {"limit": 60, "period": 60}}],
+ "triggers": { "crons": ["17 * * * *"] }
+}
diff --git a/services/supabase/EMAIL_SETUP.md b/services/supabase/EMAIL_SETUP.md
new file mode 100644
index 00000000..399aaad1
--- /dev/null
+++ b/services/supabase/EMAIL_SETUP.md
@@ -0,0 +1,37 @@
+# Authentication email setup
+
+Completed provider connection on 2026-09-23. Resend marks the domain Verified. Supabase custom SMTP was saved and confirmed enabled after reloading the dashboard. Delivery test passed: Supabase sent one authorized magic-link email to the owner, and Resend reported Delivered. This verifies SMTP delivery, not completion of the desktop authentication callback.
+
+- Provider: Resend.
+- Sending domain: `auth.recordly.dev` (verified by Resend).
+- Configured sender: `Recordly <[email protected]>`.
+- SMTP: `smtp.resend.com`, TLS port `465`, username `resend`.
+- Credential: a sending-only Resend API key restricted to this sending domain, stored only in Supabase SMTP. Created as `Recordly Supabase Auth SMTP`, with Sending access restricted to `auth.recordly.dev`. The secret is not stored in this repository.
+
+Resend's required DNS records (names relative to `recordly.dev`):
+
+| Type | Name | Value | Proxy |
+| --- | --- | --- | --- |
+| TXT | `resend._domainkey.auth` | `p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzbtnuzzRFKTpkxRjKRWPA7QC6lBekq9BXBddPA6CSlXxfdS1aDFqHWZvawSzp4ZmZ4qtzRA8s4tqtRHxmgwBYiI21/OWKY96UcMqrU9o7nWpqfdMsrl4SXB/4/c+eBo3+hdg7DPnPIB/98EB3bPojIXba+PLDbY8URVCopuNHLQIDAQAB` | N/A |
+| CNAME | `rsend.auth` | `rsend-apne1.forge.rmta.net` | DNS only |
+| CNAME | `send.auth` | `send.forge.rmta.net` | DNS only |
+
+The DKIM value is a public verification key, not a private credential. Use automatic TTLs. Receiving is disabled. Do not add the optional root DMARC record as part of this setup.
+
+Verified these names were unused before adding them in Cloudflare DNS. Existing root A records, `www` -> `sites.framer.app`, `marketplace`, and `media` remain untouched. This configuration does not host the website on Cloudflare or reroute incoming email.
+
+Supabase settings: custom SMTP enabled, port 465, minimum per-user interval 60 seconds. The dashboard states that enabling custom SMTP sets the email rate limit to 30/hour; higher launch volume requires reviewing both providers' limits. Sender, name, host, and enabled state persisted after reload. One owner-authorized authentication email was sent and marked Delivered by Resend (subject: Your Magic Link). No password was changed. Full signup/recovery completion also depends on the desktop flows.
+
+Reference: https://resend.com/docs/send-with-supabase-smtp
+
+## Magic-link follow-up
+
+The dashboard-issued delivery test fell back to `http://localhost:3000`. It did not originate from the desktop's PKCE client, so it cannot verify desktop login. The fallback remains unchanged pending the intended production destination.
+
+The local sign-in dialog now offers **Email me a sign-in link** for new and existing accounts. Signup uses the same inbox-verification flow; the production UI no longer offers password reset or the unconfigured Microsoft provider. It uses the existing PKCE client and explicitly requests `http://127.0.0.1:43821/auth/callback` in development or `recordly://auth/callback` in packaged builds. Request and open the link on the same computer with Recordly running. Six auth unit tests and TypeScript checking passed; a fresh email from the updated app and successful session exchange remain unverified. No desktop release was published.
+
+The live magic-link email was restyled and verified after dashboard reload on 2026-09-23. Subject: **Your sign-in link for Recordly**. Source: `templates/magic-link.html`; it preserves Supabase's `{{ .ConfirmationURL }}`. The signup confirmation template was also updated to `templates/confirm-sign-up.html`, subject **Verify your email for Recordly**. The recovery template was not changed.
+
+## Desktop verification (2026-09-23)
+
+After the owner approved a fresh magic link, it was requested through the native Recordly sign-in form. The app subsequently displayed the real owner account, and its authenticated request to the deployed staging library succeeded with zero recordings. This verifies a working desktop session and backend token validation; packaged `recordly://` callbacks still need a release-build test.
diff --git a/services/supabase/README.md b/services/supabase/README.md
index d9a88ba4..ac9e5cd5 100644
--- a/services/supabase/README.md
+++ b/services/supabase/README.md
@@ -1,5 +1,7 @@
# Desktop feedback
+See [setup status](SETUP.md) for the applied project configuration, verification, and remaining launch work.
+
Before releasing feedback submission:
1. Apply `migrations/202609230001_feedback.sql` and then `migrations/202609230002_feedback_limits.sql` in the configured Supabase project. Apply `migrations/202610030001_feedback_access.sql` after both, including on existing deployments; it revokes inherited client table privileges while preserving owner reads and server inserts.
diff --git a/services/supabase/SETUP.md b/services/supabase/SETUP.md
new file mode 100644
index 00000000..6b784bb9
--- /dev/null
+++ b/services/supabase/SETUP.md
@@ -0,0 +1,48 @@
+# Supabase setup status
+
+Verified 2026-09-23 in project `kgmqmaivltdolfzjrjjs` (Recordly).
+
+Restored on 2026-10-08: `kgmqmaivltdolfzjrjjs.supabase.co` initially returned NXDOMAIN because the dashboard-confirmed Recordly project was paused. Resumed the existing project through Supabase Studio; it now reports Healthy. Verified HTTP 200 from Auth settings using the existing publishable key, HTTP 200 from a zero-row database read, and a PKCE Google authorization request redirecting to Google with HTTP 302. Email and Google are enabled; Azure and GitHub are disabled. The dialog now reads Auth settings and offers only enabled OAuth providers. The desktop loopback callback listener responds on port 43821. No real sign-in email was sent or new app session created in this verification; a fresh owner sign-in remains the final manual check. Local authentication tests use isolated mocked Supabase responses.
+
+## Applied
+
+Both `202609230001_feedback.sql` and `202609230002_feedback_limits.sql` were applied through the SQL editor, each inside a transaction. Do not rerun these create-only migrations against this project. They are not registered in Supabase CLI migration history.
+
+- `feedback_reports` and `feedback_daily_usage` have row-level security enabled.
+- Signed-in clients can read only their own reports and attachments. Direct report inserts and attachment uploads are blocked; clients cannot alter quotas or call the quota reservation function.
+- `feedback-attachments` is private, with a 10,485,760-byte per-object limit.
+- `submit-feedback` is deployed at `https://kgmqmaivltdolfzjrjjs.supabase.co/functions/v1/submit-feedback`. The deployed browser-editor files use the repository's `index.ts` and `handler.ts` logic, with formatting differences.
+- The function verifies each bearer token through Supabase `auth.getUser` before processing the body. The legacy-secret gateway JWT check is off so modern user tokens can reach this verification. Server credentials stay in built-in function environment variables.
+- Limits: five nonempty files and 10 MB total per submission; per account per UTC day, 10 attempts, 25 files, and 50 MB. Failed attempts consume reserved quota.
+
+## Verification
+
+- All 13 local feedback server, client, and diagnostics tests passed.
+- Live SQL checks passed for owner isolation and anonymous denial before migration 002. Baseline script: `checks/feedback-access.sql` (only for migration 001, which allowed direct owner inserts).
+- After migration 002, live checks passed for server-only quota access, blocked direct-upload policies, per-report bounds, and all three daily quotas. Script: `checks/feedback-quota-access.sql`. All test data was rolled back; no auth users were created.
+- Live HTTP POSTs with no token and a deliberately invalid token both returned `401` with `SIGN_IN_REQUIRED` from the deployed function.
+- A successful signed-in desktop submission with a real file has not yet been tested. Storage upload and report insertion end to end remain a release check.
+
+Existing `wallpapers`, `user_limits`, `users`, `favorites`, and `moderation_queue` tables were preserved. All five already had RLS enabled. No custom triggers on `auth.users` were found. Existing user data was not changed.
+
+## Authentication observations
+
+- Email sign-in and Google are enabled. Microsoft/Azure and SAML are disabled.
+- New signups and email confirmation are enabled. Anonymous sign-ins and manual identity linking are disabled.
+- Redirect allowlist: `recordly://auth/callback`, `recordly-dev://auth/callback`, `http://127.0.0.1:43821/auth/callback`.
+- Default site URL remains `http://localhost:3000`; choose the intended production fallback before launch.
+- Resend SMTP is connected and confirmed enabled after reload. `auth.recordly.dev` is verified; the sender is `Recordly <[email protected]>`. The key has sending-only access restricted to this domain and is stored only in Supabase SMTP. An owner-authorized magic-link email was sent through Supabase and reported Delivered by Resend. See `EMAIL_SETUP.md`.
+- CAPTCHA and leaked-password protection are disabled. Enabling CAPTCHA also requires client integration; do not toggle it without implementing the client flow.
+
+The local desktop app already referenced this Supabase project before setup. Its current feedback client calls the deployed `submit-feedback` function. No landing page was connected and no desktop release was published.
+
+## Remaining launch work
+
+1. SMTP delivery has passed an owner-authorized magic-link test. Review rate limits for launch volume; successful inbox delivery does not complete the desktop callback/recovery tests.
+2. Test app-initiated email signup/sign-in and Google login end to end. The local UI uses magic links for both signup and sign-in. Verify Azure and GitHub provider configuration before enabling those sign-in options for release. Email templates are saved live; the app changes are not released.
+3. Decide the production fallback URL. The UI requires a Supabase session and offers Google, Microsoft, GitHub, and email magic links. There is no local demo or guest login.
+4. Verify a real desktop feedback submission. Add cleanup for interrupted uploads and old quota rows through the appropriate server-side APIs.
+5. Cloud recording ownership, five-slot quotas, byte limits, cleanup code, and management UI are implemented locally; the private staging schema is migrated. Complete real-account and protected staging tests before deployment. See `../recordly-share/worker/STAGING.md`.
+6. Configure payments after these foundations and the planned frontend changes.
+
+Only three approved email DNS records under `auth.recordly.dev` were added. Framer hosting, root/www DNS, marketplace, media, Google provider credentials, and payment settings are unchanged. Cloudflare's recording Worker remains undeployed.
diff --git a/src/assets/onboarding/README.md b/src/assets/onboarding/README.md
index 558cf6c7..287468ba 100644
--- a/src/assets/onboarding/README.md
+++ b/src/assets/onboarding/README.md
@@ -1,13 +1,6 @@
-# Onboarding clips
+# Onboarding
-Place optional square MP4 clips in this folder to replace the three illustrations:
-
-- `record.mp4`
-- `preview.mp4`
-- `share.mp4`
-
-They are discovered at build time. Use short, silent H.264 MP4s with the important
-content inside the square frame. Clips loop muted while the page is open, and
-show playback controls instead of autoplay when reduced motion is enabled.
-Missing or failed clips retain the illustration. Change the paragraph in
-`src/components/auth/OnboardingFeature.tsx` to update the introductory copy.
+Onboarding has two carousel pages: Account and Permissions, selected with the bottom pagination buttons. The Recordly logo sits above the title on each page. Account requires a non-anonymous Supabase session; there is no skip action. The shared banner uses
+`public/auth/login-banner.png` in `src/components/auth/OnboardingLayout.tsx`. It grows into the space left by the current page’s content and shrinks to a minimum height in short windows, keeping the form scrollable and the bottom navigation visible.
+Permission controls and the final Start recording action live in
+`src/components/auth/OnboardingPermissions.tsx`.
diff --git a/src/components/auth/AccountSettings.tsx b/src/components/auth/AccountSettings.tsx
new file mode 100644
index 00000000..eb4511bb
--- /dev/null
+++ b/src/components/auth/AccountSettings.tsx
@@ -0,0 +1,181 @@
+import { useEffect, useState, type FormEvent } from "react";
+import type { User } from "@supabase/supabase-js";
+import { TextField, Label, Input } from "@heroui/react";
+import { AccountAvatar, getAccountProfile } from "@/components/ui/account-avatar";
+import { Button } from "@/components/ui/button";
+import { SettingsRow } from "@/components/video-editor/SettingsRow";
+import {
+ requestAccountEmailChange,
+ signOutRecordly,
+ updateAccountName,
+} from "@/lib/auth/recordlyAuth";
+
+const providerNames: Record<string, string> = {
+ email: "Email magic link",
+ google: "Google",
+ azure: "Microsoft",
+ github: "GitHub",
+};
+
+function profileName(user: User | null): string {
+ const name = user?.user_metadata?.full_name ?? user?.user_metadata?.name;
+ return typeof name === "string" ? name : "";
+}
+
+export function AccountSettings({ user }: { user: User | null }) {
+ const [name, setName] = useState(() => profileName(user));
+ const [email, setEmail] = useState(user?.email ?? "");
+ const [busy, setBusy] = useState<string>();
+ const [error, setError] = useState<string>();
+ const [message, setMessage] = useState<string>();
+ const savedName = profileName(user);
+ useEffect(() => setName(savedName), [savedName]);
+ useEffect(() => setEmail(user?.email ?? ""), [user?.email]);
+
+ const run = async (action: string, work: () => Promise<void>) => {
+ if (busy) return;
+ setBusy(action);
+ setError(undefined);
+ setMessage(undefined);
+ try {
+ await work();
+ } catch (error) {
+ setError(error instanceof Error ? error.message : String(error));
+ } finally {
+ setBusy(undefined);
+ }
+ };
+ const submitName = (event: FormEvent) => {
+ event.preventDefault();
+ void run("name", async () => {
+ await updateAccountName(name);
+ setMessage("Profile saved.");
+ });
+ };
+ const submitEmail = (event: FormEvent) => {
+ event.preventDefault();
+ void run("email", async () => {
+ const updated = await requestAccountEmailChange(email);
+ setMessage(
+ updated.email === email.trim()
+ ? "Email address updated."
+ : "Check your current and new inboxes for confirmation instructions.",
+ );
+ });
+ };
+
+ if (!user) return <p className="text-sm text-muted">Sign in to manage your account.</p>;
+ const profile = getAccountProfile(user);
+ const providers = [
+ ...new Set([
+ ...(user.identities?.map((identity) => identity.provider) ?? []),
+ ...(Array.isArray(user.app_metadata.providers) ? user.app_metadata.providers : []),
+ ]),
+ ].filter((provider): provider is string => typeof provider === "string");
+ const validEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim());
+ return (
+ <div className="space-y-6">
+ <div className="flex min-w-0 items-center gap-3">
+ <AccountAvatar user={user} className="size-12" />
+ <div className="min-w-0">
+ <p className="truncate text-sm font-semibold">{profile.name}</p>
+ <p className="break-all text-xs text-muted">{user.email}</p>
+ </div>
+ </div>
+ <form onSubmit={submitName} className="space-y-3" aria-label="Profile settings">
+ <TextField
+ name="displayName"
+ value={name}
+ onChange={setName}
+ isRequired
+ isDisabled={Boolean(busy)}
+ >
+ <Label>Display name</Label>
+ <Input maxLength={80} autoComplete="name" className="w-full" />
+ </TextField>
+ <Button
+ type="submit"
+ variant="secondary"
+ size="sm"
+ disabled={Boolean(busy) || !name.trim() || name.trim() === profileName(user)}
+ >
+ {busy === "name" ? "Saving…" : "Save profile"}
+ </Button>
+ </form>
+ <form onSubmit={submitEmail} className="space-y-3" aria-label="Email settings">
+ <TextField
+ name="email"
+ type="email"
+ value={email}
+ onChange={setEmail}
+ isRequired
+ isDisabled={Boolean(busy)}
+ >
+ <Label>Email address</Label>
+ <Input autoComplete="email" className="w-full" />
+ </TextField>
+ <p className="text-xs leading-relaxed text-muted">
+ Confirm your new address by email before using it to sign in.
+ </p>
+ {user.new_email && user.new_email !== user.email && (
+ <p role="status" className="break-words text-xs text-muted">
+ Awaiting confirmation: {user.new_email}
+ </p>
+ )}
+ <Button
+ type="submit"
+ variant="secondary"
+ size="sm"
+ disabled={
+ Boolean(busy) ||
+ !validEmail ||
+ email.trim().toLowerCase() === user.email?.toLowerCase() ||
+ email.trim() === user.new_email
+ }
+ >
+ {busy === "email" ? "Sending…" : "Change email"}
+ </Button>
+ </form>
+ <SettingsRow
+ title="Sign-in methods"
+ description="Methods connected to your account."
+ stacked
+ >
+ <ul className="flex flex-wrap gap-2" aria-label="Connected sign-in methods">
+ {providers.map((provider) => (
+ <li
+ key={provider}
+ className="rounded-lg bg-surface-secondary px-3 py-2 text-xs"
+ >
+ {providerNames[provider] ?? provider}
+ </li>
+ ))}
+ </ul>
+ </SettingsRow>
+ {message && (
+ <p role="status" className="text-xs leading-relaxed text-success">
+ {message}
+ </p>
+ )}
+ {error && (
+ <p role="alert" className="text-xs leading-relaxed text-danger">
+ {error}
+ </p>
+ )}
+ <SettingsRow
+ title="Sign out"
+ description="Sign out of Recordly on all devices. Local projects stay on this computer."
+ stacked
+ >
+ <Button
+ variant="destructive-soft"
+ size="sm"
+ disabled={Boolean(busy)}
+ onClick={() => void run("signout", signOutRecordly)}
+ >
+ {busy === "signout" ? "Signing out…" : "Sign out"}
+ </Button>
+ </SettingsRow>
+ </div>
+ );
+}
diff --git a/src/components/auth/Onboarding.css b/src/components/auth/Onboarding.css
new file mode 100644
index 00000000..5bb56af1
--- /dev/null
+++ b/src/components/auth/Onboarding.css
@@ -0,0 +1,45 @@
+/* Fit permissions in the window instead of scrolling behind the footer. */
+@media (max-height: 800px) {
+ .onboarding-permissions [data-onboarding-body] {
+ padding-top: 12px;
+ padding-bottom: 12px;
+ }
+ .onboarding-permissions [data-onboarding-body] > div > :not(:last-child) {
+ margin-bottom: 12px;
+ }
+ .onboarding-permissions .modal__header {
+ gap: 6px;
+ }
+ .onboarding-permissions [data-onboarding-brand] {
+ margin-bottom: 0;
+ }
+ .onboarding-permissions [data-onboarding-brand] img {
+ width: 32px;
+ height: 32px;
+ }
+ .onboarding-permissions .modal__heading {
+ font-size: 24px;
+ }
+ .onboarding-permissions .onboarding-permission-row {
+ gap: 10px;
+ padding: 10px;
+ }
+ .onboarding-permissions .onboarding-permission-row > div:first-child {
+ width: 32px;
+ height: 32px;
+ }
+ .onboarding-permissions .onboarding-permission-row p,
+ .onboarding-permissions .onboarding-permission-help p {
+ line-height: 16px;
+ }
+}
+
+@media (max-height: 800px) and (max-width: 440px) {
+ .onboarding-permissions .onboarding-permission-row p {
+ display: none;
+ }
+ .onboarding-permissions .onboarding-permission-row .button {
+ height: 32px;
+ min-height: 32px;
+ }
+}
diff --git a/src/components/auth/OnboardingController.tsx b/src/components/auth/OnboardingController.tsx
index 7c1208d8..4a3c1c3f 100644
--- a/src/components/auth/OnboardingController.tsx
+++ b/src/components/auth/OnboardingController.tsx
@@ -22,23 +22,30 @@ export function OnboardingController({
const [startWithPermissions, setStartWithPermissions] = useState(false);
const checked = useRef(false);
useEffect(() => {
- if (requestNonce > 0) setOpen(true);
+ if (requestNonce > 0) {
+ setStartWithPermissions(true);
+ setOpen(true);
+ }
}, [requestNonce]);
const close = useCallback(() => {
- saveAppSetting(SEEN_KEY, true);
saveAppSetting("recordly.onboarding.permissionsRequested", false);
setStartWithPermissions(false);
setOpen(false);
}, []);
useEffect(() => {
- if (!ready || checked.current) return;
+ if (!ready) return;
+ if (!user) {
+ setOpen(true);
+ return;
+ }
+ if (checked.current) return;
checked.current = true;
if (loadAppSetting<boolean>("recordly.onboarding.permissionsRequested")) {
setStartWithPermissions(true);
setOpen(true);
} else if (!loadAppSetting<boolean>(SEEN_KEY)) setOpen(true);
- }, [ready]);
+ }, [ready, user]);
useEffect(
() =>
@@ -50,6 +57,8 @@ export function OnboardingController({
);
const finish = () => {
+ if (!user) return;
+ saveAppSetting(SEEN_KEY, true);
close();
void window.electronAPI.showRecordingHud();
};
@@ -61,7 +70,7 @@ export function OnboardingController({
variant="wide"
open={open}
onOpenChange={(value) => {
- if (!value) close();
+ if (!value && user) close();
}}
user={user}
configured={configured}
diff --git a/src/components/auth/OnboardingFeature.tsx b/src/components/auth/OnboardingFeature.tsx
deleted file mode 100644
index 44d6db91..00000000
--- a/src/components/auth/OnboardingFeature.tsx
+++ /dev/null
@@ -1,311 +0,0 @@
-import { useCallback, useEffect, useRef, useState } from "react";
-import { Button, Description, Modal, Surface } from "@heroui/react";
-import {
- ArrowLeft,
- ArrowRight,
- Check,
- Cursor,
- Monitor,
- Play,
- ShareNetwork,
- ShieldCheck,
-} from "@phosphor-icons/react";
-
-const steps = [
- { name: "Record", key: "record", icon: Monitor, color: "from-sky-100 to-blue-200" },
- { name: "Preview", key: "preview", icon: Play, color: "from-violet-100 to-indigo-200" },
- { name: "Share", key: "share", icon: ShareNetwork, color: "from-rose-100 to-orange-100" },
-] as const;
-
-type Step = (typeof steps)[number]["key"];
-// Optional clips are bundled only when provided. Missing clips use illustrations, without 404s.
-const clips = import.meta.glob<string>("/src/assets/onboarding/{record,preview,share}.mp4", {
- eager: true,
- query: "?url",
- import: "default",
-});
-
-function StepTile({
- step,
- src,
- reduceMotion,
-}: {
- step: (typeof steps)[number];
- src?: string;
- reduceMotion: boolean;
-}) {
- const [failed, setFailed] = useState(false);
- const player = useRef<HTMLVideoElement>(null);
- useEffect(() => {
- if (!src) return;
- if (reduceMotion) player.current?.pause();
- else void player.current?.play().catch(() => undefined);
- }, [reduceMotion, src]);
- const Icon = step.icon;
- return (
- <div className="min-w-0 flex-1 text-center">
- <div
- className={`relative flex aspect-square items-center justify-center overflow-hidden rounded-[24px] border border-black/5 bg-gradient-to-br ${step.color}`}
- >
- <Icon aria-hidden="true" size={52} weight="duotone" className="text-zinc-700" />
- {src && !failed && (
- <video
- ref={player}
- aria-label={`${step.name} demonstration`}
- className="absolute inset-0 size-full object-cover"
- autoPlay={!reduceMotion}
- muted
- loop
- playsInline
- controls={Boolean(reduceMotion)}
- preload="metadata"
- onError={() => setFailed(true)}
- >
- <source src={src} type="video/mp4" onError={() => setFailed(true)} />
- </video>
- )}
- </div>
- <h3 className="mt-4 text-base font-semibold sm:text-lg">{step.name}</h3>
- </div>
- );
-}
-
-export function OnboardingFeature({
- onBack,
- onFinish,
- media = {},
-}: {
- onBack: () => void;
- onFinish: () => void;
- media?: Partial<Record<Step, string>>;
-}) {
- const [page, setPage] = useState<"checking" | "permissions" | "overview">("checking");
- const [reduceMotion, setReduceMotion] = useState(
- () => window.matchMedia("(prefers-reduced-motion: reduce)").matches,
- );
- useEffect(() => {
- const query = window.matchMedia("(prefers-reduced-motion: reduce)");
- const change = () => setReduceMotion(query.matches);
- query.addEventListener("change", change);
- return () => query.removeEventListener("change", change);
- }, []);
- const [screenGranted, setScreenGranted] = useState(false);
- const [accessibilityGranted, setAccessibilityGranted] = useState(false);
- const [busy, setBusy] = useState<string>();
- const [error, setError] = useState<string>();
- const refresh = useCallback(async () => {
- const [screen, accessibility] = await Promise.all([
- window.electronAPI.getScreenRecordingPermissionStatus(),
- window.electronAPI.getAccessibilityPermissionStatus(),
- ]);
- if (!screen.success || !accessibility.success)
- throw new Error("Could not check permissions. Try again.");
- setScreenGranted(screen.status === "granted");
- setAccessibilityGranted(accessibility.trusted);
- setError(undefined);
- return screen.status === "granted" && accessibility.trusted;
- }, []);
-
- useEffect(() => {
- let disposed = false;
- void (async () => {
- try {
- const mac = (await window.electronAPI.getPlatform()) === "darwin";
- const granted = !mac || (await refresh());
- if (!disposed) setPage(granted ? "overview" : "permissions");
- } catch (error) {
- if (!disposed) {
- setError(String(error));
- setPage("permissions");
- }
- }
- })();
- return () => {
- disposed = true;
- };
- }, [refresh]);
-
- useEffect(() => {
- if (page !== "permissions") return;
- const check = () => {
- void refresh().catch((error) => setError(String(error)));
- };
- const visible = () => {
- if (document.visibilityState === "visible") check();
- };
- window.addEventListener("focus", check);
- document.addEventListener("visibilitychange", visible);
- return () => {
- window.removeEventListener("focus", check);
- document.removeEventListener("visibilitychange", visible);
- };
- }, [page, refresh]);
-
- const allow = async (permission: "screen" | "accessibility") => {
- if (busy) return;
- setBusy(permission);
- try {
- if (permission === "accessibility") {
- const result = await window.electronAPI.requestAccessibilityPermission();
- if (!result.success)
- throw new Error(result.error || "Could not request Accessibility access.");
- if (!result.trusted) {
- const opened = await window.electronAPI.openAccessibilityPreferences();
- if (!opened.success)
- throw new Error(opened.error || "Could not open System Settings.");
- }
- } else {
- const result = await window.electronAPI.openScreenRecordingPreferences();
- if (!result.success)
- throw new Error(result.error || "Could not open System Settings.");
- }
- await refresh();
- } catch (error) {
- setError(error instanceof Error ? error.message : String(error));
- } finally {
- setBusy(undefined);
- }
- };
-
- return (
- <Surface className="absolute inset-0 flex flex-col justify-center overflow-y-auto px-6 py-10 sm:px-12 sm:py-12">
- {page === "checking" ? (
- <p role="status" className="text-center text-sm text-muted">
- Checking permissions…
- </p>
- ) : page === "permissions" ? (
- <div className="mx-auto w-full max-w-[600px]">
- <ShieldCheck size={36} className="mb-5 text-accent" />
- <Modal.Header className="gap-3">
- <Modal.Heading className="text-3xl font-semibold tracking-tight">
- Allow Recordly to record
- </Modal.Heading>
- <Description className="text-sm leading-relaxed">
- Enable these permissions in macOS System Settings. Your screen is
- captured only when you start a recording.
- </Description>
- </Modal.Header>
- <div className="my-7 space-y-3">
- {[
- {
- key: "screen" as const,
- name: "Screen Recording",
- description: "Capture a screen, window or selected area.",
- granted: screenGranted,
- icon: Monitor,
- },
- {
- key: "accessibility" as const,
- name: "Accessibility",
- description: "Track your cursor and highlight clicks.",
- granted: accessibilityGranted,
- icon: Cursor,
- },
- ].map(({ key, name, description, granted, icon: Icon }) => (
- <div
- key={key}
- className="flex items-center gap-4 rounded-2xl border border-separator p-4"
- >
- <Icon size={24} className="shrink-0 text-muted" />
- <div className="min-w-0 flex-1">
- <h3 className="text-sm font-semibold">{name}</h3>
- <p className="mt-1 text-xs text-muted">{description}</p>
- </div>
- {granted ? (
- <span className="flex shrink-0 items-center gap-1.5 text-xs text-success">
- <Check size={16} />
- Allowed
- </span>
- ) : (
- <Button
- variant="secondary"
- isDisabled={Boolean(busy)}
- onPress={() => void allow(key)}
- aria-label={`Allow ${name}`}
- >
- {busy === key ? "Opening…" : "Allow"}
- </Button>
- )}
- </div>
- ))}
- </div>
- <p className="text-xs leading-relaxed text-muted">
- Return here after enabling access. macOS may ask you to quit and reopen
- Recordly for Screen Recording changes to take effect. Microphone and camera
- access are requested when you use them.
- </p>
- {error && (
- <p role="alert" className="mt-3 text-sm text-danger">
- {error}
- </p>
- )}
- <Modal.Footer className="mt-7 gap-3">
- <Button
- variant="secondary"
- onPress={() => void refresh().catch((error) => setError(String(error)))}
- >
- Check again
- </Button>
- <Button
- isDisabled={!screenGranted || !accessibilityGranted || Boolean(busy)}
- onPress={() => setPage("overview")}
- >
- Continue
- </Button>
- </Modal.Footer>
- </div>
- ) : (
- <div className="mx-auto w-full max-w-[780px]">
- <Modal.Header className="mb-8 items-center gap-2 text-center sm:mb-10">
- <Modal.Heading className="text-3xl font-semibold tracking-tight sm:text-4xl">
- Your next great recording
- </Modal.Heading>
- </Modal.Header>
- <div className="flex items-start gap-2 sm:gap-4">
- {steps.map((step, index) => (
- <div key={step.key} className="contents">
- <StepTile
- step={step}
- reduceMotion={reduceMotion}
- src={
- media[step.key] ??
- clips[`/src/assets/onboarding/${step.key}.mp4`]
- }
- />
- {index < steps.length - 1 && (
- <div
- aria-hidden="true"
- className="flex aspect-square w-5 shrink-0 items-center justify-center self-center pb-10 sm:w-8"
- >
- <ArrowRight size={24} className="text-muted" />
- </div>
- )}
- </div>
- ))}
- </div>
- <div className="mx-auto mt-8 max-w-[550px] text-center sm:mt-10">
- <Description className="text-sm leading-relaxed">
- Capture a moment, polish it in the preview, and share it with anyone.
- Recordly brings your screen, voice and camera together so your ideas are
- easy to follow.
- </Description>
- </div>
- <Modal.Footer className="mt-8 justify-center gap-3 sm:mt-10">
- <Button
- variant="secondary"
- isIconOnly
- aria-label="Back to sign in"
- onPress={onBack}
- >
- <ArrowLeft size={18} />
- </Button>
- <Button onPress={onFinish}>
- Start recording
- <ArrowRight size={18} />
- </Button>
- </Modal.Footer>
- </div>
- )}
- </Surface>
- );
-}
diff --git a/src/components/auth/OnboardingLayout.tsx b/src/components/auth/OnboardingLayout.tsx
new file mode 100644
index 00000000..bbba1604
--- /dev/null
+++ b/src/components/auth/OnboardingLayout.tsx
@@ -0,0 +1,122 @@
+import type { ReactNode } from "react";
+import { Description, Modal } from "@heroui/react";
+import { motion, useReducedMotion } from "motion/react";
+import "./Onboarding.css";
+
+type OnboardingStage = "account" | "permissions";
+
+const stages = [
+ { key: "account", label: "Account" },
+ { key: "permissions", label: "Permissions" },
+] as const;
+
+export function OnboardingLayout({
+ stage,
+ onStageChange,
+ canViewPermissions,
+ children,
+}: {
+ stage: OnboardingStage;
+ onStageChange: (stage: OnboardingStage) => void;
+ canViewPermissions: boolean;
+ children: ReactNode;
+}) {
+ const reduceMotion = useReducedMotion();
+ const transition = { duration: reduceMotion ? 0 : 0.28, ease: [0.22, 1, 0.36, 1] as const };
+ return (
+ <div className="flex h-full min-h-0 flex-col">
+ <motion.div
+ data-onboarding-artwork
+ layout={reduceMotion ? false : "size"}
+ layoutDependency={stage}
+ transition={transition}
+ className="relative m-2 mb-0 min-h-24 flex-1 overflow-hidden rounded-2xl sm:min-h-32"
+ >
+ <img
+ src={`${import.meta.env.BASE_URL}auth/login-banner.png`}
+ alt=""
+ className="absolute inset-0 size-full object-cover object-center"
+ />
+ </motion.div>
+ <motion.div
+ layout={reduceMotion ? false : "position"}
+ layoutDependency={stage}
+ transition={transition}
+ className="flex min-h-0 shrink flex-col overflow-hidden"
+ >
+ {children}
+ </motion.div>
+ <nav
+ aria-label="Onboarding pages"
+ className="flex shrink-0 justify-center gap-1 px-6 pb-4 pt-2"
+ >
+ {stages.map(({ key, label }) => (
+ <button
+ key={key}
+ type="button"
+ aria-label={label}
+ aria-current={stage === key ? "page" : undefined}
+ disabled={key === "permissions" && !canViewPermissions}
+ onClick={() => onStageChange(key)}
+ className="group flex size-8 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-40"
+ >
+ <span
+ aria-hidden="true"
+ className={`h-2 rounded-full transition-[width,background-color] motion-reduce:transition-none ${stage === key ? "w-6 bg-accent" : "w-2 bg-foreground/25 group-hover:bg-foreground/45"}`}
+ />
+ </button>
+ ))}
+ </nav>
+ </div>
+ );
+}
+
+export function OnboardingBody({
+ children,
+ scrollable = true,
+}: {
+ children: ReactNode;
+ scrollable?: boolean;
+}) {
+ return (
+ <div
+ data-onboarding-body
+ className={`px-6 py-7 sm:px-10 sm:py-8 ${scrollable ? "min-h-0 flex-1 overflow-y-auto" : "shrink-0"}`}
+ >
+ <div className="mx-auto w-full max-w-[560px] space-y-6">{children}</div>
+ </div>
+ );
+}
+
+export function OnboardingHeader({ title, description }: { title: string; description: string }) {
+ return (
+ <Modal.Header className="items-start gap-2 p-0 text-left">
+ <div
+ data-onboarding-brand
+ className="mb-3 flex items-center gap-2.5"
+ aria-label="Recordly"
+ >
+ <img
+ src={`${import.meta.env.BASE_URL}app-icons/recordly-128.png`}
+ alt=""
+ className="size-10 rounded-xl"
+ />
+ <span className="text-lg font-semibold tracking-tight">Recordly</span>
+ </div>
+ <Modal.Heading className="text-2xl font-semibold leading-tight tracking-tight sm:text-3xl">
+ {title}
+ </Modal.Heading>
+ <Description className="text-sm leading-relaxed">{description}</Description>
+ </Modal.Header>
+ );
+}
+
+export function OnboardingFooter({ children }: { children: ReactNode }) {
+ return (
+ <Modal.Footer className="mt-0 shrink-0 px-6 pb-2 pt-3 sm:px-10">
+ <div className="mx-auto flex w-full max-w-[560px] items-center justify-between gap-3 [&_.button]:h-11 [&_.button]:rounded-xl">
+ {children}
+ </div>
+ </Modal.Footer>
+ );
+}
diff --git a/src/components/auth/OnboardingPermissions.tsx b/src/components/auth/OnboardingPermissions.tsx
new file mode 100644
index 00000000..03ab2b72
--- /dev/null
+++ b/src/components/auth/OnboardingPermissions.tsx
@@ -0,0 +1,214 @@
+import { useCallback, useEffect, useState } from "react";
+import { Button } from "@heroui/react";
+import { ArrowLeft, ArrowRight, Check, Cursor, Monitor } from "@phosphor-icons/react";
+import { OnboardingBody, OnboardingFooter, OnboardingHeader } from "./OnboardingLayout";
+import { PermissionsConfetti } from "./PermissionsConfetti";
+
+export function OnboardingPermissions({
+ onBack,
+ onFinish,
+}: {
+ onBack: () => void;
+ onFinish: () => void;
+}) {
+ const [platform, setPlatform] = useState<"checking" | "mac" | "other">("checking");
+ const [screenGranted, setScreenGranted] = useState(false);
+ const [accessibilityGranted, setAccessibilityGranted] = useState(false);
+ const [busy, setBusy] = useState<string>();
+ const [error, setError] = useState<string>();
+ const refresh = useCallback(async () => {
+ const [screen, accessibility] = await Promise.all([
+ window.electronAPI.getScreenRecordingPermissionStatus(),
+ window.electronAPI.getAccessibilityPermissionStatus(),
+ ]);
+ if (!screen.success || !accessibility.success)
+ throw new Error("Could not check permissions. Try again.");
+ setScreenGranted(screen.status === "granted");
+ setAccessibilityGranted(accessibility.trusted);
+ setError(undefined);
+ return screen.status === "granted" && accessibility.trusted;
+ }, []);
+
+ useEffect(() => {
+ let disposed = false;
+ void (async () => {
+ try {
+ const mac = (await window.electronAPI.getPlatform()) === "darwin";
+ if (mac) await refresh();
+ if (!disposed) setPlatform(mac ? "mac" : "other");
+ } catch (error) {
+ if (!disposed) {
+ setError(String(error));
+ setPlatform("mac");
+ }
+ }
+ })();
+ return () => {
+ disposed = true;
+ };
+ }, [refresh]);
+
+ useEffect(() => {
+ if (platform !== "mac") return;
+ const check = () => {
+ void refresh().catch((error) => setError(String(error)));
+ };
+ const visible = () => {
+ if (document.visibilityState === "visible") check();
+ };
+ window.addEventListener("focus", check);
+ document.addEventListener("visibilitychange", visible);
+ return () => {
+ window.removeEventListener("focus", check);
+ document.removeEventListener("visibilitychange", visible);
+ };
+ }, [platform, refresh]);
+ const allow = async (permission: "screen" | "accessibility") => {
+ if (busy) return;
+ setBusy(permission);
+ try {
+ if (permission === "accessibility") {
+ const result = await window.electronAPI.requestAccessibilityPermission();
+ if (!result.success)
+ throw new Error(result.error || "Could not request Accessibility access.");
+ if (!result.trusted) {
+ const opened = await window.electronAPI.openAccessibilityPreferences();
+ if (!opened.success)
+ throw new Error(opened.error || "Could not open System Settings.");
+ }
+ } else {
+ const result = await window.electronAPI.openScreenRecordingPreferences();
+ if (!result.success)
+ throw new Error(result.error || "Could not open System Settings.");
+ }
+ await refresh();
+ } catch (error) {
+ setError(error instanceof Error ? error.message : String(error));
+ } finally {
+ setBusy(undefined);
+ }
+ };
+
+ return (
+ <div className="onboarding-permissions relative flex min-h-0 flex-col">
+ <PermissionsConfetti
+ ready={platform === "mac" && screenGranted && accessibilityGranted && !error}
+ />
+ <OnboardingBody scrollable={false}>
+ {platform === "checking" ? (
+ <p role="status" className="py-12 text-center text-sm text-muted">
+ Checking permissions…
+ </p>
+ ) : (
+ <>
+ <OnboardingHeader
+ title="Allow Recordly to record"
+ description={
+ platform === "mac"
+ ? "Enable these permissions in macOS System Settings."
+ : "Your screen is captured only when you start a recording. Microphone and camera access are requested when you use them."
+ }
+ />
+ {platform === "mac" && (
+ <>
+ <div className="space-y-3">
+ {[
+ {
+ key: "screen" as const,
+ name: "Screen Recording",
+ description:
+ "Capture a screen, window or selected area.",
+ granted: screenGranted,
+ icon: Monitor,
+ },
+ {
+ key: "accessibility" as const,
+ name: "Accessibility",
+ description: "Track your cursor and highlight clicks.",
+ granted: accessibilityGranted,
+ icon: Cursor,
+ },
+ ].map(({ key, name, description, granted, icon: Icon }) => (
+ <div
+ key={key}
+ className="onboarding-permission-row flex items-center gap-3 rounded-2xl border border-separator p-4"
+ >
+ <div className="flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary text-accent">
+ <Icon size={22} aria-hidden="true" />
+ </div>
+ <div className="min-w-0 flex-1">
+ <h3 className="text-sm font-semibold">{name}</h3>
+ <p className="mt-1 text-xs leading-relaxed text-muted">
+ {description}
+ </p>
+ </div>
+ {granted ? (
+ <span className="flex shrink-0 items-center gap-1.5 text-xs font-medium text-success">
+ <Check size={16} aria-hidden="true" />
+ Allowed
+ </span>
+ ) : (
+ <Button
+ variant="secondary"
+ className="h-11 shrink-0 rounded-xl"
+ isDisabled={Boolean(busy)}
+ onPress={() => void allow(key)}
+ aria-label={`Allow ${name}`}
+ >
+ {busy === key ? "Opening…" : "Allow"}
+ </Button>
+ )}
+ </div>
+ ))}
+ </div>
+ <div className="onboarding-permission-help flex items-center gap-3">
+ <p className="flex-1 text-xs leading-relaxed text-muted">
+ {screenGranted && accessibilityGranted
+ ? "Your screen is captured only when you start recording. Microphone and camera access are requested when you use them."
+ : "Return after enabling access. macOS may require restarting Recordly."}
+ </p>
+ {(!screenGranted || !accessibilityGranted) && (
+ <Button
+ variant="ghost"
+ size="sm"
+ className="shrink-0"
+ isDisabled={Boolean(busy)}
+ onPress={() =>
+ void refresh().catch((error) =>
+ setError(String(error)),
+ )
+ }
+ >
+ Check again
+ </Button>
+ )}
+ </div>
+ {error && (
+ <p role="alert" className="text-sm text-danger">
+ {error}
+ </p>
+ )}
+ </>
+ )}
+ </>
+ )}
+ </OnboardingBody>
+ <OnboardingFooter>
+ <Button variant="ghost" aria-label="Back to account" onPress={onBack}>
+ <ArrowLeft size={16} />
+ Back
+ </Button>
+ <Button
+ isDisabled={
+ platform === "checking" ||
+ (platform === "mac" &&
+ (!screenGranted || !accessibilityGranted || Boolean(busy)))
+ }
+ onPress={onFinish}
+ >
+ Start recording <ArrowRight size={16} />
+ </Button>
+ </OnboardingFooter>
+ </div>
+ );
+}
diff --git a/src/components/auth/PermissionsConfetti.tsx b/src/components/auth/PermissionsConfetti.tsx
new file mode 100644
index 00000000..bae37f0a
--- /dev/null
+++ b/src/components/auth/PermissionsConfetti.tsx
@@ -0,0 +1,58 @@
+import { useEffect, useRef, useState } from "react";
+import { motion, useReducedMotion } from "motion/react";
+
+const colors = ["#0088ff", "#67d5ff", "#ffc857", "#f574b9", "#64d6a2"];
+const particles = Array.from({ length: 48 }, (_, index) => ({
+ id: index,
+ right: index % 2 === 0,
+ distance: 70 + ((index * 47) % 260),
+ rise: 120 + ((index * 31) % 240),
+ spin: (index % 2 === 0 ? 1 : -1) * (180 + ((index * 29) % 540)),
+ delay: (index % 8) * 0.025,
+}));
+
+export function PermissionsConfetti({ ready }: { ready: boolean }) {
+ const reduceMotion = useReducedMotion();
+ const celebrated = useRef(false);
+ const [active, setActive] = useState(false);
+
+ useEffect(() => {
+ if (!ready || reduceMotion || celebrated.current) return;
+ celebrated.current = true;
+ setActive(true);
+ }, [ready, reduceMotion]);
+
+ useEffect(() => {
+ if (!active) return;
+ const timeout = window.setTimeout(() => setActive(false), 2300);
+ return () => window.clearTimeout(timeout);
+ }, [active]);
+
+ if (!active || reduceMotion) return null;
+ return (
+ <div
+ data-permissions-confetti
+ aria-hidden="true"
+ className="pointer-events-none absolute inset-0 z-20 overflow-hidden"
+ >
+ {particles.map(({ id, right, distance, rise, spin, delay }) => (
+ <motion.span
+ key={id}
+ className="absolute bottom-12 h-2.5 w-1.5 rounded-[1px]"
+ style={{
+ left: right ? "90%" : "10%",
+ backgroundColor: colors[id % colors.length],
+ }}
+ initial={{ opacity: 0, x: 0, y: 0, rotate: 0 }}
+ animate={{
+ opacity: [0, 1, 1, 0],
+ x: [0, distance * (right ? -1 : 1)],
+ y: [0, -rise, -rise * 0.85, 90],
+ rotate: [0, spin],
+ }}
+ transition={{ duration: 1.9, delay, ease: "easeOut" }}
+ />
+ ))}
+ </div>
+ );
+}
diff --git a/src/components/auth/RecordingPermissionsSettings.tsx b/src/components/auth/RecordingPermissionsSettings.tsx
new file mode 100644
index 00000000..6a6bbec2
--- /dev/null
+++ b/src/components/auth/RecordingPermissionsSettings.tsx
@@ -0,0 +1,123 @@
+import { useCallback, useEffect, useState } from "react";
+import { Button } from "@/components/ui/button";
+import { SettingsRow } from "@/components/video-editor/SettingsRow";
+
+export function RecordingPermissionsSettings({ onReview }: { onReview?: () => void }) {
+ const [status, setStatus] = useState<{
+ mac: boolean;
+ screen: boolean;
+ accessibility: boolean;
+ }>();
+ const [busy, setBusy] = useState(false);
+ const [error, setError] = useState<string>();
+ const refresh = useCallback(async () => {
+ setBusy(true);
+ try {
+ const mac = (await window.electronAPI.getPlatform()) === "darwin";
+ if (mac) {
+ const [screen, accessibility] = await Promise.all([
+ window.electronAPI.getScreenRecordingPermissionStatus(),
+ window.electronAPI.getAccessibilityPermissionStatus(),
+ ]);
+ if (!screen.success || !accessibility.success)
+ throw new Error("Could not check permissions. Please try again.");
+ setStatus({
+ mac,
+ screen: screen.status === "granted",
+ accessibility: accessibility.trusted,
+ });
+ } else setStatus({ mac, screen: true, accessibility: true });
+ setError(undefined);
+ } catch (error) {
+ setError(error instanceof Error ? error.message : String(error));
+ } finally {
+ setBusy(false);
+ }
+ }, []);
+ useEffect(() => {
+ void refresh();
+ const check = () => void refresh();
+ window.addEventListener("focus", check);
+ return () => window.removeEventListener("focus", check);
+ }, [refresh]);
+
+ return (
+ <div className="space-y-6">
+ {!status && !error && (
+ <p role="status" className="text-xs text-muted">
+ Checking permissions…
+ </p>
+ )}
+ {status?.mac && (
+ <>
+ {[
+ {
+ title: "Screen Recording",
+ description: "Capture your screen, windows and selected areas.",
+ granted: status.screen,
+ },
+ {
+ title: "Accessibility",
+ description: "Track your cursor and highlight clicks.",
+ granted: status.accessibility,
+ },
+ ].map(({ title, description, granted }) => (
+ <SettingsRow key={title} title={title} description={description}>
+ <span
+ className={`text-xs font-medium ${granted ? "text-success" : "text-muted"}`}
+ >
+ {granted ? "Allowed" : "Required"}
+ </span>
+ </SettingsRow>
+ ))}
+ <Button
+ variant="secondary"
+ size="sm"
+ disabled={busy}
+ onClick={() => void refresh()}
+ >
+ Check again
+ </Button>
+ </>
+ )}
+ {status && !status.mac && (
+ <p className="text-xs leading-relaxed text-muted">
+ Choose what to capture when you start a recording.
+ </p>
+ )}
+ <SettingsRow
+ title="Microphone and camera"
+ description="Access is requested when you enable a microphone or camera for recording."
+ stacked
+ >
+ <span className="text-xs text-muted">Requested when needed</span>
+ </SettingsRow>
+ {error && (
+ <div className="space-y-3">
+ <p role="alert" className="text-xs text-danger">
+ {error}
+ </p>
+ <Button
+ variant="secondary"
+ size="sm"
+ disabled={busy}
+ onClick={() => void refresh()}
+ >
+ Try again
+ </Button>
+ </div>
+ )}
+ {onReview && (
+ <SettingsRow
+ title="Permission setup"
+ description="Review access and open system permission settings."
+ stacked
+ >
+ <Button variant="secondary" size="sm" onClick={onReview}>
+ Review permissions
+ </Button>
+ </SettingsRow>
+ )}
+ </div>
+ );
+}
diff --git a/src/components/auth/RecordlySignInDialog.tsx b/src/components/auth/RecordlySignInDialog.tsx
index bf843004..9be9948a 100644
--- a/src/components/auth/RecordlySignInDialog.tsx
+++ b/src/components/auth/RecordlySignInDialog.tsx
@@ -1,11 +1,16 @@
-import { GithubLogo } from "@phosphor-icons/react";
-import { OnboardingFeature } from "./OnboardingFeature";
+import { ArrowRight, GithubLogo } from "@phosphor-icons/react";
+import { OnboardingPermissions } from "./OnboardingPermissions";
+import {
+ OnboardingBody,
+ OnboardingFooter,
+ OnboardingHeader,
+ OnboardingLayout,
+} from "./OnboardingLayout";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
-import { demoLoginEnabled } from "@/lib/auth/demoSession";
import { useI18n } from "@/contexts/I18nContext";
import { SignOut } from "@/components/ui/icons";
import type { User } from "@supabase/supabase-js";
-import { type FormEvent, useEffect, useState, useRef } from "react";
+import { Fragment, type FormEvent, useEffect, useState, useRef } from "react";
import {
Modal,
Button,
@@ -19,8 +24,9 @@ import {
Alert,
} from "@heroui/react";
import {
+ getEnabledSignInProviders,
+ type RecordlyOAuthProvider,
sendSignInLink,
- signInWithEmail,
signInWithSocial,
signOutRecordly,
} from "@/lib/auth/recordlyAuth";
@@ -73,19 +79,52 @@ export function RecordlySignInDialog({
const { t } = useI18n();
const awaitingSignIn = useRef(false);
const wide = onboarding || variant === "wide";
- const [featureStep, setFeatureStep] = useState(-1);
- const feature = onboarding && featureStep >= 0;
+ const [showPermissions, setShowPermissions] = useState(false);
+ const requiresSignIn = onboarding && !user;
+ const permissions = onboarding && Boolean(user) && showPermissions;
const [email, setEmail] = useState("");
- const [password, setPassword] = useState("");
- const demoEmail = demoLoginEnabled && email.trim().toLowerCase() === "[email protected]";
+ const validEmail = /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim());
const [busy, setBusy] = useState<string>();
const [message, setMessage] = useState<string>();
const [linkSent, setLinkSent] = useState(false);
+ const [providers, setProviders] = useState<RecordlyOAuthProvider[]>([]);
+ const [loadingProviders, setLoadingProviders] = useState(false);
+
+ useEffect(() => {
+ if (!open || !configured || user) return;
+ let disposed = false;
+ const controller = new AbortController();
+ const timeout = window.setTimeout(() => controller.abort(), 10000);
+ setLoadingProviders(true);
+ setProviders([]);
+ void getEnabledSignInProviders(controller.signal)
+ .then((enabled) => {
+ if (!controller.signal.aborted) setProviders(enabled);
+ })
+ .catch(() => {
+ // Email remains available to retry when provider discovery cannot reach Auth.
+ })
+ .finally(() => {
+ window.clearTimeout(timeout);
+ if (!disposed) setLoadingProviders(false);
+ });
+ return () => {
+ disposed = true;
+ window.clearTimeout(timeout);
+ controller.abort();
+ };
+ }, [open, configured, user]);
+
+ useEffect(() => {
+ if (open && callbackError) {
+ setMessage(callbackError);
+ setLinkSent(false);
+ }
+ }, [open, callbackError]);
useEffect(() => {
if (!open) {
- setPassword("");
- setFeatureStep(-1);
+ setShowPermissions(false);
awaitingSignIn.current = false;
setBusy(undefined);
setMessage(undefined);
@@ -94,8 +133,8 @@ export function RecordlySignInDialog({
}, [open]);
useEffect(() => {
- if (open && startWithPermissions) setFeatureStep(0);
- }, [open, startWithPermissions]);
+ if (open && startWithPermissions && user) setShowPermissions(true);
+ }, [open, startWithPermissions, user]);
useEffect(() => {
if (!open) return;
@@ -103,7 +142,7 @@ export function RecordlySignInDialog({
else if (awaitingSignIn.current) {
awaitingSignIn.current = false;
setMessage(undefined);
- if (onboarding) setFeatureStep(0);
+ if (onboarding) setShowPermissions(true);
else onAuthenticated();
}
}, [open, user, onAuthenticated, onboarding]);
@@ -123,21 +162,12 @@ export function RecordlySignInDialog({
const submitEmail = (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
- if ((!configured && !demoLoginEnabled) || busy) return;
- if (!demoEmail) {
- emailSignInLink();
- return;
- }
- void run("email", async () => {
- if (!configured && email.trim().toLowerCase() !== "[email protected]") {
- throw new Error("Email sign-in is not available yet.");
- }
- await signInWithEmail(email.trim(), password);
- });
+ if (!configured || busy) return;
+ emailSignInLink();
};
const emailSignInLink = () => {
- if (!email.trim() || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email.trim())) {
+ if (!validEmail) {
setMessage(t("editor.cloud.enterEmail"));
return;
}
@@ -153,292 +183,345 @@ export function RecordlySignInDialog({
const reduceMotion = useReducedMotion();
const transition = { duration: reduceMotion ? 0 : 0.28, ease: [0.22, 1, 0.36, 1] as const };
const reveal = {
- initial: { opacity: 0, y: reduceMotion ? 0 : 10 },
+ initial: { opacity: 0, y: reduceMotion || onboarding ? 0 : 10 },
animate: { opacity: 1, y: 0 },
transition,
};
+ const carouselMotion = {
+ enter: (direction: number) => ({
+ opacity: reduceMotion ? 1 : 0,
+ x: reduceMotion ? 0 : direction * 32,
+ }),
+ center: { opacity: 1, x: 0 },
+ exit: (direction: number) => ({
+ opacity: reduceMotion ? 1 : 0,
+ x: reduceMotion ? 0 : direction * -32,
+ transition: { ...transition, duration: reduceMotion ? 0 : 0.18 },
+ }),
+ };
const disabled = Boolean(busy);
- const expanded = email.trim().length > 0;
const artwork = `${import.meta.env.BASE_URL}auth/login-banner.png`;
+ const SignInBody = onboarding ? OnboardingBody : Fragment;
+ const signInContent = (
+ <motion.div
+ layout={onboarding ? false : "position"}
+ transition={transition}
+ className={
+ onboarding
+ ? "flex h-full min-h-0 flex-col"
+ : `flex flex-1 flex-col justify-center px-5 py-6 sm:px-8 ${wide ? "md:order-1 md:min-w-0" : ""}`
+ }
+ >
+ <SignInBody>
+ <div
+ className={
+ onboarding
+ ? "space-y-6 @container"
+ : "w-full max-w-[420px] self-center space-y-4 @container"
+ }
+ >
+ <motion.div {...reveal}>
+ {onboarding ? (
+ <OnboardingHeader
+ title={user ? "Your account" : "Welcome to Recordly"}
+ description={
+ user
+ ? user.email || "You’re signed in and ready to continue."
+ : "Sign in to Recordly to start recording, save your work and share it."
+ }
+ />
+ ) : (
+ <Modal.Header className="items-center gap-3 text-center">
+ <div className="flex items-center gap-3" aria-label="Recordly">
+ <img
+ src={`${import.meta.env.BASE_URL}app-icons/recordly-128.png`}
+ alt=""
+ className="size-12 rounded-xl"
+ />
+ <span className="text-3xl font-semibold tracking-tight">
+ Recordly
+ </span>
+ </div>
+ <Modal.Heading className="whitespace-nowrap text-[clamp(12px,5cqw,22px)] font-semibold leading-tight tracking-tight">
+ {user
+ ? "Your account"
+ : "Beautiful, shareable screen recordings"}
+ </Modal.Heading>
+ <Description className="text-sm">
+ {user ? user.email : "Sign in to get started"}
+ </Description>
+ </Modal.Header>
+ )}
+ </motion.div>
+ {user && onboarding ? null : user ? (
+ <Button
+ variant="secondary"
+ className="w-full"
+ isDisabled={disabled}
+ onPress={() =>
+ void run("signout", async () => {
+ await signOutRecordly();
+ onOpenChange(false);
+ })
+ }
+ >
+ <SignOut className="size-4" />
+ {busy === "signout"
+ ? t("editor.cloud.signingOut")
+ : t("editor.cloud.signOut")}
+ </Button>
+ ) : (
+ <>
+ {loadingProviders ? (
+ <div
+ role="status"
+ aria-label="Loading sign-in options"
+ className="h-11 rounded-xl bg-surface-secondary"
+ />
+ ) : providers.length > 0 ? (
+ <motion.div
+ {...reveal}
+ transition={{
+ ...transition,
+ delay: reduceMotion ? 0 : 0.05,
+ }}
+ className="flex gap-2"
+ >
+ {(
+ [
+ {
+ provider: "google",
+ label: "Google",
+ image: "google-logo.png",
+ },
+ {
+ provider: "azure",
+ label: "Microsoft",
+ image: "microsoft-logo.svg",
+ },
+ {
+ provider: "github",
+ label: "GitHub",
+ image: null,
+ },
+ ] as const
+ )
+ .filter(({ provider }) => providers.includes(provider))
+ .map(({ provider, label, image }) => (
+ <Button
+ key={provider}
+ variant="secondary"
+ aria-label={`Continue with ${label}`}
+ className="h-11 w-full min-w-0 gap-2 rounded-xl px-2 text-xs font-medium text-foreground @[360px]:text-sm"
+ isDisabled={disabled || !configured}
+ onPress={() =>
+ void run(provider, () =>
+ signInWithSocial(provider),
+ )
+ }
+ >
+ {image ? (
+ <img
+ src={`${import.meta.env.BASE_URL}auth/${image}`}
+ alt=""
+ className="size-4 shrink-0"
+ />
+ ) : (
+ <GithubLogo
+ aria-hidden="true"
+ weight="fill"
+ className="size-4 shrink-0"
+ />
+ )}
+ {label}
+ </Button>
+ ))}
+ </motion.div>
+ ) : null}
+ {(loadingProviders || providers.length > 0) && (
+ <div className="flex items-center gap-4">
+ <Separator className="flex-1" />
+ <span className="text-xs text-muted">
+ or continue with email
+ </span>
+ <Separator className="flex-1" />
+ </div>
+ )}
+ <Form className="flex flex-col" onSubmit={submitEmail}>
+ <TextField
+ name="email"
+ type="email"
+ value={email}
+ onChange={(value) => {
+ setEmail(value);
+ setLinkSent(false);
+ setMessage(undefined);
+ }}
+ isRequired
+ isDisabled={disabled}
+ >
+ <Label>Email</Label>
+ <Input
+ className={onboarding ? "h-11" : "h-12"}
+ placeholder="[email protected]"
+ autoComplete="email"
+ />
+ <FieldError />
+ </TextField>
+ <AnimatePresence initial={false}>
+ {validEmail && (
+ <motion.div
+ key="magic-link"
+ initial={{
+ height: 0,
+ opacity: 0,
+ y: reduceMotion ? 0 : -6,
+ }}
+ animate={{ height: "auto", opacity: 1, y: 0 }}
+ exit={{
+ height: 0,
+ opacity: 0,
+ y: reduceMotion ? 0 : -6,
+ }}
+ transition={transition}
+ className="w-full overflow-hidden"
+ >
+ <Button
+ type="submit"
+ variant="primary"
+ className={
+ onboarding
+ ? "mt-3 h-11 w-full rounded-xl"
+ : "mt-3 h-12 w-full"
+ }
+ isDisabled={disabled || !configured}
+ >
+ {busy === "link"
+ ? "Sending sign-in link…"
+ : "Email me a magic link"}
+ </Button>
+ </motion.div>
+ )}
+ </AnimatePresence>
+ </Form>
+ </>
+ )}
+ {message ? (
+ <Alert status={linkSent ? "success" : "danger"}>
+ <Alert.Indicator />
+ <Alert.Content>
+ <Alert.Description>{message}</Alert.Description>
+ </Alert.Content>
+ </Alert>
+ ) : null}
+ {!configured && !user && (
+ <Description role="status">{t("editor.cloud.unavailable")}</Description>
+ )}
+ </div>
+ </SignInBody>
+ {onboarding && user && (
+ <OnboardingFooter>
+ <div className="flex w-full justify-end">
+ <Button
+ variant="primary"
+ isDisabled={disabled}
+ onPress={() => setShowPermissions(true)}
+ >
+ Continue <ArrowRight size={16} />
+ </Button>
+ </div>
+ </OnboardingFooter>
+ )}
+ </motion.div>
+ );
return (
- <Modal isOpen={open} onOpenChange={onOpenChange}>
- <Modal.Backdrop>
- <Modal.Container size="cover" placement="center" className="p-4 sm:p-8">
+ <Modal
+ isOpen={open}
+ onOpenChange={(value) => {
+ if (value || !requiresSignIn) onOpenChange(value);
+ }}
+ >
+ <Modal.Backdrop
+ isDismissable={!requiresSignIn}
+ isKeyboardDismissDisabled={requiresSignIn}
+ >
+ <Modal.Container
+ size="cover"
+ placement="center"
+ className={onboarding ? "p-4" : "p-4 sm:p-8"}
+ >
<MotionDialog
layout={!onboarding}
transition={transition}
aria-label={onboarding ? "Welcome to Recordly" : undefined}
data-onboarding-state={
- onboarding ? (feature ? "feature" : "login") : undefined
+ onboarding ? (permissions ? "permissions" : "login") : undefined
+ }
+ className={
+ onboarding
+ ? "h-[min(760px,calc(100dvh-32px))] min-h-0 w-full max-w-[720px] gap-0 overflow-hidden rounded-3xl p-0"
+ : `h-auto min-h-0 w-full max-h-[calc(100dvh-48px)] gap-0 overflow-y-auto rounded-[32px] p-2 ${wide ? "max-w-[1120px] md:grid md:grid-cols-2 md:aspect-[28/19]" : "max-w-[600px]"}`
}
- className={`h-auto min-h-0 w-full max-h-[calc(100dvh-48px)] gap-0 overflow-y-auto rounded-[32px] p-2 ${wide ? `max-w-[1120px] md:grid ${feature ? "md:grid-cols-1 md:aspect-[16/10]" : "md:grid-cols-2 md:aspect-[28/19]"}` : "max-w-[600px]"}`}
>
- <div
- data-onboarding-artwork={onboarding || undefined}
- className={`relative shrink-0 overflow-hidden rounded-[24px] ${feature ? "h-[min(680px,calc(100dvh-96px))] min-h-[440px] md:col-span-full md:h-full" : `h-32 sm:h-36 ${wide ? "md:order-2 md:h-full md:min-h-0" : ""}`}`}
- >
- <motion.img
- layout={onboarding && !reduceMotion}
- transition={{ ...transition, duration: reduceMotion ? 0 : 0.5 }}
- src={
- wide
- ? `${import.meta.env.BASE_URL}auth/login-side.png`
- : artwork
+ {onboarding ? (
+ <OnboardingLayout
+ stage={permissions ? "permissions" : "account"}
+ canViewPermissions={Boolean(user)}
+ onStageChange={(stage) =>
+ setShowPermissions(stage === "permissions" && Boolean(user))
}
- alt=""
- className="absolute inset-0 size-full object-cover object-center"
- />
- {feature && (
- <OnboardingFeature
- onBack={() => setFeatureStep(-1)}
- onFinish={onAuthenticated}
- />
- )}
- </div>
- <Modal.CloseTrigger
- aria-label={t("common.actions.close")}
- className="z-20"
- />
-
- {!feature && (
- <motion.div
- layout="position"
- transition={transition}
- className={`flex flex-1 flex-col justify-center px-5 py-6 sm:px-8 ${wide ? "md:order-1 md:min-w-0" : ""}`}
>
- <div className="w-full max-w-[420px] self-center space-y-4 @container">
- <motion.div {...reveal}>
- <Modal.Header className="items-center gap-3 text-center">
- <div
- className="flex items-center gap-3"
- aria-label="Recordly"
- >
- <img
- src={`${import.meta.env.BASE_URL}app-icons/recordly-128.png`}
- alt=""
- className="size-12 rounded-xl"
- />
- <span className="text-3xl font-semibold tracking-tight">
- Recordly
- </span>
- </div>
- <Modal.Heading className="whitespace-nowrap text-[clamp(12px,5cqw,22px)] font-semibold leading-tight tracking-tight">
- {user
- ? "Your account"
- : "Beautiful, shareable screen recordings"}
- </Modal.Heading>
- <Description className="text-sm">
- {user ? user.email : "Sign in to get started"}
- </Description>
- </Modal.Header>
- </motion.div>
- {user && onboarding ? (
- <Button
- variant="primary"
- className="w-full"
- onPress={() => setFeatureStep(0)}
- >
- Continue
- </Button>
- ) : user ? (
- <Button
- variant="secondary"
- className="w-full"
- isDisabled={disabled}
- onPress={() => void run("signout", signOutRecordly)}
- >
- <SignOut className="size-4" />
- {busy === "signout"
- ? t("editor.cloud.signingOut")
- : t("editor.cloud.signOut")}
- </Button>
- ) : (
- <>
- <motion.div
- {...reveal}
- transition={{
- ...transition,
- delay: reduceMotion ? 0 : 0.05,
+ <AnimatePresence
+ initial={false}
+ mode="wait"
+ custom={permissions ? 1 : -1}
+ >
+ <motion.div
+ key={permissions ? "permissions" : "account"}
+ custom={permissions ? 1 : -1}
+ variants={carouselMotion}
+ initial="enter"
+ animate="center"
+ exit="exit"
+ transition={transition}
+ className="flex h-full min-h-0 flex-col"
+ >
+ {permissions ? (
+ <OnboardingPermissions
+ onBack={() => setShowPermissions(false)}
+ onFinish={() => {
+ if (user) onAuthenticated();
}}
- className="grid grid-cols-3 gap-2"
- >
- {(
- [
- {
- provider: "google",
- label: "Google",
- image: "google-logo.png",
- },
- {
- provider: "azure",
- label: "Microsoft",
- image: "microsoft-logo.svg",
- },
- {
- provider: "github",
- label: "GitHub",
- image: null,
- },
- ] as const
- ).map(({ provider, label, image }) => (
- <Button
- key={provider}
- variant="secondary"
- aria-label={`Continue with ${label}`}
- className="h-11 w-full min-w-0 gap-2 rounded-xl px-2 text-xs font-medium text-foreground @[360px]:text-sm"
- isDisabled={disabled || !configured}
- onPress={() =>
- void run(provider, () =>
- signInWithSocial(provider),
- )
- }
- >
- {image ? (
- <img
- src={`${import.meta.env.BASE_URL}auth/${image}`}
- alt=""
- className="size-4 shrink-0"
- />
- ) : (
- <GithubLogo
- aria-hidden="true"
- weight="fill"
- className="size-4 shrink-0"
- />
- )}
- {label}
- </Button>
- ))}
- </motion.div>
- <div className="flex items-center gap-4">
- <Separator className="flex-1" />
- <span className="text-xs text-muted">
- or continue with email
- </span>
- <Separator className="flex-1" />
- </div>
- <Form className="flex flex-col" onSubmit={submitEmail}>
- <TextField
- name="email"
- type="email"
- value={email}
- onChange={(value) => {
- setEmail(value);
- setLinkSent(false);
- setMessage(undefined);
- if (!value.trim()) setPassword("");
- }}
- isRequired
- isDisabled={disabled}
- >
- <Label>Email</Label>
- <Input
- className="h-12"
- placeholder="[email protected]"
- autoComplete="email"
- />
- <FieldError />
- </TextField>
- {!demoEmail && (
- <Button
- type="submit"
- variant="primary"
- className="mt-3 h-12 w-full"
- isDisabled={disabled || !configured}
- >
- {busy === "link"
- ? "Sending sign-in link…"
- : "Email me a magic link"}
- </Button>
- )}
- <AnimatePresence initial={false}>
- {expanded && demoEmail && (
- <motion.div
- key="password-fields"
- initial={{ height: 0, opacity: 0 }}
- animate={{ height: "auto", opacity: 1 }}
- exit={{ height: 0, opacity: 0 }}
- transition={transition}
- className="overflow-hidden"
- inert={!expanded}
- >
- <motion.div
- initial={{
- y: reduceMotion ? 0 : -8,
- }}
- animate={{ y: 0 }}
- exit={{ y: reduceMotion ? 0 : -8 }}
- transition={transition}
- className="flex flex-col gap-5 px-1 pb-1 pt-5"
- >
- <TextField
- name="password"
- type="password"
- value={password}
- onChange={setPassword}
- isRequired
- isDisabled={disabled}
- >
- <Label>Password</Label>
- <Input
- className="h-12"
- autoComplete="current-password"
- />
- <FieldError />
- </TextField>
- <Button
- type="submit"
- size="lg"
- className="w-full"
- isDisabled={
- disabled ||
- (!configured &&
- !demoLoginEnabled)
- }
- >
- {busy === "email"
- ? t(
- "editor.cloud.signingIn",
- )
- : "Sign in"}
- </Button>
- </motion.div>
- </motion.div>
- )}
- </AnimatePresence>
- </Form>
- </>
- )}
- {onboarding && !user && (
- <Button
- variant="ghost"
- className="w-full"
- onPress={() => setFeatureStep(0)}
- >
- Continue without signing in
- </Button>
- )}
- {message || callbackError ? (
- <Alert
- status={
- linkSent && !callbackError ? "success" : "danger"
- }
- >
- <Alert.Indicator />
- <Alert.Content>
- <Alert.Description>
- {message || callbackError}
- </Alert.Description>
- </Alert.Content>
- </Alert>
- ) : null}
- {!configured && !demoLoginEnabled && !user && (
- <Description role="status">
- {t("editor.cloud.unavailable")}
- </Description>
- )}
+ />
+ ) : (
+ signInContent
+ )}
+ </motion.div>
+ </AnimatePresence>
+ </OnboardingLayout>
+ ) : (
+ <>
+ <div
+ className={`relative shrink-0 overflow-hidden rounded-[24px] h-32 sm:h-36 ${wide ? "md:order-2 md:h-full md:min-h-0" : ""}`}
+ >
+ <img
+ src={
+ wide
+ ? `${import.meta.env.BASE_URL}auth/login-side.png`
+ : artwork
+ }
+ alt=""
+ className="absolute inset-0 size-full object-cover object-center"
+ />
</div>
- </motion.div>
+ {signInContent}
+ </>
+ )}
+ {!requiresSignIn && (
+ <Modal.CloseTrigger
+ aria-label={t("common.actions.close")}
+ className="z-20"
+ />
)}
</MotionDialog>
</Modal.Container>
diff --git a/src/components/auth/useRecordlyAuth.ts b/src/components/auth/useRecordlyAuth.ts
index c729244e..b5da8b6e 100644
--- a/src/components/auth/useRecordlyAuth.ts
+++ b/src/components/auth/useRecordlyAuth.ts
@@ -1,6 +1,5 @@
-import { demoUser, hasDemoSession, subscribeDemoSession } from "@/lib/auth/demoSession";
import type { User } from "@supabase/supabase-js";
-import { useEffect, useRef, useState, useSyncExternalStore } from "react";
+import { useEffect, useRef, useState } from "react";
import {
completeAuthCallback,
recordlyAuth,
@@ -8,7 +7,6 @@ import {
} from "@/lib/auth/recordlyAuth";
export function useRecordlyAuth() {
- const demo = useSyncExternalStore(subscribeDemoSession, hasDemoSession, () => false);
const [user, setUser] = useState<User | null>(null);
const [accessToken, setAccessToken] = useState<string>();
const [loading, setLoading] = useState(recordlyAuthConfigured);
@@ -24,7 +22,8 @@ export function useRecordlyAuth() {
let mounted = true;
void recordlyAuth.auth
.getSession()
- .then(({ data }) => {
+ .then(({ data, error }) => {
+ if (error) throw error;
if (mounted) {
setUser(data.session?.user ?? null);
setAccessToken(data.session?.access_token);
@@ -70,8 +69,8 @@ export function useRecordlyAuth() {
}, []);
return {
- user: demo ? demoUser : user,
- accessToken: demo ? undefined : accessToken,
+ user: user?.is_anonymous ? null : user,
+ accessToken: user?.is_anonymous ? undefined : accessToken,
loading,
configured: recordlyAuthConfigured,
callbackError,
diff --git a/src/components/launch/hooks/useWebcamPreviewOverlay.ts b/src/components/launch/hooks/useWebcamPreviewOverlay.ts
index ed527e9a..2cd69806 100644
--- a/src/components/launch/hooks/useWebcamPreviewOverlay.ts
+++ b/src/components/launch/hooks/useWebcamPreviewOverlay.ts
@@ -1,6 +1,7 @@
import { type PointerEvent, useCallback, useEffect, useRef, useState } from "react";
import {
canShowFloatingWebcamPreview,
+ DEFAULT_WEBCAM_PREVIEW_SIZE,
parseWebcamPreviewSize,
resizeWebcamPreview,
WEBCAM_PREVIEW_SIZE_STORAGE_KEY,
@@ -48,9 +49,13 @@ export function useWebcamPreviewOverlay({
const [showFloatingWebcamPreview, setShowFloatingWebcamPreview] = useState(true);
const [webcamPreviewOffset, setWebcamPreviewOffset] = useState(DEFAULT_WEBCAM_PREVIEW_OFFSET);
const webcamPreviewOffsetRef = useRef(DEFAULT_WEBCAM_PREVIEW_OFFSET);
- const [webcamPreviewSize, setWebcamPreviewSize] = useState(() =>
- parseWebcamPreviewSize(localStorage.getItem(WEBCAM_PREVIEW_SIZE_STORAGE_KEY)),
- );
+ const [webcamPreviewSize, setWebcamPreviewSize] = useState(() => {
+ try {
+ return parseWebcamPreviewSize(localStorage.getItem(WEBCAM_PREVIEW_SIZE_STORAGE_KEY));
+ } catch {
+ return DEFAULT_WEBCAM_PREVIEW_SIZE;
+ }
+ });
const webcamPreviewResizeRef = useRef<{
pointerId: number;
handle: WebcamPreviewResizeHandle;
@@ -273,7 +278,14 @@ export function useWebcamPreviewOverlay({
isWebcamPreviewDraggingRef.current = false;
setWebcamPreviewSize(resizeState.size);
setWebcamPreviewOffset({ ...webcamPreviewOffsetRef.current });
- localStorage.setItem(WEBCAM_PREVIEW_SIZE_STORAGE_KEY, JSON.stringify(resizeState.size));
+ try {
+ localStorage.setItem(
+ WEBCAM_PREVIEW_SIZE_STORAGE_KEY,
+ JSON.stringify(resizeState.size),
+ );
+ } catch {
+ // Keep resizing and pointer cleanup working when preferences cannot be saved.
+ }
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
event.currentTarget.releasePointerCapture(event.pointerId);
}
diff --git a/src/components/video-editor/SettingsPanel.tsx b/src/components/video-editor/SettingsPanel.tsx
index 0c4bf36c..89974d14 100644
--- a/src/components/video-editor/SettingsPanel.tsx
+++ b/src/components/video-editor/SettingsPanel.tsx
@@ -1,3 +1,6 @@
+import type { User } from "@supabase/supabase-js";
+import { AccountSettings } from "@/components/auth/AccountSettings";
+import { RecordingPermissionsSettings } from "@/components/auth/RecordingPermissionsSettings";
import { SettingsSections, SettingsCategory } from "./SettingsSections";
import { Card, RadioGroup, Radio, Label, Description } from "@heroui/react";
import { ProgressBar } from "@heroui/react";
@@ -419,6 +422,7 @@ function CursorClickEffectCards({
}
interface SettingsPanelProps {
+ accountUser?: User | null;
onShowOnboarding?: () => void;
advanced?: boolean;
panelMode?: "editor" | "background";
@@ -876,6 +880,7 @@ function CursorStylePreview({
}
export function SettingsPanel({
+ accountUser = null,
onShowOnboarding,
advanced = false,
panelMode = "editor",
@@ -2250,8 +2255,18 @@ export function SettingsPanel({
const effectSectionContent = (() => {
const settingsSectionContent = (
<SettingsSections
- categories={advanced ? ["general", "motion", "advanced"] : ["general", "motion"]}
+ categories={
+ advanced
+ ? ["general", "account", "permissions", "motion", "advanced"]
+ : ["general", "account", "permissions", "motion"]
+ }
>
+ <SettingsCategory category="account">
+ <AccountSettings key={accountUser?.id ?? "signed-out"} user={accountUser} />
+ </SettingsCategory>
+ <SettingsCategory category="permissions">
+ <RecordingPermissionsSettings onReview={onShowOnboarding} />
+ </SettingsCategory>
<SettingsCategory category="general">
{onShowOnboarding && (
<SettingsRow title="Onboarding">
diff --git a/src/components/video-editor/SettingsSections.tsx b/src/components/video-editor/SettingsSections.tsx
index 22215ffe..8f5f37d8 100644
--- a/src/components/video-editor/SettingsSections.tsx
+++ b/src/components/video-editor/SettingsSections.tsx
@@ -1,9 +1,18 @@
import { createContext, useContext, useState, type ReactNode } from "react";
import { ChoiceGroup, ChoiceItem } from "@/components/ui/choice-group";
-type Category = "general" | "motion" | "recording" | "files" | "advanced";
+type Category =
+ | "general"
+ | "account"
+ | "permissions"
+ | "motion"
+ | "recording"
+ | "files"
+ | "advanced";
const labels: Record<Category, string> = {
general: "General",
+ account: "Account",
+ permissions: "Permissions",
motion: "Motion",
recording: "Recording",
files: "Files",
diff --git a/src/components/video-editor/cloud/SharedRecordings.tsx b/src/components/video-editor/cloud/SharedRecordings.tsx
index e73323b6..71486eea 100644
--- a/src/components/video-editor/cloud/SharedRecordings.tsx
+++ b/src/components/video-editor/cloud/SharedRecordings.tsx
@@ -215,14 +215,18 @@ export function SharedRecordings({
return (
<section className="space-y-3 border-b border-foreground/10 pb-4">
<div className="flex items-center justify-between gap-2">
- <Button
- variant="ghost"
- size="sm"
- onPress={() => setExpanded((value) => !value)}
- aria-expanded={expanded}
- >
- {expanded ? "Hide shared recordings" : "Manage shared recordings"}
- </Button>
+ {standalone ? (
+ <h2 className="text-lg font-semibold">Shared recordings</h2>
+ ) : (
+ <Button
+ variant="ghost"
+ size="sm"
+ onPress={() => setExpanded((value) => !value)}
+ aria-expanded={expanded}
+ >
+ {expanded ? "Hide shared recordings" : "Manage shared recordings"}
+ </Button>
+ )}
{expanded && (
<Button
variant="ghost"
@@ -246,7 +250,11 @@ export function SharedRecordings({
{loading ? (
<LibrarySkeleton />
) : (
- <ul className="max-h-64 space-y-2 overflow-y-auto">
+ <ul
+ className={
+ standalone ? "space-y-2" : "max-h-64 space-y-2 overflow-y-auto"
+ }
+ >
{recordings.map((recording) => (
<li
key={recording.code}
diff --git a/src/components/video-editor/dashboard/DashboardSettings.tsx b/src/components/video-editor/dashboard/DashboardSettings.tsx
index 68f9f43b..49144bca 100644
--- a/src/components/video-editor/dashboard/DashboardSettings.tsx
+++ b/src/components/video-editor/dashboard/DashboardSettings.tsx
@@ -44,8 +44,20 @@ export function DashboardSettings({ onImportFile }: { onImportFile: () => Promis
return (
<section aria-label="Dashboard settings" className="dashboard-settings max-w-2xl py-10">
<h1 className="mb-8 text-lg font-semibold">Settings</h1>
- <SettingsSections categories={["general", "motion", "recording", "files", "advanced"]}>
- <SettingsCategory category={["general", "motion", "advanced"]}>
+ <SettingsSections
+ categories={[
+ "general",
+ "account",
+ "permissions",
+ "motion",
+ "recording",
+ "files",
+ "advanced",
+ ]}
+ >
+ <SettingsCategory
+ category={["general", "account", "permissions", "motion", "advanced"]}
+ >
{settingsContent}
</SettingsCategory>
<SettingsCategory category="files">
diff --git a/src/components/video-editor/layout/EditorShell.tsx b/src/components/video-editor/layout/EditorShell.tsx
index 40af38c4..b4e24c09 100644
--- a/src/components/video-editor/layout/EditorShell.tsx
+++ b/src/components/video-editor/layout/EditorShell.tsx
@@ -140,6 +140,7 @@ export function EditorShell(props: Props) {
() => (
<SettingsPanel
{...settingsPanelProps}
+ accountUser={auth.user}
onShowOnboarding={showOnboarding}
activeEffectSection="settings"
selectedAnnotationId={null}
@@ -147,7 +148,7 @@ export function EditorShell(props: Props) {
advanced
/>
),
- [settingsPanelProps, showOnboarding],
+ [settingsPanelProps, showOnboarding, auth.user],
);
const onboarding = (
<OnboardingController
@@ -361,6 +362,7 @@ export function EditorShell(props: Props) {
}}
settingsPanelProps={{
...settingsPanelProps,
+ accountUser: auth.user,
onShowOnboarding: showOnboarding,
}}
/>
diff --git a/src/components/video-editor/videoPlayback/clipPlayback.test.ts b/src/components/video-editor/videoPlayback/clipPlayback.test.ts
index 7c3eeb19..38d98d90 100644
--- a/src/components/video-editor/videoPlayback/clipPlayback.test.ts
+++ b/src/components/video-editor/videoPlayback/clipPlayback.test.ts
@@ -117,6 +117,60 @@ describe("clip timeline playback", () => {
playback.seek(1.5);
expect(onTime).toHaveBeenLastCalledWith(2, 6);
});
+ it.each([
+ 0.5, 1, 3,
+ ])("resumes at %sx without seeking back to the last animation tick", async (speed) => {
+ const { video, playback, onTime, onSourceSeek } = setup([
+ { id: "clip", startMs: 0, endMs: 4000, sourceStartMs: 2000, speed },
+ ]);
+ playback.seek(0.5);
+ await playback.play();
+ onSourceSeek.mockClear();
+ for (let cycle = 0; cycle < 3; cycle++) {
+ video.currentTime += 0.1 * speed;
+ advance(100);
+ // Media advances between the last RAF callback and the pause click.
+ video.currentTime += 0.01 * speed;
+ playback.pause();
+ const pausedTime = video.currentTime;
+ advance(5000);
+ await playback.play();
+ expect(video.currentTime).toBe(pausedTime);
+ expect(onSourceSeek).not.toHaveBeenCalled();
+ advance(16);
+ expect(onTime).toHaveBeenLastCalledWith(
+ expect.closeTo((pausedTime - 2) / speed, 8),
+ expect.closeTo(pausedTime, 8),
+ );
+ }
+ expect(video.play).toHaveBeenCalledTimes(4);
+ });
+ it("resolves a cut reached after the last tick before resuming", async () => {
+ const { video, playback, onTime, onSourceSeek } = setup([
+ { id: "a", startMs: 0, endMs: 1000, sourceStartMs: 0, speed: 1 },
+ { id: "b", startMs: 1000, endMs: 2000, sourceStartMs: 6000, speed: 1 },
+ ]);
+ playback.seek(0.99);
+ await playback.play();
+ video.currentTime = 1;
+ playback.pause();
+ await playback.play();
+ expect(video.currentTime).toBe(6);
+ expect(onTime).toHaveBeenLastCalledWith(1, 6);
+ expect(onSourceSeek).toHaveBeenLastCalledWith("cut");
+ });
+ it("restarts from the retained in-point if media ends between the last tick and pause", async () => {
+ const { video, playback, onTime } = setup([
+ { id: "clip", startMs: 0, endMs: 10000, sourceStartMs: 2000, speed: 1 },
+ ]);
+ playback.seek(9.99);
+ await playback.play();
+ Object.assign(video, { currentTime: 12, ended: true });
+ playback.pause();
+ await playback.play();
+ expect(video.currentTime).toBe(2);
+ expect(onTime).toHaveBeenLastCalledWith(0, 2);
+ });
it("skips a short gap without skipping the next clip in-point when a tick overshoots", async () => {
const { video, playback, onTime } = setup([
{ id: "a", startMs: 0, endMs: 1000, sourceStartMs: 0, speed: 3 },
diff --git a/src/components/video-editor/videoPlayback/clipPlayback.ts b/src/components/video-editor/videoPlayback/clipPlayback.ts
index 755b53b8..efc98b05 100644
--- a/src/components/video-editor/videoPlayback/clipPlayback.ts
+++ b/src/components/video-editor/videoPlayback/clipPlayback.ts
@@ -41,6 +41,20 @@ export function createClipPlayback({
let activeClip: ClipRegion | null = null;
let playRequest = 0;
const duration = () => getTimelineDurationMs(getClips(), 0);
+ const readSourceTime = () => {
+ if (!activeClip || video.seeking) return;
+ timeMs = video.ended
+ ? activeClip.endMs
+ : Math.min(
+ activeClip.endMs,
+ Math.max(
+ activeClip.startMs,
+ activeClip.startMs +
+ (video.currentTime * 1000 - getClipSourceStartMs(activeClip)) /
+ activeClip.speed,
+ ),
+ );
+ };
const pause = () => {
playRequest++;
@@ -59,7 +73,7 @@ export function createClipPlayback({
onError(error);
});
};
- const sync = (seek = false) => {
+ const sync = (seek = false, startSource = false) => {
const clips = getClips();
// Empty timeline space is skipped during playback. Clip positions and
// paused seeks stay intact so editing a gap never moves source footage.
@@ -103,7 +117,7 @@ export function createClipPlayback({
video.currentTime = target;
}
}
- if (playing && (seek || clip !== activeClip)) playSource();
+ if (playing && (startSource || seek || clip !== activeClip)) playSource();
} else {
playRequest++;
video.pause();
@@ -117,19 +131,7 @@ export function createClipPlayback({
// Follow the media inside footage (buffering must not skip content).
// With no clips loaded, elapsed real time is the fallback clock.
if (!activeClip) timeMs += now - lastTick;
- else if (!video.seeking) {
- timeMs = video.ended
- ? activeClip.endMs
- : Math.min(
- activeClip.endMs,
- Math.max(
- activeClip.startMs,
- activeClip.startMs +
- (video.currentTime * 1000 - getClipSourceStartMs(activeClip)) /
- activeClip.speed,
- ),
- );
- }
+ else readSourceTime();
timeMs = Math.min(duration(), timeMs);
lastTick = now;
sync();
@@ -143,11 +145,17 @@ export function createClipPlayback({
},
play: async () => {
if (playing || getClips().length === 0) return;
- if (timeMs >= duration()) timeMs = 0;
+ // Include media progress since the last RAF, including reaching a cut/EOF.
+ // Preserve an explicit seek to the timeline endpoint so Play restarts it.
+ if (timeMs < duration()) readSourceTime();
+ const restart = timeMs >= duration();
+ if (restart) timeMs = 0;
playing = true;
onPlaying(true);
lastTick = performance.now();
- sync(true);
+ // Resume the paused decoder in place. The last RAF timestamp can lag
+ // behind it; seeking there rewinds footage and resets camera/cursor springs.
+ sync(restart, true);
if (playing) request = requestAnimationFrame(tick);
},
pause,
diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts
index 8387fd8b..b9a7f564 100644
--- a/src/hooks/useScreenRecorder.ts
+++ b/src/hooks/useScreenRecorder.ts
@@ -3,6 +3,7 @@ import { fixWebmDuration } from "@fix-webm-duration/fix";
import { useCallback, useEffect, useRef, useState } from "react";
import { toast } from "@/components/ui/toast";
import { getEffectiveRecordingDurationMs } from "@/lib/mediaTiming";
+import { hasRecordlySession } from "@/lib/auth/recordlyAuth";
import {
getVideoExtensionForMimeType,
isWebmMimeType,
@@ -547,6 +548,10 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
}, []);
const preparePermissions = useCallback(async () => {
+ if (!(await hasRecordlySession().catch(() => false))) {
+ await window.electronAPI.showRecordingPermissions();
+ return false;
+ }
if ((await window.electronAPI.getPlatform()) !== "darwin") return true;
const [screen, accessibility] = await Promise.all([
window.electronAPI.getScreenRecordingPermissionStatus(),
@@ -1802,6 +1807,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
if (nativeResult.microphoneFallbackRequired && microphoneEnabled) {
void logNativeCaptureDiagnostics("start-browser-microphone-fallback");
console.info("Using browser microphone processing for this recording.");
+ let unownedMicStream: MediaStream | null = null;
try {
const microphoneConstraints = createProcessedMicrophoneConstraints(
microphoneDeviceId,
@@ -1810,6 +1816,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
micFallbackRequestedConstraints.current = microphoneConstraints;
const micStream =
await navigator.mediaDevices.getUserMedia(microphoneConstraints);
+ unownedMicStream = micStream;
micFallbackTrackSettings.current =
createMicrophoneTrackSettingsSnapshot(micStream);
micFallbackAudioInputDevices.current =
@@ -1842,6 +1849,7 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
if (startWasCancelled()) return;
recorder.start(RECORDER_TIMESLICE_MS);
micFallbackRecorder.current = recorder;
+ unownedMicStream = null;
} catch (micError) {
micFallbackStartDelayMs.current = null;
micFallbackTrackSettings.current = null;
@@ -1860,6 +1868,9 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
: `${getErrorMessage(micError)}. Recording will continue without microphone audio.`,
{ id: MICROPHONE_FALLBACK_ERROR_TOAST_ID, duration: 10000 },
);
+ } finally {
+ // Until the recorder owns it, cancellation or setup failure must release the mic.
+ unownedMicStream?.getTracks().forEach((track) => track.stop());
}
}
if (startWasCancelled()) {
@@ -2249,9 +2260,17 @@ export function useScreenRecorder(): UseScreenRecorderReturn {
} finally {
try {
if (startWasCancelled()) {
- await discardActiveNativeCapture();
- cleanupCapturedMedia();
- await Promise.allSettled([stopMicFallbackRecorder(), stopWebcamRecorder()]);
+ try {
+ await discardActiveNativeCapture();
+ } finally {
+ cleanupCapturedMedia();
+ await Promise.allSettled([
+ stopMicFallbackRecorder(),
+ stopWebcamRecorder(),
+ // This also restores the Windows cursor hidden during browser startup.
+ window.electronAPI.setRecordingState(false),
+ ]);
+ }
}
} catch (error) {
console.warn("Failed to clean up canceled recording startup:", error);
diff --git a/src/lib/auth/demoSession.test.ts b/src/lib/auth/demoSession.test.ts
deleted file mode 100644
index c354aa2e..00000000
--- a/src/lib/auth/demoSession.test.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { afterEach, beforeEach, expect, it, vi } from "vitest";
-
-beforeEach(() => {
- vi.resetModules();
- const values = new Map<string, string>();
- vi.stubGlobal("window", new EventTarget());
- vi.stubGlobal("sessionStorage", {
- getItem: (key: string) => values.get(key) ?? null,
- setItem: (key: string, value: string) => values.set(key, value),
- removeItem: (key: string) => values.delete(key),
- });
-});
-afterEach(() => {
- vi.unstubAllEnvs();
- vi.unstubAllGlobals();
-});
-
-it("notifies local account changes and stores only a session marker", async () => {
- vi.stubEnv("DEV", true);
- const { setDemoSession, hasDemoSession, subscribeDemoSession } = await import("./demoSession");
- const listener = vi.fn();
- const unsubscribe = subscribeDemoSession(listener);
- expect(hasDemoSession()).toBe(false);
- setDemoSession(true);
- expect(hasDemoSession()).toBe(true);
- expect(sessionStorage.getItem("recordly.demo-session")).toBe("1");
- setDemoSession(false);
- expect(hasDemoSession()).toBe(false);
- expect(listener).toHaveBeenCalledTimes(2);
- unsubscribe();
- setDemoSession(true);
- expect(listener).toHaveBeenCalledTimes(2);
-});
-
-it("cannot enable the local demo account in production", async () => {
- vi.stubEnv("DEV", false);
- sessionStorage.setItem("recordly.demo-session", "1");
- const { setDemoSession, hasDemoSession, demoLoginEnabled } = await import("./demoSession");
- setDemoSession(true);
- expect(demoLoginEnabled).toBe(false);
- expect(hasDemoSession()).toBe(false);
-});
diff --git a/src/lib/auth/demoSession.ts b/src/lib/auth/demoSession.ts
deleted file mode 100644
index 045a4b7b..00000000
--- a/src/lib/auth/demoSession.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import type { User } from "@supabase/supabase-js";
-
-// Temporary local UI account. Never creates a Supabase session or cloud access token.
-export const demoLoginEnabled = import.meta.env.DEV;
-const key = "recordly.demo-session";
-const event = "recordly-demo-session-changed";
-export const demoUser: User = {
- id: "recordly-local-demo",
- email: "[email protected]",
- aud: "local-demo",
- app_metadata: {},
- user_metadata: { full_name: "Test User" },
- created_at: "2026-09-23T00:00:00.000Z",
-};
-export function hasDemoSession() {
- return demoLoginEnabled && typeof window !== "undefined" && sessionStorage.getItem(key) === "1";
-}
-export function setDemoSession(active: boolean) {
- if (!demoLoginEnabled) return;
- if (active) sessionStorage.setItem(key, "1");
- else sessionStorage.removeItem(key);
- window.dispatchEvent(new Event(event));
-}
-export function subscribeDemoSession(listener: () => void) {
- window.addEventListener(event, listener);
- return () => window.removeEventListener(event, listener);
-}
diff --git a/src/lib/auth/recordlyAuth.test.ts b/src/lib/auth/recordlyAuth.test.ts
index 7df0cb16..b5bc2cf4 100644
--- a/src/lib/auth/recordlyAuth.test.ts
+++ b/src/lib/auth/recordlyAuth.test.ts
@@ -2,6 +2,9 @@ import { afterEach, beforeEach, expect, it, vi } from "vitest";
const emailOtp = vi.hoisted(() => vi.fn(async (_options: unknown) => ({ error: null })));
const exchange = vi.hoisted(() => vi.fn(async (_code: string) => ({ error: null })));
+const password = vi.hoisted(() => vi.fn());
+const getSession = vi.hoisted(() => vi.fn());
+const signOut = vi.hoisted(() => vi.fn(async () => ({ error: null })));
const oauth = vi.hoisted(() =>
vi.fn(async (_options: unknown) => ({
data: { url: "https://auth.example.test/oauth" },
@@ -10,7 +13,14 @@ const oauth = vi.hoisted(() =>
);
vi.mock("@supabase/supabase-js", () => ({
createClient: () => ({
- auth: { exchangeCodeForSession: exchange, signInWithOAuth: oauth, signInWithOtp: emailOtp },
+ auth: {
+ exchangeCodeForSession: exchange,
+ signInWithOAuth: oauth,
+ signInWithOtp: emailOtp,
+ signInWithPassword: password,
+ getSession,
+ signOut,
+ },
}),
}));
beforeEach(() => {
@@ -18,9 +28,77 @@ beforeEach(() => {
exchange.mockClear();
oauth.mockClear();
emailOtp.mockClear();
+ password.mockReset();
+ getSession.mockReset();
+ signOut.mockClear();
vi.stubEnv("VITE_SUPABASE_URL", "https://auth.example.test");
vi.stubEnv("VITE_SUPABASE_PUBLISHABLE_KEY", "test-key");
});
+
+it("sends former demo credentials to Supabase even during development", async () => {
+ vi.stubEnv("DEV", true);
+ password.mockResolvedValue({
+ data: { user: null },
+ error: new Error("Invalid login credentials"),
+ });
+ const { signInWithEmail } = await import("./recordlyAuth");
+ await expect(signInWithEmail("[email protected]", "1234")).rejects.toThrow(
+ "Invalid login credentials",
+ );
+ expect(password).toHaveBeenCalledExactlyOnceWith({ email: "[email protected]", password: "1234" });
+});
+
+for (const [description, session, error, expected] of [
+ ["signed-in user", { user: { id: "user", is_anonymous: false } }, null, true],
+ ["missing session", null, null, false],
+ ["anonymous user", { user: { id: "guest", is_anonymous: true } }, null, false],
+ ["session error", null, new Error("Session expired"), false],
+] as const) {
+ it(`requires a Supabase session: ${description}`, async () => {
+ getSession.mockResolvedValue({ data: { session }, error });
+ const { hasRecordlySession } = await import("./recordlyAuth");
+ await expect(hasRecordlySession()).resolves.toBe(expected);
+ });
+}
+
+it("does not permit recording when Supabase is unconfigured", async () => {
+ vi.stubEnv("VITE_SUPABASE_URL", "");
+ const { hasRecordlySession } = await import("./recordlyAuth");
+ await expect(hasRecordlySession()).resolves.toBe(false);
+ expect(getSession).not.toHaveBeenCalled();
+});
+
+it("signs out through Supabase", async () => {
+ const { signOutRecordly } = await import("./recordlyAuth");
+ await signOutRecordly();
+ expect(signOut).toHaveBeenCalledOnce();
+});
+
+it("offers only OAuth providers enabled in the configured Supabase project", async () => {
+ const fetchSettings = vi.fn(
+ async () =>
+ new Response(
+ JSON.stringify({ external: { google: true, azure: false, github: false } }),
+ { status: 200 },
+ ),
+ );
+ vi.stubGlobal("fetch", fetchSettings);
+ const { getEnabledSignInProviders } = await import("./recordlyAuth");
+ await expect(getEnabledSignInProviders()).resolves.toEqual(["google"]);
+ expect(fetchSettings).toHaveBeenCalledWith(
+ "https://auth.example.test/auth/v1/settings",
+ expect.objectContaining({ headers: { apikey: "test-key" } }),
+ );
+});
+
+it("reports an unavailable Auth settings endpoint instead of assuming providers are enabled", async () => {
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async () => new Response("Bad Gateway", { status: 502 })),
+ );
+ const { getEnabledSignInProviders } = await import("./recordlyAuth");
+ await expect(getEnabledSignInProviders()).rejects.toThrow("Sign-in is temporarily unavailable");
+});
afterEach(() => {
vi.unstubAllEnvs();
vi.unstubAllGlobals();
diff --git a/src/lib/auth/recordlyAuth.ts b/src/lib/auth/recordlyAuth.ts
index 8b36b787..f6a45f26 100644
--- a/src/lib/auth/recordlyAuth.ts
+++ b/src/lib/auth/recordlyAuth.ts
@@ -1,4 +1,3 @@
-import { demoLoginEnabled, demoUser, hasDemoSession, setDemoSession } from "./demoSession";
import { createClient, type Provider, type User } from "@supabase/supabase-js";
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL?.trim();
@@ -9,6 +8,23 @@ const callbackUrl = import.meta.env.DEV
export const recordlyAuthConfigured = Boolean(supabaseUrl && supabasePublishableKey);
+export type RecordlyOAuthProvider = "google" | "azure" | "github";
+
+export async function getEnabledSignInProviders(
+ signal?: AbortSignal,
+): Promise<RecordlyOAuthProvider[]> {
+ if (!recordlyAuthConfigured) return [];
+ const response = await fetch(`${supabaseUrl}/auth/v1/settings`, {
+ headers: { apikey: supabasePublishableKey! },
+ signal,
+ });
+ if (!response.ok) throw new Error("Sign-in is temporarily unavailable. Please try again.");
+ const settings = await response.json();
+ return (["google", "azure", "github"] as const).filter(
+ (provider) => settings.external?.[provider] === true,
+ );
+}
+
export const recordlyAuth = recordlyAuthConfigured
? createClient(supabaseUrl!, supabasePublishableKey!, {
auth: {
@@ -30,11 +46,6 @@ function requireAuth() {
}
export async function signInWithEmail(email: string, password: string): Promise<User> {
- if (demoLoginEnabled && email.toLowerCase() === "[email protected]") {
- if (password !== "1234") throw new Error("Incorrect email or password.");
- setDemoSession(true);
- return demoUser;
- }
const client = requireAuth();
const { data, error } = await client.auth.signInWithPassword({ email, password });
if (error) throw error;
@@ -103,15 +114,40 @@ async function exchangeAuthCallback(url: string): Promise<void> {
}
export async function signOutRecordly(): Promise<void> {
- if (hasDemoSession()) {
- setDemoSession(false);
- return;
- }
const client = requireAuth();
const { error } = await client.auth.signOut();
if (error) throw error;
}
+export async function updateAccountName(name: string): Promise<User> {
+ const fullName = name.trim();
+ if (!fullName || fullName.length > 80)
+ throw new Error("Enter a name between 1 and 80 characters.");
+ const { data, error } = await requireAuth().auth.updateUser({ data: { full_name: fullName } });
+ if (error) throw error;
+ if (!data.user) throw new Error("Could not update your profile. Please try again.");
+ return data.user;
+}
+
+export async function requestAccountEmailChange(email: string): Promise<User> {
+ const address = email.trim();
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(address))
+ throw new Error("Enter a valid email address.");
+ const { data, error } = await requireAuth().auth.updateUser(
+ { email: address },
+ { emailRedirectTo: callbackUrl },
+ );
+ if (error) throw error;
+ if (!data.user) throw new Error("Could not change your email. Please try again.");
+ return data.user;
+}
+
+export async function hasRecordlySession(): Promise<boolean> {
+ if (!recordlyAuth) return false;
+ const { data, error } = await recordlyAuth.auth.getSession();
+ return !error && Boolean(data.session?.user && !data.session.user.is_anonymous);
+}
+
let lastCallback: { url: string; completion: Promise<void> } | undefined;
export function completeAuthCallback(url: string): Promise<void> {
if (lastCallback?.url === url) return lastCallback.completion;
diff --git a/tests/ui/account-settings.spec.ts b/tests/ui/account-settings.spec.ts
new file mode 100644
index 00000000..ddc9fcea
--- /dev/null
+++ b/tests/ui/account-settings.spec.ts
@@ -0,0 +1,153 @@
+import { expect, test, type Page } from "@playwright/test";
+import { installDesktopBridge } from "./bridge";
+
+async function openAccountSettings(page: Page) {
+ await page.getByRole("radio", { name: "Settings", exact: true }).click();
+ await page.getByRole("row", { name: "Account", exact: true }).click();
+ return page.getByRole("region", { name: "Account settings", exact: true });
+}
+
+test("account settings save the Supabase profile and share it with the dashboard", async ({
+ page,
+}) => {
+ await installDesktopBridge(page);
+ await page.goto("/?windowType=editor");
+ let account = await openAccountSettings(page);
+ await expect(account.getByLabel("Display name", { exact: true })).toHaveValue("Test User");
+ await expect(account.getByRole("list", { name: "Connected sign-in methods" })).toHaveText(
+ "Email magic link",
+ );
+ await expect(account.getByRole("button", { name: "Save profile" })).toBeDisabled();
+ await account.getByLabel("Display name", { exact: true }).fill(" Jordan Chen ");
+ const update = page.waitForRequest(
+ (request) => request.method() === "PUT" && request.url().includes("/auth/v1/user"),
+ );
+ await account.getByRole("button", { name: "Save profile" }).click();
+ expect((await update).postDataJSON().data).toEqual({ full_name: "Jordan Chen" });
+ await expect(account.getByRole("status")).toHaveText("Profile saved.");
+ await expect(account.getByLabel("Display name", { exact: true })).toHaveValue("Jordan Chen");
+ await expect(
+ page
+ .getByRole("button", { name: "Recordly account", exact: true })
+ .locator('[aria-label="Jordan Chen"]'),
+ ).toBeVisible();
+ await page.reload();
+ account = await openAccountSettings(page);
+ await expect(account.getByLabel("Display name", { exact: true })).toHaveValue("Jordan Chen");
+ await page.getByRole("button", { name: "Home", exact: true }).click();
+ const dashboard = page.getByRole("dialog", { name: "Projects dashboard", exact: true });
+ await dashboard.getByRole("button", { name: "Settings", exact: true }).click();
+ await dashboard.getByRole("row", { name: "Account", exact: true }).click();
+ await expect(dashboard.getByLabel("Display name", { exact: true })).toHaveValue("Jordan Chen");
+ await page.screenshot({
+ path: "test-results/dashboard-account-settings.png",
+ animations: "disabled",
+ });
+});
+
+test("email changes use a PKCE confirmation and retain the current email until confirmed", async ({
+ page,
+}) => {
+ await installDesktopBridge(page);
+ await page.goto("/?windowType=editor");
+ const account = await openAccountSettings(page);
+ const change = account.getByRole("button", { name: "Change email", exact: true });
+ await expect(change).toBeDisabled();
+ await account.getByLabel("Email address", { exact: true }).fill("invalid@example");
+ await expect(change).toBeDisabled();
+ await account.getByLabel("Email address", { exact: true }).fill("[email protected]");
+ const update = page.waitForRequest(
+ (request) => request.method() === "PUT" && request.url().includes("/auth/v1/user"),
+ );
+ await change.click();
+ const request = await update;
+ expect(request.postDataJSON()).toMatchObject({
+ email: "[email protected]",
+ code_challenge: expect.any(String),
+ code_challenge_method: "s256",
+ });
+ expect(new URL(request.url()).searchParams.get("redirect_to")).toBe(
+ "http://127.0.0.1:43821/auth/callback",
+ );
+ await expect(account.getByText("[email protected]", { exact: true })).toBeVisible();
+ await expect(account.getByText("Awaiting confirmation: [email protected]")).toBeVisible();
+ await expect(
+ account.getByText("Check your current and new inboxes for confirmation instructions."),
+ ).toBeVisible();
+ await expect(change).toBeDisabled();
+ await page.reload();
+ const restored = await openAccountSettings(page);
+ await expect(restored.getByLabel("Email address", { exact: true })).toHaveValue(
+ );
+ await expect(restored.getByText("Awaiting confirmation: [email protected]")).toBeVisible();
+});
+
+test("account update errors preserve the session and allow retry", async ({ page }) => {
+ await installDesktopBridge(page);
+ let failed = false;
+ await page.route("https://auth.recordly.test/auth/v1/user**", async (route) => {
+ if (route.request().method() !== "PUT" || failed) return route.fallback();
+ failed = true;
+ return route.fulfill({
+ status: 429,
+ json: { msg: "Please wait before updating your profile." },
+ });
+ });
+ await page.goto("/?windowType=editor");
+ const account = await openAccountSettings(page);
+ await account.getByLabel("Display name", { exact: true }).fill("New Name");
+ await account.getByRole("button", { name: "Save profile" }).click();
+ await expect(account.getByRole("alert")).toHaveText(
+ "Please wait before updating your profile.",
+ );
+ await expect(account.getByLabel("Display name", { exact: true })).toHaveValue("New Name");
+ await account.getByRole("button", { name: "Save profile" }).click();
+ await expect(account.getByRole("status")).toHaveText("Profile saved.");
+ await expect(account.getByRole("alert")).toHaveCount(0);
+});
+
+test("signing out from Settings clears the session and brings back required sign-in", async ({
+ page,
+}) => {
+ await installDesktopBridge(page);
+ await page.goto("/?windowType=editor");
+ const account = await openAccountSettings(page);
+ const logout = page.waitForRequest((request) => request.url().includes("/auth/v1/logout"));
+ await account.getByRole("button", { name: "Sign out", exact: true }).click();
+ expect(new URL((await logout).url()).searchParams.get("scope")).toBe("global");
+ await expect(page.locator('[data-onboarding-state="login"]')).toBeVisible();
+ await page.reload();
+ await expect(page.locator('[data-onboarding-state="login"]')).toBeVisible();
+});
+
+test("Settings refreshes macOS permissions and opens the permissions carousel", async ({
+ page,
+}) => {
+ await installDesktopBridge(page);
+ await page.addInitScript(() => {
+ window.electronAPI.getScreenRecordingPermissionStatus = async () => ({
+ success: true,
+ status: document.documentElement.dataset.allowed === "true" ? "granted" : "denied",
+ });
+ window.electronAPI.getAccessibilityPermissionStatus = async () => ({
+ success: true,
+ trusted: document.documentElement.dataset.allowed === "true",
+ prompted: false,
+ });
+ });
+ await page.goto("/?windowType=editor");
+ await page.getByRole("radio", { name: "Settings", exact: true }).click();
+ await page.getByRole("row", { name: "Permissions", exact: true }).click();
+ const permissions = page.getByRole("region", { name: "Permissions settings", exact: true });
+ await expect(permissions.getByText("Required", { exact: true })).toHaveCount(2);
+ await page.evaluate(() => {
+ document.documentElement.dataset.allowed = "true";
+ });
+ await permissions.getByRole("button", { name: "Check again", exact: true }).click();
+ await expect(permissions.getByText("Allowed", { exact: true })).toHaveCount(2);
+ await permissions.getByRole("button", { name: "Review permissions", exact: true }).click();
+ const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await expect(tour).toHaveAttribute("data-onboarding-state", "permissions");
+ await expect(tour.getByRole("button", { name: "Start recording", exact: true })).toBeEnabled();
+});
diff --git a/tests/ui/auth.ts b/tests/ui/auth.ts
new file mode 100644
index 00000000..8a811e1f
--- /dev/null
+++ b/tests/ui/auth.ts
@@ -0,0 +1,66 @@
+import type { Page } from "@playwright/test";
+import type { User } from "@supabase/supabase-js";
+
+const user = {
+ id: "00000000-0000-4000-8000-000000000001",
+ email: "[email protected]",
+ aud: "authenticated",
+ role: "authenticated",
+ app_metadata: { provider: "email", providers: ["email"] },
+ user_metadata: { full_name: "Test User" },
+ created_at: "2026-09-23T00:00:00.000Z",
+ is_anonymous: false,
+};
+
+export async function installSupabaseAuth(page: Page, { signedIn = true } = {}) {
+ const account: User = structuredClone(user);
+ const expiresAt = Math.floor(Date.now() / 1000) + 3600;
+ const encode = (value: unknown) => Buffer.from(JSON.stringify(value)).toString("base64url");
+ const session = {
+ access_token: `${encode({ alg: "HS256", typ: "JWT" })}.${encode({ sub: user.id, exp: expiresAt, role: "authenticated" })}.ui-test-signature`,
+ refresh_token: "ui-test-refresh-token",
+ token_type: "bearer",
+ expires_in: 3600,
+ expires_at: expiresAt,
+ user: account,
+ };
+ await page.route("https://auth.recordly.test/**", async (route) => {
+ const path = new URL(route.request().url()).pathname;
+ if (path === "/auth/v1/settings")
+ return route.fulfill({
+ json: { external: { google: true, azure: true, github: true, email: true } },
+ });
+ if (path === "/auth/v1/token") return route.fulfill({ json: session });
+ if (path === "/auth/v1/user") {
+ if (route.request().method() === "PUT") {
+ const update = route.request().postDataJSON();
+ if (update.data)
+ account.user_metadata = { ...account.user_metadata, ...update.data };
+ if (update.email) account.new_email = update.email;
+ }
+ return route.fulfill({ json: account });
+ }
+ if (path === "/auth/v1/otp") return route.fulfill({ json: {} });
+ if (path === "/auth/v1/logout") return route.fulfill({ status: 204 });
+ return route.fulfill({ status: 503, json: { message: "Service unavailable in UI tests" } });
+ });
+ await page.addInitScript(
+ ({ signedIn, session }) => {
+ if (sessionStorage.getItem("recordly.ui.auth.initialized")) return;
+ sessionStorage.setItem("recordly.ui.auth.initialized", "1");
+ if (signedIn) localStorage.setItem("sb-auth-auth-token", JSON.stringify(session));
+ else localStorage.removeItem("sb-auth-auth-token");
+ },
+ { signedIn, session },
+ );
+}
+
+export async function completeSupabaseSignIn(page: Page) {
+ await page.evaluate(() => {
+ window.dispatchEvent(
+ new CustomEvent("recordly-test-auth-callback", {
+ detail: "recordly-dev://auth/callback?code=ui-auth-code",
+ }),
+ );
+ });
+}
diff --git a/tests/ui/bridge.ts b/tests/ui/bridge.ts
index a6dffadf..2046651d 100644
--- a/tests/ui/bridge.ts
+++ b/tests/ui/bridge.ts
@@ -1,5 +1,11 @@
import type { Page } from "@playwright/test";
-export async function installDesktopBridge(page: Page, videoFixture = "preview.mp4") {
+import { installSupabaseAuth } from "./auth";
+export async function installDesktopBridge(
+ page: Page,
+ videoFixture = "preview.mp4",
+ auth = { signedIn: true },
+) {
+ await installSupabaseAuth(page, auth);
await page.addInitScript((videoFixture) => {
const success = async () => ({ success: true });
const subscribe = () => () => undefined;
@@ -104,7 +110,13 @@ export async function installDesktopBridge(page: Page, videoFixture = "preview.m
finishRecordingImport: success,
setCurrentRecordingSession: success,
setHasUnsavedChanges: success,
- onAuthCallbackUrl: subscribe,
+ onAuthCallbackUrl: (callback: (url: string) => void) => {
+ const listener = (event: Event) =>
+ callback((event as CustomEvent<string>).detail);
+ window.addEventListener("recordly-test-auth-callback", listener);
+ return () =>
+ window.removeEventListener("recordly-test-auth-callback", listener);
+ },
onProjectThumbnailReady: subscribe,
getPendingAuthCallbackUrl: async () => null,
ackAuthCallbackUrl: success,
diff --git a/tests/ui/feedback.spec.ts b/tests/ui/feedback.spec.ts
index cf232129..727117ec 100644
--- a/tests/ui/feedback.spec.ts
+++ b/tests/ui/feedback.spec.ts
@@ -5,7 +5,6 @@ test("feedback preserves a draft on failure, supports attachments, and includes
page,
}) => {
await installDesktopBridge(page);
- await page.addInitScript(() => sessionStorage.setItem("recordly.demo-session", "1"));
await page.goto("/?windowType=editor");
await page.getByRole("button", { name: "Feedback", exact: true }).click();
const modal = page.getByRole("dialog", { name: "Send feedback", exact: true });
@@ -27,7 +26,7 @@ test("feedback preserves a draft on failure, supports attachments, and includes
await expect(modal.getByRole("checkbox")).toHaveCount(0);
await expect(modal.getByLabel("Title", { exact: true })).toHaveCount(0);
await modal.getByRole("button", { name: "Send feedback", exact: true }).click();
- await expect(modal.getByRole("alert")).toContainText(/sign in again|unavailable/i);
+ await expect(modal.getByRole("alert")).toHaveText("Could not send feedback. Please try again.");
await expect(modal.getByLabel("Subject", { exact: true })).toHaveValue("Export stops early");
await modal.getByLabel("Subject", { exact: true }).fill("Export stops early (updated)");
await expect(modal.getByRole("alert")).toHaveCount(0);
diff --git a/tests/ui/hud-layout.spec.ts b/tests/ui/hud-layout.spec.ts
index 178dd73d..fb1e8d6a 100644
--- a/tests/ui/hud-layout.spec.ts
+++ b/tests/ui/hud-layout.spec.ts
@@ -109,56 +109,77 @@ test("New recording mode starts the webcam with an editor still open and release
.toBe(true);
});
-test("floating webcam preview resizes from its corners and remembers the size", async ({
- page,
-}) => {
- await installDesktopBridge(page);
- await page.addInitScript(() => {
- window.electronAPI.getRecordingPreferences = async () => ({
- success: true,
- microphoneEnabled: false,
- webcamEnabled: true,
- systemAudioEnabled: false,
+for (const storageBlocked of [false, true]) {
+ test(`floating webcam preview resizes from its corners ${storageBlocked ? "when storage is unavailable" : "and remembers the size"}`, async ({
+ page,
+ }) => {
+ const errors: string[] = [];
+ page.on("pageerror", (error) => errors.push(error.message));
+ await installDesktopBridge(page);
+ if (storageBlocked) {
+ await page.addInitScript(() => {
+ const getItem = Storage.prototype.getItem;
+ const setItem = Storage.prototype.setItem;
+ Storage.prototype.getItem = function (key) {
+ if (key === "recordly.webcam-preview-size")
+ throw new Error("Storage unavailable");
+ return getItem.call(this, key);
+ };
+ Storage.prototype.setItem = function (key, value) {
+ if (key === "recordly.webcam-preview-size")
+ throw new Error("Storage unavailable");
+ return setItem.call(this, key, value);
+ };
+ });
+ }
+ await page.addInitScript(() => {
+ window.electronAPI.getRecordingPreferences = async () => ({
+ success: true,
+ microphoneEnabled: false,
+ webcamEnabled: true,
+ systemAudioEnabled: false,
+ });
+ navigator.mediaDevices.getUserMedia = async () => {
+ const canvas = document.createElement("canvas");
+ canvas.getContext("2d")!.fillRect(0, 0, 320, 320);
+ return canvas.captureStream(24);
+ };
+ navigator.mediaDevices.enumerateDevices = async () => [];
});
- navigator.mediaDevices.getUserMedia = async () => {
- const canvas = document.createElement("canvas");
- canvas.getContext("2d")!.fillRect(0, 0, 320, 320);
- return canvas.captureStream(24);
- };
- navigator.mediaDevices.enumerateDevices = async () => [];
- });
- await page.goto("/?windowType=hud-overlay");
- const preview = page.locator("[data-resize-handle]").first().locator("..");
- await expect(preview).toBeVisible();
- const before = (await preview.boundingBox())!;
- expect([before.width, before.height]).toEqual([288, 288]);
+ await page.goto("/?windowType=hud-overlay");
+ const preview = page.locator("[data-resize-handle]").first().locator("..");
+ await expect(preview).toBeVisible();
+ const before = (await preview.boundingBox())!;
+ expect([before.width, before.height]).toEqual([288, 288]);
- const dragHandle = async (handle: string, dx: number, dy: number) => {
- const box = (await preview.locator(`[data-resize-handle="${handle}"]`).boundingBox())!;
- await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
- await page.mouse.down();
- await page.mouse.move(box.x + box.width / 2 + dx, box.y + box.height / 2 + dy, {
- steps: 5,
- });
- await page.mouse.up();
- };
+ const dragHandle = async (handle: string, dx: number, dy: number) => {
+ const box = (await preview.locator(`[data-resize-handle="${handle}"]`).boundingBox())!;
+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
+ await page.mouse.down();
+ await page.mouse.move(box.x + box.width / 2 + dx, box.y + box.height / 2 + dy, {
+ steps: 5,
+ });
+ await page.mouse.up();
+ };
- // Top-left grows the preview while the bottom-right corner stays anchored.
- await dragHandle("nw", -60, -40);
- const grown = (await preview.boundingBox())!;
- expect([grown.width, grown.height]).toEqual([348, 328]);
- expect(grown.x + grown.width).toBeCloseTo(before.x + before.width);
- expect(grown.y + grown.height).toBeCloseTo(before.y + before.height);
+ // Top-left grows the preview while the bottom-right corner stays anchored.
+ await dragHandle("nw", -60, -40);
+ const grown = (await preview.boundingBox())!;
+ expect([grown.width, grown.height]).toEqual([348, 328]);
+ expect(grown.x + grown.width).toBeCloseTo(before.x + before.width);
+ expect(grown.y + grown.height).toBeCloseTo(before.y + before.height);
- // Bottom-right shrinks the preview while the top-left corner stays put, down to the minimum.
- await dragHandle("se", -500, -500);
- const shrunk = (await preview.boundingBox())!;
- expect([shrunk.width, shrunk.height]).toEqual([120, 120]);
- expect(shrunk.x).toBeCloseTo(grown.x);
- expect(shrunk.y).toBeCloseTo(grown.y);
+ // Bottom-right shrinks the preview while the top-left corner stays put, down to the minimum.
+ await dragHandle("se", -500, -500);
+ const shrunk = (await preview.boundingBox())!;
+ expect([shrunk.width, shrunk.height]).toEqual([120, 120]);
+ expect(shrunk.x).toBeCloseTo(grown.x);
+ expect(shrunk.y).toBeCloseTo(grown.y);
- await page.reload();
- await expect(preview).toBeVisible();
- const restored = (await preview.boundingBox())!;
- expect([restored.width, restored.height]).toEqual([120, 120]);
-});
+ await page.reload();
+ await expect(preview).toBeVisible();
+ const restored = (await preview.boundingBox())!;
+ expect([restored.width, restored.height]).toEqual(storageBlocked ? [288, 288] : [120, 120]);
+ expect(errors).toEqual([]);
+ });
+}
diff --git a/tests/ui/login.spec.ts b/tests/ui/login.spec.ts
index 868dd32f..97f9b3b4 100644
--- a/tests/ui/login.spec.ts
+++ b/tests/ui/login.spec.ts
@@ -1,106 +1,164 @@
import { expect, test } from "@playwright/test";
import { installDesktopBridge } from "./bridge";
+import { completeSupabaseSignIn } from "./auth";
-test("banner login animates email expansion, rejects incorrect credentials, and persists the local account until sign-out", async ({
- page,
-}) => {
- await installDesktopBridge(page);
+test("sign-in offers only providers enabled in Supabase", async ({ page }) => {
+ await installDesktopBridge(page, "preview.mp4", { signedIn: false });
+ await page.route("https://auth.recordly.test/auth/v1/settings", (route) =>
+ route.fulfill({
+ json: { external: { google: true, azure: false, github: false, email: true } },
+ }),
+ );
await page.goto("/?windowType=editor");
- await page.getByRole("button", { name: "Home", exact: true }).click();
- await page.getByRole("button", { name: "Sign in", exact: true }).click();
- const login = page.getByRole("dialog", {
- name: "Beautiful, shareable screen recordings",
- exact: true,
- });
+ const login = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await expect(login).toBeVisible({ timeout: 20000 });
await expect(
login.getByRole("button", { name: "Continue with Google", exact: true }),
).toBeVisible();
await expect(
login.getByRole("button", { name: "Continue with Microsoft", exact: true }),
- ).toBeVisible();
- await expect(login.getByLabel("Password", { exact: true })).toHaveCount(0);
- await expect(login.getByText("Recordly", { exact: true })).toBeVisible();
- await expect(login.getByText("worth sharing.", { exact: false })).toHaveCount(0);
- for (const provider of ["Google", "Microsoft"]) {
- await expect
- .poll(() =>
- login
- .getByRole("button", { name: `Continue with ${provider}`, exact: true })
- .locator("img")
- .evaluate((image: HTMLImageElement) => image.naturalWidth),
- )
- .toBeGreaterThan(0);
- }
- const heading = await login.getByRole("heading").boundingBox();
- const textSize = await login.getByRole("heading").evaluate((element) => ({
- height: element.clientHeight,
- width: element.clientWidth,
- scrollWidth: element.scrollWidth,
- lineHeight: parseFloat(getComputedStyle(element).lineHeight),
- }));
- expect(textSize.height).toBeLessThanOrEqual(textSize.lineHeight + 1);
- expect(textSize.scrollWidth).toBeLessThanOrEqual(textSize.width);
- const artwork = await login.locator('img[src$="login-banner.png"]').boundingBox();
- expect(artwork!.y + artwork!.height).toBeLessThan(heading!.y);
- await page.keyboard.press("Tab");
- await login.evaluate((element: HTMLElement) => element.focus());
- await expect(login).toHaveCSS("outline-style", "none");
-
- await page.screenshot({ path: "test-results/login.png", animations: "disabled" });
- const collapsed = (await login.boundingBox())!.height;
- await login.getByLabel("Email", { exact: true }).fill("[email protected]");
- await expect
- .poll(async () => (await login.boundingBox())!.height)
- .toBeGreaterThan(collapsed + 80);
- await login.getByLabel("Email", { exact: true }).fill("");
- await expect(login.getByLabel("Password", { exact: true })).toHaveCount(0);
- await expect
- .poll(async () => Math.abs((await login.boundingBox())!.height - collapsed))
- .toBeLessThan(2);
- await login.getByLabel("Email", { exact: true }).fill("[email protected]");
- await login.getByLabel("Password", { exact: true }).fill("incorrect");
- await login.getByRole("button", { name: "Sign in", exact: true }).click();
- await expect(login.getByText("Incorrect email or password.")).toBeVisible();
- await login.getByLabel("Password", { exact: true }).fill("1234");
- await page.screenshot({ path: "test-results/login-expanded.png", animations: "disabled" });
- await page.setViewportSize({ width: 800, height: 600 });
- await login
- .getByRole("heading", { name: "Beautiful, shareable screen recordings", exact: true })
- .scrollIntoViewIfNeeded();
+ ).toHaveCount(0);
await expect(
- login.getByRole("heading", { name: "Beautiful, shareable screen recordings", exact: true }),
- ).toBeInViewport();
- await login.getByRole("button", { name: "Sign in", exact: true }).scrollIntoViewIfNeeded();
- await expect(login.getByRole("button", { name: "Sign in", exact: true })).toBeInViewport();
- await login.getByRole("button", { name: "Sign in", exact: true }).click();
- await expect(login).not.toBeVisible();
- await expect(page.getByRole("dialog", { name: "Projects dashboard" })).toBeVisible();
- await page.reload();
- await page.getByRole("button", { name: "Home", exact: true }).click();
- await page.getByRole("button", { name: "[email protected]", exact: true }).click();
+ login.getByRole("button", { name: "Continue with GitHub", exact: true }),
+ ).toHaveCount(0);
+ const email = login.getByLabel("Email", { exact: true });
+ const magicLink = login.getByRole("button", { name: "Email me a magic link" });
+ await expect(magicLink).toHaveCount(0);
+ await email.fill("owner@example");
+ await expect(magicLink).toHaveCount(0);
+ await email.fill("[email protected]");
+ await expect(magicLink).toBeEnabled();
+ await email.clear();
+ await expect(magicLink).toHaveCount(0);
+ await page.screenshot({
+ path: "test-results/onboarding-enabled-providers.png",
+ animations: "disabled",
+ });
+});
+
+test("email sign-in reports Supabase errors and allows retry without granting access", async ({
+ page,
+}) => {
+ await installDesktopBridge(page, "preview.mp4", { signedIn: false });
+ let attempts = 0;
+ await page.route("https://auth.recordly.test/auth/v1/otp**", async (route) => {
+ attempts++;
+ if (attempts === 1)
+ return route.fulfill({
+ status: 429,
+ json: { msg: "Please wait before requesting another email." },
+ });
+ return route.fulfill({ json: {} });
+ });
+ await page.goto("/?windowType=editor");
+ const login = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await login.getByLabel("Email", { exact: true }).fill("[email protected]");
+ await login.getByRole("button", { name: "Email me a magic link" }).click();
+ await expect(login.getByText("Please wait before requesting another email.")).toBeVisible();
+ await expect(login).toHaveAttribute("data-onboarding-state", "login");
+ await login.getByRole("button", { name: "Email me a magic link" }).click();
+ await expect(login.getByText(/Check your inbox/)).toBeVisible();
+ await expect(login).toHaveAttribute("data-onboarding-state", "login");
+ expect(attempts).toBe(2);
+});
+
+test("a rejected Supabase callback keeps sign-in mandatory", async ({ page }) => {
+ await installDesktopBridge(page, "preview.mp4", { signedIn: false });
+ await page.route("https://auth.recordly.test/auth/v1/token**", (route) =>
+ route.fulfill({
+ status: 400,
+ json: { error: "invalid_grant", error_description: "Sign-in link has expired" },
+ }),
+ );
+ await page.goto("/?windowType=editor");
+ const login = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await login.getByLabel("Email", { exact: true }).fill("[email protected]");
+ await login.getByRole("button", { name: "Email me a magic link" }).click();
+ await expect(login.getByText(/Check your inbox/)).toBeVisible();
+ await completeSupabaseSignIn(page);
+ await expect(login.getByText("Sign-in link has expired")).toBeVisible();
+ await expect(login).toHaveAttribute("data-onboarding-state", "login");
+ await expect(login.getByRole("button", { name: "Continue", exact: true })).toHaveCount(0);
+ await login.getByRole("button", { name: "Email me a magic link" }).click();
+ await expect(login.getByText(/Check your inbox/)).toBeVisible();
+ await expect(login.getByText("Sign-in link has expired")).toHaveCount(0);
+});
+
+for (const [label, provider] of [
+ ["Google", "google"],
+ ["Microsoft", "azure"],
+ ["GitHub", "github"],
+]) {
+ test(`${label} sign-in opens Supabase OAuth in the system browser`, async ({ page }) => {
+ await installDesktopBridge(page, "preview.mp4", { signedIn: false });
+ await page.addInitScript(() => {
+ window.electronAPI.openExternalUrl = async (url) => {
+ document.documentElement.dataset.authUrl = url;
+ return { success: true };
+ };
+ });
+ await page.goto("/?windowType=editor");
+ const login = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await login.getByRole("button", { name: `Continue with ${label}`, exact: true }).click();
+ await expect(page.locator("html")).toHaveAttribute("data-auth-url", /auth\/v1\/authorize/);
+ const url = new URL((await page.locator("html").getAttribute("data-auth-url"))!);
+ expect(url.origin).toBe("https://auth.recordly.test");
+ expect(url.searchParams.get("provider")).toBe(provider);
+ expect(url.searchParams.get("redirect_to")).toBe("http://127.0.0.1:43821/auth/callback");
+ expect(url.searchParams.get("code_challenge")).toBeTruthy();
+ await expect(login).toHaveAttribute("data-onboarding-state", "login");
+ });
+}
+
+test("restored Supabase sessions show the account and sign-out requires authentication again", async ({
+ page,
+}) => {
+ await installDesktopBridge(page);
+ await page.goto("/?windowType=editor");
+ await page.getByRole("button", { name: "Recordly account", exact: true }).click();
const account = page.getByRole("dialog", { name: "Your account", exact: true });
await expect(account.getByText("[email protected]")).toBeVisible();
+ await expect(account.locator('img[src$="login-banner.png"]')).toBeVisible();
+ const logout = page.waitForRequest((request) => request.url().includes("/auth/v1/logout"));
await account.getByRole("button", { name: "Sign out", exact: true }).click();
- await expect(
- page.getByRole("dialog", { name: "Beautiful, shareable screen recordings" }),
- ).toBeVisible();
+ await logout;
+ const login = page.locator('[data-onboarding-state="login"]');
+ await expect(login).toBeVisible();
+ await page.reload();
+ await expect(login).toBeVisible();
+ await expect(login.getByRole("button", { name: "Continue", exact: true })).toHaveCount(0);
});
-test("login banner and email expansion work with reduced motion", async ({ page }) => {
+test("sign-in banner fills spare space and keeps the email action usable in a short window", async ({
+ page,
+}) => {
await page.emulateMedia({ reducedMotion: "reduce" });
- await installDesktopBridge(page);
+ await installDesktopBridge(page, "preview.mp4", { signedIn: false });
await page.goto("/?windowType=editor");
- await page.getByRole("button", { name: "Recordly account", exact: true }).click();
- const login = page.getByRole("dialog", {
- name: "Beautiful, shareable screen recordings",
- exact: true,
+ const login = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ const banner = login.locator("[data-onboarding-artwork]");
+ const submit = login.getByRole("button", { name: "Email me a magic link" });
+ const pages = login.getByRole("navigation", { name: "Onboarding pages" });
+ await login.getByLabel("Email", { exact: true }).fill("[email protected]");
+ await expect(submit).toBeVisible();
+ const tallBanner = (await banner.boundingBox())!;
+ expect(tallBanner.height).toBeGreaterThan(128);
+ const submitBounds = (await submit.boundingBox())!;
+ const navigationBounds = (await pages.boundingBox())!;
+ expect(navigationBounds.y - submitBounds.y - submitBounds.height).toBeLessThanOrEqual(48);
+ await page.screenshot({
+ path: "test-results/onboarding-responsive-banner.png",
+ animations: "disabled",
});
- await login.getByLabel("Email", { exact: true }).fill("[email protected]");
- await expect(login.getByLabel("Password", { exact: true })).toBeVisible();
- await login.getByLabel("Email", { exact: true }).fill("");
+ await page.setViewportSize({ width: 390, height: 600 });
+ await expect(banner).toBeInViewport();
+ expect((await banner.boundingBox())!.height).toBeLessThan(tallBanner.height);
+ await login.getByLabel("Email", { exact: true }).fill("[email protected]");
await expect(login.getByLabel("Password", { exact: true })).toHaveCount(0);
- await login.getByLabel("Email", { exact: true }).fill("[email protected]");
- await login.getByLabel("Password", { exact: true }).fill("1234");
- await login.getByRole("button", { name: "Sign in", exact: true }).click();
- await expect(login).not.toBeVisible();
+ await expect(login.getByRole("navigation", { name: "Onboarding pages" })).toBeInViewport();
+ await submit.scrollIntoViewIfNeeded();
+ await expect(submit).toBeInViewport();
+ await submit.click();
+ await expect(login.getByText(/Check your inbox/)).toBeVisible();
+ await page.screenshot({ path: "test-results/required-sign-in.png", animations: "disabled" });
});
diff --git a/tests/ui/onboarding.spec.ts b/tests/ui/onboarding.spec.ts
index 730a0ca9..18c2ed95 100644
--- a/tests/ui/onboarding.spec.ts
+++ b/tests/ui/onboarding.spec.ts
@@ -1,7 +1,9 @@
import { expect, test } from "@playwright/test";
import { installDesktopBridge } from "./bridge";
+import { completeSupabaseSignIn } from "./auth";
-test("settings button replays login and the recording overview", async ({ page }) => {
+test("settings opens permissions and the carousel banner adapts to each page", async ({ page }) => {
+ await page.emulateMedia({ reducedMotion: "reduce" });
await installDesktopBridge(page);
await page.goto("/?windowType=editor");
await expect(page.getByRole("button", { name: "Home", exact: true })).toBeVisible({
@@ -10,34 +12,85 @@ test("settings button replays login and the recording overview", async ({ page }
await page.getByRole("radio", { name: "Settings", exact: true }).click();
await page.getByRole("button", { name: "Show onboarding" }).click();
const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
- await expect(tour).toHaveAttribute("data-onboarding-state", "login");
- await expect(tour.getByText("Sign in to get started", { exact: true })).toBeVisible();
- await expect(tour.getByRole("button", { name: "Email me a magic link" })).toBeVisible();
- await tour.getByPlaceholder("[email protected]").fill("[email protected]");
- await expect(tour.getByRole("button", { name: "Email me a magic link" })).toBeVisible();
+ await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
+ await expect(tour.getByText("Allowed", { exact: true })).toHaveCount(2);
await expect
- .poll(() => tour.evaluate((element) => getComputedStyle(element).opacity))
- .toBe("1");
- await page.screenshot({ path: "test-results/onboarding-login.png", animations: "disabled" });
- const artwork = tour.locator("[data-onboarding-artwork]");
- const loginWidth = (await artwork.boundingBox())!.width;
- await tour.getByRole("button", { name: "Continue without signing in" }).click();
- await expect(tour).toHaveAttribute("data-onboarding-state", "feature");
- await expect(tour.getByRole("heading", { name: "Your next great recording" })).toBeVisible();
+ .poll(() =>
+ tour
+ .locator(".onboarding-permissions")
+ .evaluate((element) => element.scrollHeight - element.clientHeight),
+ )
+ .toBeLessThanOrEqual(1);
+ const pages = tour.getByRole("navigation", { name: "Onboarding pages" });
+ await expect(pages.getByRole("button", { name: "Permissions", exact: true })).toHaveAttribute(
+ "aria-current",
+ "page",
+ );
+ await expect(pages.getByRole("button")).toHaveCount(2);
+ await expect(tour.getByRole("listitem")).toHaveCount(0);
+ await expect(pages).toBeInViewport();
+ await expect(page.locator(".modal__container")).not.toHaveAttribute("data-entering", "true");
+ const permissionBounds = (await tour.boundingBox())!;
+ const banner = tour.locator("[data-onboarding-artwork]");
+ const bannerBounds = (await banner.boundingBox())!;
+ await expect(banner.locator('img[src$="login-banner.png"]')).toBeVisible();
await expect
- .poll(async () => (await artwork.boundingBox())!.width)
- .toBeGreaterThan(loginWidth * 1.7);
- await expect(artwork).toHaveCSS("transform", "none");
- await expect(artwork.locator(":scope > img")).toHaveCSS("transform", "none");
- await page.screenshot({ path: "test-results/onboarding-record.png", animations: "disabled" });
- for (const name of ["Record", "Preview", "Share"])
- await expect(tour.getByRole("heading", { name, exact: true })).toBeVisible();
- await tour.getByRole("button", { name: "Start recording" }).click();
+ .poll(() =>
+ banner
+ .locator('img[src$="login-banner.png"]')
+ .evaluate((image: HTMLImageElement) => image.naturalWidth),
+ )
+ .toBeGreaterThan(0);
+ const startBounds = (await tour
+ .getByRole("button", { name: "Start recording", exact: true })
+ .boundingBox())!;
+ await expect(tour.getByRole("button", { name: "Continue", exact: true })).toHaveCount(0);
+ await pages.getByRole("button", { name: "Account", exact: true }).click();
+ await expect(tour).toHaveAttribute("data-onboarding-state", "login");
+ await expect(pages.getByRole("button", { name: "Account", exact: true })).toHaveAttribute(
+ "aria-current",
+ "page",
+ );
+ await expect(tour.getByText("[email protected]", { exact: true })).toBeVisible();
+ const loginHeading = (await tour.getByRole("heading", { level: 2 }).boundingBox())!;
+ const brand = tour.locator("[data-onboarding-brand]");
+ const brandBounds = (await brand.boundingBox())!;
+ const accountBannerBounds = (await banner.boundingBox())!;
+ expect(accountBannerBounds.height).toBeGreaterThan(bannerBounds.height);
+ expect(accountBannerBounds.width).toBe(bannerBounds.width);
+ expect(brandBounds.y).toBeGreaterThanOrEqual(
+ accountBannerBounds.y + accountBannerBounds.height,
+ );
+ expect(brandBounds.y + brandBounds.height).toBeLessThan(loginHeading.y);
+ await expect(banner.locator('img[src$="recordly-128.png"]')).toHaveCount(0);
+ expect(await tour.boundingBox()).toEqual(permissionBounds);
+ expect(await banner.boundingBox()).toEqual(accountBannerBounds);
+ await page.screenshot({ path: "test-results/onboarding-login.png", animations: "disabled" });
+ await pages.getByRole("button", { name: "Permissions", exact: true }).focus();
+ await page.keyboard.press("Enter");
+ await expect(tour).toHaveAttribute("data-onboarding-state", "permissions");
+ await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
+ expect(await tour.boundingBox()).toEqual(permissionBounds);
+ expect(await banner.boundingBox()).toEqual(bannerBounds);
+ const permissionHeading = (await tour.getByRole("heading", { level: 2 }).boundingBox())!;
+ expect(permissionHeading.x).toBe(loginHeading.x);
+ const permissionBrandBounds = (await brand.boundingBox())!;
+ expect(permissionBrandBounds.y + permissionBrandBounds.height).toBeLessThan(
+ permissionHeading.y,
+ );
+ expect(permissionBrandBounds.width).toBe(brandBounds.width);
+ expect(permissionBrandBounds.height).toBe(brandBounds.height);
+ const navigationBounds = (await pages.boundingBox())!;
+ expect(navigationBounds.y).toBeGreaterThan(startBounds.y + startBounds.height);
+ expect(
+ await tour.getByRole("button", { name: "Start recording", exact: true }).boundingBox(),
+ ).toEqual(startBounds);
+ await tour.getByRole("button", { name: "Start recording", exact: true }).click();
await expect(tour).not.toBeVisible();
await expect(page.locator("html")).toHaveAttribute("data-hud-opened", "true");
await page.getByRole("radio", { name: "Settings", exact: true }).click();
await page.getByRole("button", { name: "Show onboarding" }).click();
- await expect(tour).toHaveAttribute("data-onboarding-state", "login");
+ await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
});
test("first launch persists completion and signed-in users can continue", async ({ page }) => {
@@ -48,12 +101,13 @@ test("first launch persists completion and signed-in users can continue", async
localStorage.setItem(key, JSON.stringify(value));
return true;
};
- sessionStorage.setItem("recordly.demo-session", "1");
});
await page.goto("/?windowType=editor");
const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
await tour.getByRole("button", { name: "Continue", exact: true }).click();
- await tour.getByRole("button", { name: "Start recording" }).click();
+ await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
+ await expect(tour.locator("[data-permissions-confetti]")).toBeVisible();
+ await tour.getByRole("button", { name: "Start recording", exact: true }).click();
await expect
.poll(() => page.evaluate(() => localStorage.getItem("recordly.onboarding.v1.seen")))
.toBe("true");
@@ -64,7 +118,7 @@ test("first launch persists completion and signed-in users can continue", async
await expect(tour).not.toBeVisible();
});
-test("feature banner fits a compact window with reduced motion", async ({ page }) => {
+test("onboarding fits a compact window with reduced motion", async ({ page }) => {
await installDesktopBridge(page);
await page.setViewportSize({ width: 620, height: 740 });
await page.emulateMedia({ reducedMotion: "reduce" });
@@ -75,34 +129,143 @@ test("feature banner fits a compact window with reduced motion", async ({ page }
await page.getByRole("radio", { name: "Settings", exact: true }).click();
await page.getByRole("button", { name: "Show onboarding" }).click();
const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
- await tour.getByRole("button", { name: "Continue without signing in" }).click();
await expect(
tour.getByRole("button", { name: "Start recording", exact: true }),
).toBeInViewport();
+ await expect(
+ tour.locator('[data-onboarding-artwork] img[src$="login-banner.png"]'),
+ ).toBeInViewport();
+ for (const size of [
+ { width: 720, height: 780 },
+ { width: 640, height: 650 },
+ { width: 390, height: 600 },
+ { width: 620, height: 740 },
+ ]) {
+ await page.setViewportSize(size);
+ await expect
+ .poll(() =>
+ tour
+ .locator(".onboarding-permissions")
+ .evaluate((element) => element.scrollHeight - element.clientHeight),
+ )
+ .toBeLessThanOrEqual(1);
+ }
await page.screenshot({ path: "test-results/onboarding-compact.png" });
- await tour.getByRole("button", { name: "Back to sign in" }).click();
+ await tour.getByRole("button", { name: "Back to account" }).click();
await expect(tour).toHaveAttribute("data-onboarding-state", "login");
});
-test("successful sign-in advances to Feature without closing onboarding", async ({ page }) => {
+test("short dark windows keep the banner and navigation visible while the account form scrolls", async ({
+ page,
+}) => {
await installDesktopBridge(page);
+ await page.emulateMedia({ reducedMotion: "reduce" });
await page.goto("/?windowType=editor");
- await expect(page.getByRole("button", { name: "Home", exact: true })).toBeVisible({
- timeout: 15000,
- });
await page.getByRole("radio", { name: "Settings", exact: true }).click();
await page.getByRole("button", { name: "Show onboarding" }).click();
+ await page.setViewportSize({ width: 390, height: 600 });
+ await page.evaluate(() => document.documentElement.classList.add("dark"));
const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
- await tour.getByPlaceholder("[email protected]").fill("[email protected]");
- await tour.locator('input[type="password"]').fill("1234");
- await tour.getByRole("button", { name: "Sign in", exact: true }).click();
- await expect(tour).toHaveAttribute("data-onboarding-state", "feature");
- await expect(tour.getByRole("heading", { name: "Your next great recording" })).toBeVisible();
+ await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
+ await expect(
+ tour.getByRole("button", { name: "Start recording", exact: true }),
+ ).toBeInViewport();
+ const body = tour.locator("[data-onboarding-body]");
+ await expect
+ .poll(() => body.evaluate((element) => element.scrollHeight - element.clientHeight))
+ .toBeLessThanOrEqual(1);
+ await expect
+ .poll(() =>
+ body.evaluate(
+ (element) =>
+ element.parentElement!.scrollHeight - element.parentElement!.clientHeight,
+ ),
+ )
+ .toBeLessThanOrEqual(1);
+ const bodyBounds = (await body.boundingBox())!;
+ const footerBounds = (await tour
+ .getByRole("button", { name: "Back to account" })
+ .boundingBox())!;
+ expect(bodyBounds.y + bodyBounds.height).toBeLessThanOrEqual(footerBounds.y);
+ await expect(tour.locator("[data-permissions-confetti]")).toHaveCount(0);
+ await page.screenshot({ path: "test-results/onboarding-narrow-permissions.png" });
+ await tour.getByRole("button", { name: "Back to account" }).click();
+ const bounds = await tour.boundingBox();
+ await expect(tour.getByRole("button", { name: "Continue", exact: true })).toBeInViewport();
+ await expect(
+ tour.locator('[data-onboarding-artwork] img[src$="login-banner.png"]'),
+ ).toBeInViewport();
+ expect(await tour.boundingBox()).toEqual(bounds);
+ await expect(tour).toHaveJSProperty("scrollWidth", bounds!.width);
+ await page.screenshot({ path: "test-results/onboarding-narrow-account.png" });
+ await tour.getByRole("button", { name: "Continue", exact: true }).click();
+ await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
});
-test("missing macOS permissions lead to explicit access controls before the overview", async ({
+test("sign-in is mandatory even after onboarding was completed", async ({ page }) => {
+ await installDesktopBridge(page, "preview.mp4", { signedIn: false });
+ await page.addInitScript(() => sessionStorage.setItem("recordly.demo-session", "1"));
+ await page.goto("/?windowType=editor");
+ const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await expect(tour).toHaveAttribute("data-onboarding-state", "login");
+ await expect(tour.getByRole("button", { name: "Continue without signing in" })).toHaveCount(0);
+ await expect(tour.getByText("Optional", { exact: true })).toHaveCount(0);
+ await expect(tour.getByText("Sign in to continue", { exact: true })).toHaveCount(0);
+ const pages = tour.getByRole("navigation", { name: "Onboarding pages" });
+ await expect(pages).toBeInViewport();
+ await expect(pages.getByRole("button", { name: "Account", exact: true })).toHaveAttribute(
+ "aria-current",
+ "page",
+ );
+ await expect(pages.getByRole("button", { name: "Permissions", exact: true })).toBeDisabled();
+ await expect(tour.getByRole("button", { name: "Start recording" })).toHaveCount(0);
+ await expect(tour.getByRole("button", { name: "Close", exact: true })).toHaveCount(0);
+ await page.keyboard.press("Escape");
+ await page.mouse.click(5, 5);
+ await expect(tour).toBeVisible();
+ await page.reload();
+ await expect(tour).toHaveAttribute("data-onboarding-state", "login");
+});
+
+test("Supabase email callback advances to permissions only after a session is returned", async ({
page,
}) => {
+ await installDesktopBridge(page, "preview.mp4", { signedIn: false });
+ await page.goto("/?windowType=editor");
+ const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
+ await tour.getByPlaceholder("[email protected]").fill("[email protected]");
+ const otpRequest = page.waitForRequest((request) => request.url().includes("/auth/v1/otp"));
+ await tour.getByRole("button", { name: "Email me a magic link" }).click();
+ expect((await otpRequest).postDataJSON()).toMatchObject({
+ email: "[email protected]",
+ create_user: true,
+ });
+ await expect(tour.getByText(/Check your inbox to verify your email/)).toBeVisible();
+ await expect(tour).toHaveAttribute("data-onboarding-state", "login");
+ const exchange = page.waitForRequest((request) => request.url().includes("/auth/v1/token"));
+ await completeSupabaseSignIn(page);
+ expect((await exchange).postDataJSON()).toMatchObject({
+ auth_code: "ui-auth-code",
+ code_verifier: expect.any(String),
+ });
+ await expect(tour).toHaveAttribute("data-onboarding-state", "permissions");
+ await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
+ await expect(
+ tour
+ .getByRole("navigation", { name: "Onboarding pages" })
+ .getByRole("button", { name: "Permissions", exact: true }),
+ ).toBeEnabled();
+ await expect(tour.getByRole("button", { name: "Start recording", exact: true })).toBeEnabled();
+ await tour.getByRole("button", { name: "Start recording", exact: true }).click();
+ await expect(tour).not.toBeVisible();
+ await page.reload();
+ await expect(page.getByRole("button", { name: "Home", exact: true })).toBeVisible({
+ timeout: 15000,
+ });
+ await expect(tour).not.toBeVisible();
+});
+
+test("missing macOS permissions gate Start recording until access is allowed", async ({ page }) => {
await installDesktopBridge(page);
await page.addInitScript(() => {
let screen = false;
@@ -133,22 +296,48 @@ test("missing macOS permissions lead to explicit access controls before the over
await page.getByRole("radio", { name: "Settings", exact: true }).click();
await page.getByRole("button", { name: "Show onboarding" }).click();
const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
- await tour.getByRole("button", { name: "Continue without signing in" }).click();
+ const start = tour.getByRole("button", { name: "Start recording", exact: true });
await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
- await expect(tour.getByRole("button", { name: "Continue", exact: true })).toBeDisabled();
+ await expect(start).toBeDisabled();
+ await page.setViewportSize({ width: 390, height: 600 });
+ await expect
+ .poll(() =>
+ tour
+ .locator(".onboarding-permissions")
+ .evaluate((element) => element.scrollHeight - element.clientHeight),
+ )
+ .toBeLessThanOrEqual(1);
+ await expect(tour.locator("[data-permissions-confetti]")).toHaveCount(0);
await expect(page.locator("html")).not.toHaveAttribute("data-screen-settings");
await tour.getByRole("button", { name: "Allow Screen Recording", exact: true }).click();
await expect(page.locator("html")).toHaveAttribute("data-screen-settings", "true");
- await expect(tour.getByRole("button", { name: "Continue", exact: true })).toBeDisabled();
+ await expect(start).toBeDisabled();
await tour.getByRole("button", { name: "Allow Accessibility", exact: true }).click();
await expect(page.locator("html")).toHaveAttribute("data-accessibility-settings", "true");
await expect(tour.getByText("Allowed", { exact: true })).toHaveCount(2);
+ await expect(start).toBeEnabled();
+ await expect(tour.locator("[data-permissions-confetti]")).toBeVisible();
+ await expect(tour.locator("[data-permissions-confetti]")).toHaveCount(0, { timeout: 5000 });
+ await page.evaluate(() => window.dispatchEvent(new Event("focus")));
+ await expect(tour.locator("[data-permissions-confetti]")).toHaveCount(0);
+ await tour.getByRole("button", { name: "Back to account" }).click();
+ await tour.getByRole("button", { name: "Continue", exact: true }).click();
+ await expect(tour.locator("[data-permissions-confetti]")).toBeVisible();
+ await expect
+ .poll(() =>
+ tour
+ .locator("[data-permissions-confetti] span")
+ .first()
+ .evaluate((element) => Number(getComputedStyle(element).opacity)),
+ )
+ .toBeGreaterThan(0.5);
await page.screenshot({
path: "test-results/onboarding-permissions.png",
animations: "disabled",
});
- await tour.getByRole("button", { name: "Continue", exact: true }).click();
- await expect(tour.getByRole("button", { name: "Start recording" })).toBeVisible();
+ await start.click();
+ await expect(tour).not.toBeVisible();
+ await expect(page.locator("html")).toHaveAttribute("data-hud-opened", "true");
});
for (const platform of ["win32", "linux"]) {
@@ -167,11 +356,15 @@ for (const platform of ["win32", "linux"]) {
await page.getByRole("radio", { name: "Settings", exact: true }).click();
await page.getByRole("button", { name: "Show onboarding" }).click();
const tour = page.getByRole("dialog", { name: "Welcome to Recordly" });
- await tour.getByRole("button", { name: "Continue without signing in" }).click();
- await expect(tour.getByRole("button", { name: "Start recording" })).toBeVisible();
+ await expect(tour.getByRole("heading", { name: "Allow Recordly to record" })).toBeVisible();
await expect(
- tour.getByRole("heading", { name: "Allow Recordly to record" }),
- ).not.toBeVisible();
+ tour.getByRole("button", { name: "Start recording", exact: true }),
+ ).toBeEnabled();
+ await expect(tour.getByText("Screen Recording", { exact: true })).toHaveCount(0);
+ await expect(tour.getByText("macOS System Settings", { exact: false })).toHaveCount(0);
+ await tour.getByRole("button", { name: "Start recording", exact: true }).click();
+ await expect(tour).not.toBeVisible();
+ await expect(page.locator("html")).toHaveAttribute("data-hud-opened", "true");
});
}
@@ -216,3 +409,14 @@ test("a permission request opens its page even after onboarding was already comp
tour.getByRole("button", { name: "Continue without signing in" }),
).not.toBeVisible();
});
+
+for (const platform of ["darwin", "win32", "linux"]) {
+ test(`${platform} HUD requires a Supabase session before recording`, async ({ page }) => {
+ await installDesktopBridge(page, "preview.mp4", { signedIn: false });
+ await page.addInitScript((platform) => {
+ window.electronAPI.getPlatform = async () => platform;
+ }, platform);
+ await page.goto("/?windowType=hud-overlay");
+ await expect(page.locator("html")).toHaveAttribute("data-permissions-opened", "true");
+ });
+}
diff --git a/tests/ui/paused-motion.spec.ts b/tests/ui/paused-motion.spec.ts
index cad4a88d..6e0608e3 100644
--- a/tests/ui/paused-motion.spec.ts
+++ b/tests/ui/paused-motion.spec.ts
@@ -1,6 +1,40 @@
import { expect, test } from "@playwright/test";
import { installDesktopBridge } from "./bridge";
+
for (const cursor of [false, true]) {
+ test(`pause/resume preserves ${cursor ? "cursor" : "camera"} motion without a decoder seek`, async ({
+ page,
+ }) => {
+ const errors: string[] = [];
+ page.on("pageerror", (error) => errors.push(error.message));
+ await installDesktopBridge(page, "filmstrip.mp4");
+ await page.goto(`/tests/ui/paused-motion.html${cursor ? "?cursor" : ""}`);
+ await expect(page.locator("main")).toHaveAttribute("data-ready", "true");
+ const video = page.locator("video").first();
+ await expect.poll(() => video.evaluate((v: HTMLVideoElement) => v.seeking)).toBe(false);
+ await video.evaluate((v) => {
+ v.dataset.seekCount = "0";
+ v.addEventListener("seeking", () => {
+ v.dataset.seekCount = String(Number(v.dataset.seekCount) + 1);
+ });
+ });
+ const canvas = page.locator("canvas").first();
+ for (let cycle = 0; cycle < 3; cycle++) {
+ const before = await video.evaluate((v: HTMLVideoElement) => v.currentTime);
+ await page.getByRole("button", { name: "Play", exact: true }).click();
+ await expect
+ .poll(() => video.evaluate((v: HTMLVideoElement) => v.currentTime))
+ .toBeGreaterThan(before + 0.1);
+ await page.getByRole("button", { name: "Pause", exact: true }).click();
+ const pausedTime = await video.evaluate((v: HTMLVideoElement) => v.currentTime);
+ const frame = await canvas.screenshot();
+ expect(await canvas.screenshot()).toEqual(frame);
+ expect(await video.evaluate((v: HTMLVideoElement) => v.currentTime)).toBe(pausedTime);
+ await expect(video).toHaveAttribute("data-seek-count", "0");
+ }
+ expect(errors).toEqual([]);
+ });
+
test(`paused ${cursor ? "cursor" : "camera"} blur survives scrubbing and holds its frame`, async ({
page,
}) => {
diff --git a/tests/ui/paused-motion.tsx b/tests/ui/paused-motion.tsx
index 9289aae8..3d158094 100644
--- a/tests/ui/paused-motion.tsx
+++ b/tests/ui/paused-motion.tsx
@@ -1,10 +1,13 @@
-import { useState } from "react";
+import { useRef, useState } from "react";
import { createRoot } from "react-dom/client";
-import VideoPlayback from "@/components/video-editor/VideoPlayback";
+import VideoPlayback, { type VideoPlaybackRef } from "@/components/video-editor/VideoPlayback";
import { I18nProvider } from "@/contexts/I18nContext";
import "@/index.css";
const cursor = new URLSearchParams(location.search).has("cursor");
const noop = () => undefined;
+const onError = (error: string) => {
+ throw new Error(error);
+};
const clips = [{ id: "clip", startMs: 0, endMs: 6000, speed: 1 }];
const zooms = [
{
@@ -22,30 +25,33 @@ const telemetry = [
{ timeMs: 6000, cx: 0.9, cy: 0.5 },
];
function Preview() {
+ const playback = useRef<VideoPlaybackRef>(null);
+ const [playing, setPlaying] = useState(false);
const [time, setTime] = useState(0.8);
const [blur, setBlur] = useState(true);
const [ready, setReady] = useState(false);
return (
<main style={{ width: 900 }} data-ready={ready}>
+ <button onClick={() => playback.current?.play()}>Play</button>
+ <button onClick={() => playback.current?.pause()}>Pause</button>
<button onClick={() => setBlur((value) => !value)}>Toggle blur</button>
- <button onClick={() => setTime(3)}>Seek elsewhere</button>
- <button onClick={() => setTime(0.8)}>Seek back</button>
+ <button onClick={() => playback.current?.seekTimeline(3)}>Seek elsewhere</button>
+ <button onClick={() => playback.current?.seekTimeline(0.8)}>Seek back</button>
<VideoPlayback
+ ref={playback}
videoPath="/tests/ui/fixtures/filmstrip.mp4"
clipRegions={clips}
currentTime={time}
onTimeUpdate={setTime}
onDurationChange={noop}
- onPlayStateChange={noop}
- onError={(error) => {
- throw new Error(error);
- }}
+ onPlayStateChange={setPlaying}
+ onError={onError}
onPreviewReadyChange={setReady}
zoomRegions={cursor ? [] : zooms}
selectedZoomId={null}
onSelectZoom={noop}
onZoomFocusChange={noop}
- isPlaying={false}
+ isPlaying={playing}
aspectRatio="16:9"
wallpaper="#111111"
showShadow={false}
diff --git a/tests/ui/recording-startup-cancellation.spec.ts b/tests/ui/recording-startup-cancellation.spec.ts
new file mode 100644
index 00000000..8ff1a64b
--- /dev/null
+++ b/tests/ui/recording-startup-cancellation.spec.ts
@@ -0,0 +1,106 @@
+import { expect, test } from "@playwright/test";
+import { installDesktopBridge } from "./bridge";
+
+for (const resource of ["microphone", "cursor"] as const) {
+ test(`changing source during startup releases the ${resource} before picking`, async ({
+ page,
+ }) => {
+ await installDesktopBridge(page);
+ await page.addInitScript((resource) => {
+ let releaseCapture!: () => void;
+ const capturePending = new Promise<void>((resolve) => {
+ releaseCapture = resolve;
+ });
+ const track = {
+ kind: resource === "microphone" ? "audio" : "video",
+ stop: () => {
+ document.documentElement.dataset.trackStopped = "true";
+ },
+ getSettings: () => ({ width: 1920, height: 1080, frameRate: 30 }),
+ applyConstraints: async () => undefined,
+ };
+ const mediaStream = {
+ getTracks: () => [track],
+ getAudioTracks: () => (resource === "microphone" ? [track] : []),
+ getVideoTracks: () => (resource === "cursor" ? [track] : []),
+ };
+ Object.defineProperties(navigator.mediaDevices, {
+ getUserMedia: {
+ value: async () => {
+ document.documentElement.dataset.acquiringCapture = "true";
+ await capturePending;
+ return mediaStream;
+ },
+ },
+ enumerateDevices: { value: async () => [] },
+ });
+ class MockRecorder {
+ state = "inactive";
+ mimeType = "audio/webm;codecs=opus";
+ constructor(public stream: unknown) {}
+ static isTypeSupported() {
+ return true;
+ }
+ start() {
+ this.state = "recording";
+ document.documentElement.dataset.recorderStarted = "true";
+ }
+ stop() {
+ this.state = "inactive";
+ }
+ }
+ Object.assign(window, { MediaRecorder: MockRecorder });
+ Object.assign(window.electronAPI, {
+ getPlatform: async () => (resource === "microphone" ? "darwin" : "win32"),
+ getSelectedSource: async () => ({ id: "window:101:0", name: "Notes" }),
+ getCountdownDelay: async () => ({ success: true, delay: 0 }),
+ getRecordingPreferences: async () => ({
+ success: true,
+ microphoneEnabled: resource === "microphone",
+ systemAudioEnabled: false,
+ webcamEnabled: false,
+ }),
+ startNativeScreenRecording: async () => ({
+ success: true,
+ microphoneFallbackRequired: true,
+ }),
+ stopNativeScreenRecording: async () => ({ success: true, path: "/pending.mp4" }),
+ deleteRecordingFile: async () => ({ success: true }),
+ isNativeWindowsCaptureAvailable: async () => ({ available: false }),
+ hideOsCursor: async () => {
+ document.documentElement.dataset.cursorHidden = "true";
+ return { success: true };
+ },
+ setRecordingState: async (active: boolean) => {
+ if (!active) document.documentElement.dataset.cursorHidden = "false";
+ },
+ cancelCountdown: async () => {
+ releaseCapture();
+ return { success: true };
+ },
+ pickCaptureTarget: async () => {
+ const html = document.documentElement;
+ html.dataset.resourceReleasedBeforePick = String(
+ resource === "microphone"
+ ? html.dataset.trackStopped === "true"
+ : html.dataset.cursorHidden === "false",
+ );
+ return { success: false, canceled: true };
+ },
+ });
+ }, resource);
+ await page.goto("/?windowType=hud-overlay");
+ const source = page.getByRole("button", { name: "Choose recording source" });
+ await expect(source).toBeEnabled({ timeout: 15000 });
+ await page.getByRole("button", { name: "Record", exact: true }).click();
+ await expect(page.locator("html")).toHaveAttribute("data-acquiring-capture", "true");
+ await source.click();
+ await expect(page.locator("html")).toHaveAttribute(
+ "data-resource-released-before-pick",
+ "true",
+ );
+ await expect(page.locator("html")).toHaveAttribute("data-track-stopped", "true");
+ await expect(page.locator("html")).not.toHaveAttribute("data-recorder-started");
+ await expect(page.getByRole("button", { name: "Record", exact: true })).toBeEnabled();
+ });
+}
diff --git a/tests/ui/startup-loading.spec.ts b/tests/ui/startup-loading.spec.ts
index 5c89457a..d470438c 100644
--- a/tests/ui/startup-loading.spec.ts
+++ b/tests/ui/startup-loading.spec.ts
@@ -6,14 +6,19 @@ test("editor paints a wireframe before JavaScript loads", async ({ page }) => {
await page.goto("/?windowType=editor");
await expect(page.getByRole("status", { name: "Loading editor" })).toBeVisible();
await expect(page.locator(".boot-preview i").first()).toBeVisible();
+ await page.screenshot({ path: "test-results/startup-wireframe.png" });
await page.goto("/?windowType=hud-overlay");
await expect(page.locator(".boot-shell")).not.toBeVisible();
});
-test("wireframe stays visible while the editor module loads, then gives way to the app", async ({ page }) => {
+test("wireframe stays visible while the editor module loads, then gives way to the app", async ({
+ page,
+}) => {
await installDesktopBridge(page);
let release!: () => void;
- const paused = new Promise<void>((resolve) => { release = resolve; });
+ const paused = new Promise<void>((resolve) => {
+ release = resolve;
+ });
await page.route("**/components/video-editor/EditorWindow.tsx*", async (route) => {
await paused;
await route.continue();