Processed some UI issues on journal
This commit is contained in:
@@ -31,7 +31,7 @@ pip install -r backend\requirements.txt
|
||||
Start FastAPI:
|
||||
|
||||
```powershell
|
||||
uvicorn backend.main:app --reload --port 8000 --env-file backend\.env
|
||||
uvicorn backend.main:app --reload --reload-dir backend --port 8000 --env-file backend\.env
|
||||
```
|
||||
|
||||
In a second terminal, start React:
|
||||
@@ -51,14 +51,16 @@ The interface loads Roboto Flex from Google Fonts for its compact UI copy, while
|
||||
The form uses `POST /api/contact` and sends email through SMTP. Copy `backend/.env.example` to `backend/.env`, fill in the SMTP values, and start the API with the environment file:
|
||||
|
||||
```powershell
|
||||
uvicorn backend.main:app --reload --port 8000 --env-file backend\.env
|
||||
uvicorn backend.main:app --reload --reload-dir backend --port 8000 --env-file backend\.env
|
||||
```
|
||||
|
||||
If SMTP is unavailable, the API returns a clear delivery error and the page keeps Alex's direct email, LinkedIn, and GitHub links visible.
|
||||
|
||||
## Journal publisher
|
||||
|
||||
Open `http://localhost:5173/blog/manage` and sign in with the journal admin password. The writing room uses Tiptap for headings, bold and italic text, lists, undo/redo, and inline font sizes. Publishing writes to Supabase when it is configured, or to `backend/data/posts.json` during local fallback mode.
|
||||
Click the lock icon beside the header navigation and enter the journal admin password. Signing in enables **New article**, **Edit**, and **Delete** controls throughout the journal. The account icon opens the admin menu and sign-out control. You can also open `http://localhost:5173/blog/manage` directly; the page prompts you to sign in before writing.
|
||||
|
||||
The writing room uses Tiptap for headings, bold and italic text, lists, undo/redo, and inline font sizes. Creating, updating, and deleting articles uses Supabase when configured, or `backend/data/posts.json` in local fallback mode. Edit controls open `/blog/{slug}/edit` with the existing sections, formatting, topics, banner, and attachments. Editing a title preserves the published URL. Deleting an article requires confirmation and removes it from the journal; stored uploads remain available at their existing URLs.
|
||||
|
||||
Set unique production values in `backend/.env`:
|
||||
|
||||
@@ -67,11 +69,15 @@ JOURNAL_ADMIN_PASSWORD=replace-with-a-strong-password
|
||||
JOURNAL_TOKEN_SECRET=replace-with-a-long-random-secret
|
||||
```
|
||||
|
||||
The login endpoint returns a signed session that expires after four hours. The password remains server-side and the browser stores only the temporary token.
|
||||
The login endpoint returns a signed admin session that expires after four hours. The password remains server-side and the browser stores only the temporary token. The shared session restores after refresh and expires automatically. Every create, update, delete, and upload endpoint verifies the admin token on the server.
|
||||
|
||||
Reading the journal is public and independent of the admin session. Journal lists and article pages retry temporary failures once, refresh after successful sign-in, and offer **Try again** if the store remains unavailable. Existing content stays visible during failed refreshes. A temporary session-check failure preserves the saved token and can recover when the connection returns. Supabase reads use bounded retries and log the failure type/code without credentials or article content.
|
||||
|
||||
Use **+ Section** in the editor to add a section heading and opening paragraph. Section headings receive the same divider and uppercase drop cap as the starter articles, with formatting visible in the editor. Existing H2 headings use this styling automatically.
|
||||
|
||||
The publisher accepts a banner image (JPEG, PNG, WebP, or GIF, up to 8 MB) and up to ten additional photos or files (20 MB each). The banner appears in the journal thumbnail and above the article title; additional photos and downloadable files appear below the body. Uploads require an admin session. File contents are saved in `backend/data/uploads` in both article storage modes; set `JOURNAL_UPLOAD_DIR` to a persistent mounted directory in production and include it in backups. Uploaded files are publicly accessible by their generated URLs. Removing a selection from an unpublished draft does not delete its stored upload.
|
||||
The media picker supports drag-and-drop or file browsing, a live banner preview with the article title and subtitle, file-size and format checks, and duplicate detection by file name and size. Uploads have individual progress, cancel, and retry controls; a failed file does not stop the remaining queue. Retry or remove pending/failed uploads before publishing. Use the up/down controls to set the order of additional photos and files. Replacing a banner keeps the previous image until the replacement uploads successfully.
|
||||
|
||||
The publisher accepts a banner image (JPEG, PNG, WebP, or GIF, up to 8 MB) and up to ten additional photos or files (20 MB each). The banner appears in the journal thumbnail and behind the article title and subtitle with a readability overlay; additional photos and downloadable files appear below the body. Uploads require an admin session. File contents are saved in `backend/data/uploads` in both article storage modes; set `JOURNAL_UPLOAD_DIR` to a persistent mounted directory in production and include it in backups. Uploaded files are publicly accessible by their generated URLs. Removing a selection from an unpublished draft does not delete its stored upload.
|
||||
|
||||
For an existing Supabase project, run `bash scripts/setup_supabase.sh --schema-only` to add the nullable `banner` and default-empty `attachments` columns before running the updated backend. Existing articles remain compatible.
|
||||
|
||||
@@ -109,6 +115,10 @@ The access token must be project-scoped with **Database: Read-write** permission
|
||||
- `POST /api/auth/login`
|
||||
- `GET /api/auth/session`
|
||||
- `POST /api/posts` (authenticated)
|
||||
- `PUT /api/posts/{slug}` (authenticated)
|
||||
- `DELETE /api/posts/{slug}` (authenticated)
|
||||
- `POST /api/uploads` (authenticated)
|
||||
- `GET /api/uploads/{upload_id}`
|
||||
- `GET /api/resume`
|
||||
- `POST /api/contact`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user