mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2026-07-31 07:49:07 -04:00
- Introduced `wanderer_author_username` and `wanderer_author_domain` fields to the Trail model for better integration with the Wanderer API. - Updated TrailSerializer to include new fields and ensure proper backfilling of author information from the Wanderer API. - Enhanced import/export functionality to handle new author fields for backward compatibility. - Migrated Wanderer integration to use API key authentication, removing username and token fields for improved security. - Updated documentation to reflect changes in the Wanderer integration setup and usage. - Added utility functions for handling GeoJSON data from GPX files and improved error handling in related services. - Refactored views and serializers to accommodate the new integration structure and ensure seamless user experience.
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
import os
|
|
from rest_framework.response import Response
|
|
from rest_framework import viewsets, status
|
|
from rest_framework.permissions import IsAuthenticated
|
|
from integrations.models import ImmichIntegration, StravaToken, WandererIntegration
|
|
from django.conf import settings
|
|
|
|
|
|
class IntegrationView(viewsets.ViewSet):
|
|
permission_classes = [IsAuthenticated]
|
|
def list(self, request):
|
|
"""
|
|
RESTful GET method for listing all integrations.
|
|
"""
|
|
immich_integrations = ImmichIntegration.objects.filter(user=request.user)
|
|
google_map_integration = settings.GOOGLE_MAPS_API_KEY != ''
|
|
strava_integration_global = settings.STRAVA_CLIENT_ID != '' and settings.STRAVA_CLIENT_SECRET != ''
|
|
strava_integration_user = StravaToken.objects.filter(user=request.user).exists()
|
|
wanderer_integration = WandererIntegration.objects.filter(user=request.user).exists()
|
|
|
|
return Response(
|
|
{
|
|
'immich': immich_integrations.exists(),
|
|
'google_maps': google_map_integration,
|
|
'strava': {
|
|
'global': strava_integration_global,
|
|
'user': strava_integration_user
|
|
},
|
|
'wanderer': {
|
|
'exists': wanderer_integration,
|
|
}
|
|
},
|
|
status=status.HTTP_200_OK
|
|
)
|