improvement(redirects): move redirects to middleware, push to login if no session and workspace if session exists, remove telemetry consent dialog#976
Conversation
There was a problem hiding this comment.
Greptile Summary
This PR implements two major architectural improvements to enhance the user experience on self-hosted deployments:
1. Middleware-based Authentication Redirects: The redirect logic has been moved from Next.js config to middleware, implementing intelligent session-aware routing. For self-hosted deployments (isHosted = false), the root path now redirects authenticated users directly to /workspace and unauthenticated users to /login, bypassing the landing page entirely. This creates a streamlined experience for private/enterprise deployments where marketing content is unnecessary.
2. Telemetry Consent Dialog Removal: The entire telemetry consent workflow has been eliminated, including:
- Removal of the
TelemetryConsentDialogcomponent from the root layout - Database migration to drop the
telemetry_notified_usercolumn from the settings table - Cleanup of telemetry notification tracking from the general settings store and API endpoints
- Updated TypeScript interfaces to remove consent-related properties
The changes maintain core telemetry functionality (users can still enable/disable in settings) while removing the consent dialog that previously interrupted the user onboarding flow. The middleware approach provides better performance by handling redirects before React components render, and centralizes authentication logic in a more appropriate architectural layer.
Confidence score: 3/5
- This PR requires careful review due to significant changes in authentication flow and privacy consent handling
- Score reflects concerns about removing user consent mechanisms for telemetry collection, which may impact privacy compliance
- Pay close attention to middleware.ts, the database migration files, and the removed telemetry consent dialog functionality
14 files reviewed, no comments
…f no session and workspace if session exists
691e58d to
1dcb096
Compare
1dcb096 to
5682a8c
Compare
…f no session and workspace if session exists, remove telemetry consent dialog (simstudioai#976) * improvement(redirects): move redirects to middleware, push to login if no session and workspace if session exists * remove telemetry consent dialog * remove migrations * rerun migrations
Summary
Type of Change
Testing
Tested manually, incognito browser to make sure I can't access the homepage.
Checklist
Screenshots/Videos