From ff5df30c536272f56bbfc6a40f3cc7e922d6e2ad Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 4 Jan 2026 12:55:36 +0100 Subject: [PATCH] feat(web): switch to path-based URL strategy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove hash from URLs (/#/login -> /login) using usePathUrlStrategy(). Uses conditional imports to only apply on web, keeping mobile/desktop builds unaffected. Required for OIDC callback to work - Authentik redirects to /callback which Flutter now recognizes as a route. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CHANGELOG.md | 7 +++++++ lib/core/config/url_strategy.dart | 5 +++++ lib/core/config/url_strategy_stub.dart | 4 ++++ lib/core/config/url_strategy_web.dart | 10 ++++++++++ lib/main.dart | 4 ++++ pubspec.yaml | 4 +++- 6 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 lib/core/config/url_strategy.dart create mode 100644 lib/core/config/url_strategy_stub.dart create mode 100644 lib/core/config/url_strategy_web.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index feb86ee..610054c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.8] - 2026-01-04 + +### Changed +- Switched from hash-based URLs (`/#/login`) to path-based URLs (`/login`) + - Required for OIDC callback to work correctly + - Uses conditional import to avoid breaking mobile/desktop builds + ## [1.0.7] - 2026-01-04 ### Fixed diff --git a/lib/core/config/url_strategy.dart b/lib/core/config/url_strategy.dart new file mode 100644 index 0000000..7fea529 --- /dev/null +++ b/lib/core/config/url_strategy.dart @@ -0,0 +1,5 @@ +/// URL strategy with conditional imports for web/non-web platforms. +library; + +export 'url_strategy_stub.dart' + if (dart.library.js_interop) 'url_strategy_web.dart'; diff --git a/lib/core/config/url_strategy_stub.dart b/lib/core/config/url_strategy_stub.dart new file mode 100644 index 0000000..86a607a --- /dev/null +++ b/lib/core/config/url_strategy_stub.dart @@ -0,0 +1,4 @@ +/// Stub for non-web platforms - does nothing. +void configureUrlStrategy() { + // No-op on mobile/desktop +} diff --git a/lib/core/config/url_strategy_web.dart b/lib/core/config/url_strategy_web.dart new file mode 100644 index 0000000..361157c --- /dev/null +++ b/lib/core/config/url_strategy_web.dart @@ -0,0 +1,10 @@ +/// Web-specific URL strategy configuration. +library; + +import 'package:flutter_web_plugins/url_strategy.dart'; + +void configureUrlStrategy() { + // Use path-based URLs instead of hash-based (e.g., /login instead of /#/login) + // Required for OIDC callback to work properly + usePathUrlStrategy(); +} diff --git a/lib/main.dart b/lib/main.dart index d42c97e..2a90a5d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,11 +4,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'app.dart'; +import 'core/config/url_strategy.dart'; import 'version.g.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); + // Use path-based URLs on web (no-op on mobile/desktop) + configureUrlStrategy(); + developer.log( '${AppVersion.name} v${AppVersion.fullVersion}', name: 'tatlock_ui', diff --git a/pubspec.yaml b/pubspec.yaml index 3ab47c9..3e30805 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.7+1 +version: 1.0.8+1 environment: sdk: ^3.10.4 @@ -30,6 +30,8 @@ environment: dependencies: flutter: sdk: flutter + flutter_web_plugins: + sdk: flutter # State Management flutter_riverpod: ^3.0.0