diff --git a/.env.example b/.env.example index edc496c..18592e9 100644 --- a/.env.example +++ b/.env.example @@ -13,6 +13,6 @@ VITE_ADMIN_ONLY=false # Optional admin UI base path. Leave empty to use default app behavior. VITE_ADMIN_UI_PREFIX= -# Use mock Post data (Telegram-style resource stream) while backend /api/posts -# endpoints are not yet ready. Set to "false" to hit real API. -VITE_USE_MOCK_POSTS=true +# Use mock Post data (Telegram-style resource stream) only when explicitly enabled. +# Default production/staging behavior should hit the real /api/posts API. +VITE_USE_MOCK_POSTS=false diff --git a/README.md b/README.md index 2eee7a4..d5080a1 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Create a local `.env` only when needed. Do not commit secrets. See `.env.example | `VITE_DISABLE_ADMIN` | When set to `"true"`, public build redirects admin routes away. Production public deploy sets this to `"true"`. | | `VITE_ADMIN_ONLY` | When set to `"true"`, builds the admin-only app entry instead of the public app. | | `VITE_ADMIN_UI_PREFIX` | Optional admin UI base path. If absent in admin-only mode, code uses the secret prefix from `src/adminPaths.ts`. | -| `VITE_USE_MOCK_POSTS` | Telegram-style resource stream (`/browse`, `/category/:slug`) uses mock posts from `src/mocks/mockPosts.ts` when set to `true` (default while backend `/api/posts` is not yet shipped). Set to `"false"` to hit the real API. See `.unipi/docs/specs/2026-05-25-posts-api-contract.md`. | +| `VITE_USE_MOCK_POSTS` | Telegram-style resource stream (`/browse`, `/category/:slug`) uses mock posts from `src/mocks/mockPosts.ts` only when set to `"true"`. Leave unset or set to `"false"` to hit the real `/api/posts` API. See `.unipi/docs/specs/2026-05-25-posts-api-contract.md`. | ## Project layout diff --git a/src/api.test.ts b/src/api.test.ts index 5a32909..fbac350 100644 --- a/src/api.test.ts +++ b/src/api.test.ts @@ -3,6 +3,7 @@ import { describe, expect, it, vi } from "vitest"; async function loadApi(apiUrl = "") { vi.resetModules(); vi.stubEnv("VITE_API_URL", apiUrl); + vi.stubEnv("VITE_API_PREFIX", ""); return import("./api"); } diff --git a/src/components/messageStream/bubbles/ImageWithTextBubble.tsx b/src/components/messageStream/bubbles/ImageWithTextBubble.tsx index ba42481..62e45d2 100644 --- a/src/components/messageStream/bubbles/ImageWithTextBubble.tsx +++ b/src/components/messageStream/bubbles/ImageWithTextBubble.tsx @@ -14,24 +14,26 @@ export function ImageWithTextBubble({ post }: { post: Post }) { att.width && att.height ? `${att.width} / ${att.height}` : "4 / 3"; return ( -