traffic with osm auth

This commit is contained in:
Tykayn 2025-09-21 12:27:00 +02:00 committed by tykayn
parent 6d755ee8dc
commit e274e91dcb
4 changed files with 649 additions and 5 deletions

View file

@ -68,12 +68,49 @@ If no events appear on the map:
3. Check the browser console for any JavaScript errors
4. Verify that the `/event` endpoint is working correctly by accessing it directly
## Additional Demo Pages
The demo section includes several specialized pages:
1. **Main Demo Page** (`/demo`): Shows a map with all current events
2. **Search Page** (`/demo/search`): Provides advanced search functionality
3. **Events by Type** (`/demo/by-what`): Lists events grouped by their type
4. **Map by Event Type** (`/demo/map-by-what`): Shows events on a map with filtering by type
5. **Add Event** (`/demo/add`): Form for adding new events
6. **Edit Event** (`/demo/edit/{id}`): Form for editing existing events
7. **Traffic Jam Reporting** (`/demo/traffic`): Form for reporting traffic jams with geolocation
### Traffic Jam Reporting Page
The traffic jam reporting page (`/demo/traffic`) provides a specialized form for reporting traffic jams. Features include:
- Button to automatically detect the user's current location using browser geolocation
- Map for selecting the location of the traffic jam
- Form fields for traffic jam details (description, severity, cause, etc.)
- Automatic reverse geocoding to determine the road/location name
- Submission to the API as a traffic.jam event type
- OpenStreetMap OAuth2 authentication to include the reporter's OSM username in the event
#### OpenStreetMap Authentication
The traffic jam reporting page includes OAuth2 authentication with OpenStreetMap:
- Users can authenticate with their OpenStreetMap account
- After authentication, the user's OSM username and a link to their profile are displayed
- When submitting a traffic jam report, the OSM username is included in the event properties as `reporter:osm`
- OAuth2 configuration parameters are stored in the `.env` file:
- `CLIENT_ID`: The OAuth2 client ID for the application
- `CLIENT_SECRET`: The OAuth2 client secret for the application
- `CLIENT_AUTORIZATIONS`: The permissions requested (default: "read_prefs")
- `CLIENT_REDIRECT`: The redirect URL after authentication
## Future Improvements
Potential future improvements for the demo page:
Potential future improvements for the demo pages:
1. Add date selection to view events from different dates
2. Add filtering options (by event type, location, etc.)
2. Add more filtering options (by event type, location, etc.)
3. Add a search box to find specific events
4. Improve the mobile experience
5. Add more interactive features to the map
5. Add more interactive features to the map
6. Expand the traffic reporting functionality to include other traffic-related events