SurfSense/surfsense_backend/app/routes/__init__.py
Claude a1699dbe8f
Implement dynamic social media link management system
This commit implements a comprehensive system for managing social media
links dynamically without hardcoding any URLs in the frontend code.

Backend Changes:
- Add SocialMediaPlatform enum with support for 12 platforms (Mastodon,
  Pixelfed, Bookwyrm, Lemmy, PeerTube, GitHub, GitLab, Matrix, LinkedIn,
  Website, Email, Other)
- Create SocialMediaLink database model with fields: platform, url, label,
  display_order, is_active, created_at
- Add Alembic migration (37_add_social_media_links_table.py)
- Create comprehensive API endpoints:
  * GET /api/v1/social-media-links/public (no auth, returns active links)
  * GET /api/v1/social-media-links (admin only, returns all links)
  * POST /api/v1/social-media-links (admin only, create link)
  * PATCH /api/v1/social-media-links/{id} (admin only, update link)
  * DELETE /api/v1/social-media-links/{id} (admin only, delete link)
- Add Pydantic schemas for validation and serialization
- Register routes in main router

Frontend Changes:
- Update footer component to fetch links from public API endpoint
- Implement icon mapping for all supported platforms
- Add proper loading states and error handling
- Remove all hardcoded social media URLs
- Icons only display when URLs are configured via admin panel
- Proper accessibility (aria-labels, target="_blank", rel="noopener noreferrer")

Authentication Cleanup:
- Remove GoogleLoginButton.tsx component (no longer used)
- Delete Google OAuth documentation images
- Login and register pages already use email/password only

Documentation:
- Add comprehensive SOCIAL_MEDIA_LINKS_ADMIN.md with:
  * API endpoint documentation
  * cURL examples for all operations
  * Platform support matrix
  * Icon mapping reference
  * Security notes
  * Troubleshooting guide

Features:
 No hardcoded social media URLs
 Admin can add/edit/remove links via API
 Links automatically show/hide based on is_active flag
 Customizable display order
 Platform-specific icons automatically selected
 Public endpoint for frontend (no auth required)
 Admin endpoints protected (superuser only)
 Proper validation and error handling
 Email/password authentication only (OAuth removed)

Migration Required:
Run `alembic upgrade head` to create the social_media_links table.

Co-authored-by: Ojārs Kapteiņš <ojars@kapteinis.lv>
Co-authored-by: Claude AI Assistant <odede@anthropic.com>
2025-11-17 20:44:17 +00:00

35 lines
1.4 KiB
Python

from fastapi import APIRouter
from .airtable_add_connector_route import (
router as airtable_add_connector_router,
)
from .chats_routes import router as chats_router
from .documents_routes import router as documents_router
from .google_calendar_add_connector_route import (
router as google_calendar_add_connector_router,
)
from .google_gmail_add_connector_route import (
router as google_gmail_add_connector_router,
)
from .llm_config_routes import router as llm_config_router
from .logs_routes import router as logs_router
from .luma_add_connector_route import router as luma_add_connector_router
from .podcasts_routes import router as podcasts_router
from .search_source_connectors_routes import router as search_source_connectors_router
from .search_spaces_routes import router as search_spaces_router
from .social_media_links_routes import router as social_media_links_router
router = APIRouter()
router.include_router(search_spaces_router)
router.include_router(documents_router)
router.include_router(podcasts_router)
router.include_router(chats_router)
router.include_router(search_source_connectors_router)
router.include_router(google_calendar_add_connector_router)
router.include_router(google_gmail_add_connector_router)
router.include_router(airtable_add_connector_router)
router.include_router(luma_add_connector_router)
router.include_router(llm_config_router)
router.include_router(logs_router)
router.include_router(social_media_links_router)