Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
docs: describe the sign-in page redirect for a stored session
spacesdrived6788328a9b2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6798156..f8cd9a2 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -22,6 +22,10 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).- Connecting an Instagram account that is already connected renews its token instead of answering that it is already added, so a revoked token can be fixed without removing the account (#89)- The Worker's publishing cron runs every 5 minutes instead of 15; posts still publish on the quarter hour, and the other runs send waiting comment replies (#89)+### Fixed++- The sign-in page opens the dashboard when you are already signed in, so the public site's Sign in and Get started buttons no longer ask you to sign in again (#94)+---## [1.2.0] - 2026-10-16diff --git a/docs/architecture/data-flows/AUTHENTICATION.md b/docs/architecture/data-flows/AUTHENTICATION.mdindex 11af96e..159f37e 100644--- a/docs/architecture/data-flows/AUTHENTICATION.md+++ b/docs/architecture/data-flows/AUTHENTICATION.md@@ -13,6 +13,8 @@| `verify` | The code that confirms a password sign-up when **Confirm email** is on | `start` || `forgot`, `reset` | The reset-by-code flow below | `password` |+When the browser already holds a session, `/login` opens the dashboard (`/`) instead of the form, so the public site's Sign in and Get started buttons take a signed-in person straight in. `signInPageOutcome()` in `lib/signInPage.ts` decides it: the page renders nothing while the stored session loads, and a session created by a sign-in started on the page is left to that sign-in, so the password reset saves the new password before it navigates.+`?mode=signup` (the public site's Get started buttons) keeps the `start` view but shows the headline "Create your Twiligent account" and Google's "Sign up with Google". The default ways to join are Google and an emailed code, both of which create the account on first use; the password sign-up stays behind the password view for instances that do not email codes.## Login Flow (Emailed Code, the Default)diff --git a/docs/workflows/TESTING.md b/docs/workflows/TESTING.mdindex ed11094..6d332fa 100644--- a/docs/workflows/TESTING.md+++ b/docs/workflows/TESTING.md@@ -53,6 +53,7 @@ Tests never sit next to source files. Each workspace has a `tests/` folder that| `frontend/src/lib/passwords.ts` | `frontend/tests/lib/passwords.test.ts` || `frontend/src/lib/emailAddress.ts` | `frontend/tests/lib/emailAddress.test.ts` || `frontend/src/lib/googleIdentity.ts` | `frontend/tests/lib/googleIdentity.test.ts` |+| `frontend/src/lib/signInPage.ts` | `frontend/tests/lib/signInPage.test.ts` || `frontend/src/features/analytics/overview/overviewStats.ts` | `frontend/tests/features/analytics/overview/overviewStats.test.ts` || `frontend/src/features/publishing/scheduleHelpers.ts` | `frontend/tests/features/publishing/scheduleHelpers.test.ts` || `site/src/docs/searchShared.ts` | `site/tests/docs/searchShared.test.ts` |@@ -80,7 +81,7 @@ The database migrations have their own test. `tests/database/migrations.test.ts`Comment automation has its own tests. `tests/lib/automationMatching.test.ts` covers whole-word and exact matching, case, look-alike characters, literal punctuation in keywords, and that a comment on one reel never triggers a rule for another. `tests/lib/automationDelivery.test.ts` covers the Graph error classes, backoff with jitter, the cooldown from Meta's usage header, and what is recorded for each answer: accepted, rate limited, blocked, temporary errors up to the fifth try, already replied, a refused token (held), not allowed, no answer (needs review), and a request the runtime refused (not sent). `tests/lib/metaWebhookSignature.test.ts` checks signatures with either secret, changed bodies and malformed headers. `tests/fixtures/fakeAutomationQueue.ts` is an in-memory twin of the claim, reserve and finish functions, following the SQL's rules, and `tests/services/automationProcessor.test.ts` runs the processor against it: two comments at once, three reels with their own rules, two runs competing for the same jobs (each reply sent once), a burst over the batch and per-account fairness, a timeout that is never resent, a run that stopped before and during a send, a rate limit cooling one account while another keeps sending, the hourly and per-person limits, five temporary failures, a rule turned off, a deleted reel, an expired comment, a refused token holding the account, the instance pause, a database failure on one job and on the claim, a cancelled run and one without time for a whole send handing their jobs back unstarted, and a run claiming only what its subrequests pay for. `tests/services/automationWebhookService.test.ts` covers intake: per-reel matching, unmatched comments kept without words, own comments, duplicates within and across notifications, accounts without rules, a failed insert, and the verify token. `tests/repositories/automationCommentRepository.test.ts` pages through comments stored in the same instant without skipping or repeating one, and checks the hand-back of unstarted jobs. `tests/routes/instagramWebhookRoutes.test.ts` runs the public route end to end (challenge, signed comment stored then answered, duplicates, either secret, bad signatures, bad bodies, the 1 MB limit, a missing secret, a database failure), and `tests/routes/automationRoutes.test.ts` the user routes, including every route answering 404 for another user's rule, account or item. `tests/fixtures/metaWebhook.ts` signs notifications the way Meta does. The SQL functions cannot run in Node; they were checked on a local Postgres (PGlite) before the first push: deduplication, fair claims and lease recovery, each limit, pause and cooldown, a late answer for an interrupted send, stats, cascades, browser access and every rollback.-The Send Email hook has its own tests: `tests/lib/webhookSignature.test.ts` (valid, tampered, wrong-key, multi-signature and replayed requests), `tests/validators/authHookValidators.test.ts`, `tests/services/email/authEmails.test.ts` (the email for each action, the verify links, HTML escaping and the two Secure Email Change emails), `tests/repositories/emailQuotaRepository.test.ts` (daily and per-address caps, hashed keys, Redis failures), `tests/services/authEmailService.test.ts` (Resend requests, idempotency keys, the caps and Resend's own quota errors, skipped notices) and `tests/routes/authHookRoutes.test.ts` (the hook error shape, and the route answering unsigned calls with 401 in the full app). `tests/fixtures/authHook.ts` signs requests the way Supabase Auth does. The Lua claim script cannot run in Node; the repository test runs the same rules in memory. On the frontend, `tests/lib/authErrors.test.ts` covers when the sign-in page shows the daily cap warning and whether it offers Google, `tests/lib/emailAddress.test.ts` when an address looks complete enough to enable the Continue arrow, and `tests/lib/googleIdentity.test.ts` the label drawn on the Google button for each text option.+The Send Email hook has its own tests: `tests/lib/webhookSignature.test.ts` (valid, tampered, wrong-key, multi-signature and replayed requests), `tests/validators/authHookValidators.test.ts`, `tests/services/email/authEmails.test.ts` (the email for each action, the verify links, HTML escaping and the two Secure Email Change emails), `tests/repositories/emailQuotaRepository.test.ts` (daily and per-address caps, hashed keys, Redis failures), `tests/services/authEmailService.test.ts` (Resend requests, idempotency keys, the caps and Resend's own quota errors, skipped notices) and `tests/routes/authHookRoutes.test.ts` (the hook error shape, and the route answering unsigned calls with 401 in the full app). `tests/fixtures/authHook.ts` signs requests the way Supabase Auth does. The Lua claim script cannot run in Node; the repository test runs the same rules in memory. On the frontend, `tests/lib/authErrors.test.ts` covers when the sign-in page shows the daily cap warning and whether it offers Google, `tests/lib/emailAddress.test.ts` when an address looks complete enough to enable the Continue arrow, `tests/lib/googleIdentity.test.ts` the label drawn on the Google button for each text option, and `tests/lib/signInPage.test.ts` when the sign-in page opens the dashboard for a stored session and when it leaves a sign-in on the page to finish.The testing workflow documented here describes what should run before shipping any change.@@ -158,6 +159,7 @@ Open the app in a browser. For each changed area, test:- [ ] Back returns to the first view, and from Reset your password to the password view- [ ] Continue with Google signs in (only on an origin listed in the OAuth client's Authorized JavaScript origins); in dark mode the button is the app's outline button with no white square behind the G, and Tab focus shows its ring- [ ] `/login?mode=signup` shows "Create your Twiligent account" and "Sign up with Google"+- [ ] Signed in, open `/login` or `/login?mode=signup` (or the public site's Sign in) -> Overview opens without the form; signed out, the form shows- [ ] With the daily cap reached, Continue shows the warning "Email codes are paused until tomorrow" above Google, offering Google or the password- [ ] Sign out -> redirects to login