feat: implement device-based routing for short links#340
Conversation
Add ability to set different destination URLs for iOS, Android, and Desktop devices. Users on Business and Unlimited tiers can configure device-specific redirects that automatically route visitors based on their device type. Backend changes: - Add device detection module (src/utils/device.rs) with User-Agent parsing - Add device URL columns (ios_url, android_url, desktop_url) to links table - Update Link and LinkMapping models with device URL fields - Integrate device detection into redirect handler for automatic routing - Add tier gating for device routing (Business+ only) - Update all repository queries to include device URL fields - Fix usage API to return allow_device_routing flag Frontend changes: - Add device routing UI to LinkModal with collapsible section - Show device-specific URL inputs (iOS, Android, Desktop) with icons - Display upgrade CTA for Free/Pro tiers - Update TypeScript API types with device URL fields The feature is backward compatible - existing links continue to work normally, falling back to the default destination URL when device-specific URLs are not set.
|
🚀 Ephemeral Environment Deployed (Unified Worker) Application: https://rushomon-pr-340.piffio.workers.dev This unified Worker deployment serves both frontend and backend from the same domain for better security (httpOnly cookies work correctly). This environment will be automatically cleaned up when the PR is closed. Worker: 💡 Tip: To skip preview deployment, add the |
…ange Previously, KV sync only occurred when link status changed, causing device routing to fail when editing a link to add device-specific URLs. The redirect handler reads from KV, so stale data caused fallback to default destination URL. Now KV syncs whenever any LinkMapping field changes: - status - destination_url - ios_url - android_url - desktop_url - redirect_type - expires_at This ensures device routing works correctly after editing a link to add or modify device-specific redirect URLs.
|
🚀 Ephemeral Environment Deployed (Unified Worker) Application: https://rushomon-pr-340.piffio.workers.dev This unified Worker deployment serves both frontend and backend from the same domain for better security (httpOnly cookies work correctly). This environment will be automatically cleaned up when the PR is closed. Worker: 💡 Tip: To skip preview deployment, add the |
|
🚀 Ephemeral Environment Deployed (Unified Worker) Application: https://rushomon-pr-340.piffio.workers.dev This unified Worker deployment serves both frontend and backend from the same domain for better security (httpOnly cookies work correctly). This environment will be automatically cleaned up when the PR is closed. Worker: 💡 Tip: To skip preview deployment, add the |
When editing a link and removing device-specific URLs, the frontend now correctly sends clear_ios_url, clear_android_url, and clear_desktop_url flags to ensure URLs are cleared in both D1 and KV stores.
|
🚀 Ephemeral Environment Deployed (Unified Worker) Application: https://rushomon-pr-340.piffio.workers.dev This unified Worker deployment serves both frontend and backend from the same domain for better security (httpOnly cookies work correctly). This environment will be automatically cleaned up when the PR is closed. Worker: 💡 Tip: To skip preview deployment, add the |
|
🧹 Ephemeral Environment Cleaned Up Resources for PR #340 cleanup summary:
Cleanup completed automatically when PR was closed. Note: If this PR had the |
Add ability to set different destination URLs for iOS, Android, and Desktop devices. Users on Business and Unlimited tiers can configure device-specific redirects that automatically route visitors based on their device type.
Backend changes:
Frontend changes:
The feature is backward compatible - existing links continue to work normally, falling back to the default destination URL when device-specific URLs are not set.
Closes #108