feat: demo account banner for demo installs (TR_DEMO)

Merged
EV
15d ago
+348-2

What

demo.gauzy.co shows a strip above the app:

You are using a demo account. Finding our software useful? Click here to Sign Up and start using for free!

demo.traduora.co showed nothing. Traduora has no hosted sign-up, so the link reads "Click here to get Traduora and start using it for free!" and goes to the homepage (environment.homepage, https://traduora.co).

How it's switched on (only on demo)

  • api: new TR_DEMO (default false). When it's true, the index.html the API serves carries <meta name="traduora-demo" content="true"> and is sent with Cache-Control: no-cache. When it's off, index.html is sent with sendFile exactly as before. If the file can't be read, it falls back to sendFile.
  • webapp: app-demo-banner above the app bar (signed-in pages, like the Gauzy and Teams strips), shown only when that tag is on the page.
  • docs: TR_DEMO row in docs/configuration.md.

There's no new endpoint and no extra request. The Swagger contract is unchanged (the index route is @ApiExcludeEndpoint). The demo install gets TR_DEMO=true in a separate k8s-gitops change (apps/ever-traduora-demo).

Tests

  • api/src/controllers/index.controller.spec.ts: off by default; untouched sendFile when off; tag added (and no-cache set) when on; falls back when index.html is missing; keeps <head> attributes and leaves <header> alone. Passes locally with config.spec.ts (9/9). tslint is clean on the changed files.
  • webapp/.../demo-banner.component.spec.ts (Karma): renders nothing without the tag; shows the text and the homepage link with it. I couldn't run it locally because the borrowed deps lack karma-jasmine, so this PR's CI webapp job is its first run. tsc -p webapp/tsconfig.json: no errors outside node_modules.

šŸ¤– Generated with Claude Code


Summary by cubic

Adds a "You are using a demo account" banner to demo installs (TR_DEMO=true). Non-demo installs serve and render exactly as before.

  • When TR_DEMO is on, the API injects a <meta name="traduora-demo"> tag into index.html with Cache-Control: no-cache; a direct GET/HEAD for /index.html, including percent-encoded forms, redirects to / so the tagged page is served.
  • The web app shows the banner above the app bar only when that tag is present, linking to the Traduora homepage (environment.homepage).
  • Documents TR_DEMO in docs/configuration.md.