85 lines
2.7 KiB
Markdown
85 lines
2.7 KiB
Markdown
# Admin Content Editor Access
|
|
|
|
## Quick Access
|
|
|
|
The site content management editor is now available at:
|
|
|
|
**URL:** `http://localhost:3000/_app/admin-content-editor.html`
|
|
|
|
Or for production:
|
|
|
|
**URL:** `https://yourdomain.com/_app/admin-content-editor.html`
|
|
|
|
## Requirements
|
|
|
|
- Must be logged in as an admin user
|
|
- User account must have `role='admin'` in the database
|
|
- Valid JWT authentication cookie
|
|
|
|
## Features
|
|
|
|
✅ Edit modal content (rules, instructions, help text)
|
|
✅ Update footer links (Discord, GitHub, Instagram, etc.)
|
|
✅ Manage multiple locales (English, Chinese, etc.)
|
|
✅ Add/remove/edit individual content items
|
|
✅ Bulk save changes
|
|
✅ Initialize default content with one click
|
|
|
|
## File Locations
|
|
|
|
**Important:** The `frontend/` directory is regenerated on every build!
|
|
|
|
- **Source (for frontend-src builds):** [frontend-src/static/_app/admin-content-editor.html](frontend-src/static/_app/admin-content-editor.html)
|
|
- **Backup (for USE_FRONTEND_BACKUP=true):** [frontend-backup/_app/admin-content-editor.html](frontend-backup/_app/admin-content-editor.html)
|
|
- **Active (auto-generated):** `frontend/_app/admin-content-editor.html` (copied during build - DO NOT EDIT)
|
|
|
|
### Which File to Edit?
|
|
|
|
- **If using frontend-src builds:** Edit `frontend-src/static/_app/admin-content-editor.html`
|
|
- **If using frontend-backup:** Edit `frontend-backup/_app/admin-content-editor.html`
|
|
- **Never edit** files in `frontend/` - they get deleted on every build!
|
|
|
|
## Integration
|
|
|
|
The content editor is:
|
|
1. A standalone HTML page (no build required)
|
|
2. Uses vanilla JavaScript (no framework dependencies)
|
|
3. Authenticates using existing JWT cookies
|
|
4. Calls the site-content API endpoints
|
|
|
|
## Adding to Admin Panel Navigation
|
|
|
|
Since the admin panel is a compiled SvelteKit app, to add a navigation link:
|
|
|
|
1. Edit the source Svelte file in `frontend-src/src/routes/admin/+page.svelte`
|
|
2. Add a link/button to `/_app/admin-content-editor.html`
|
|
3. Rebuild the frontend: `cd frontend-src && npm run build`
|
|
|
|
**Or** simply bookmark/share the direct URL with your admin team!
|
|
|
|
## Build Process
|
|
|
|
### When using frontend-src:
|
|
```bash
|
|
cd frontend-src
|
|
npm run build
|
|
# Copies files from frontend-src/static/_app/ to frontend/_app/
|
|
```
|
|
|
|
### When using frontend-backup (Docker):
|
|
```bash
|
|
docker-compose up --build -d
|
|
# With USE_FRONTEND_BACKUP=true in docker-compose.yml
|
|
# Copies files from frontend-backup/_app/ to frontend/_app/
|
|
```
|
|
|
|
## API Endpoints Used
|
|
|
|
- `GET /api/admin/site-content` - Fetch all content
|
|
- `POST /api/admin/site-content` - Create/update item
|
|
- `POST /api/admin/site-content/bulk` - Bulk update
|
|
- `DELETE /api/admin/site-content/:key` - Delete item
|
|
- `POST /api/admin/site-content/initialize` - Load defaults
|
|
|
|
See [CONTENT-MANAGEMENT.md](CONTENT-MANAGEMENT.md) for detailed documentation.
|