The best way to control Claude Code, Codex and more from any computer or phone
| 1 | <script setup lang="ts"> |
| 2 | // SSR reads the worker environment through nitro's cloudflare_module runtime |
| 3 | // contract: `event.context.cloudflare.env`. `useState` serializes the |
| 4 | // server-read value into the payload so the client render matches. |
| 5 | const config = useRuntimeConfig(); |
| 6 | const secret = useState("fixture-secret", () => { |
| 7 | if (import.meta.server) { |
| 8 | const event = useRequestEvent(); |
| 9 | const env = event?.context.cloudflare?.env as Record<string, unknown> | undefined; |
| 10 | return typeof env?.FIXTURE_SECRET === "string" ? env.FIXTURE_SECRET : "missing"; |
| 11 | } |
| 12 | return "missing"; |
| 13 | }); |
| 14 | </script> |
| 15 | |
| 16 | <template> |
| 17 | <main> |
| 18 | <h1 data-testid="page-marker">NUXT_FIXTURE</h1> |
| 19 | <p data-testid="config-marker">{{ config.public.fixtureMarker }}</p> |
| 20 | <p data-testid="env-secret">secret:{{ secret }}</p> |
| 21 | </main> |
| 22 | </template> |