Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
672f497733 |
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.0.1] - 2026-01-03
|
||||
|
||||
### Fixed
|
||||
- Web authentication now works correctly with NPM forward auth
|
||||
- Dio client sends cookies with requests via `withCredentials: true`
|
||||
- Added platform-specific adapters (native vs web) for proper cookie handling
|
||||
|
||||
## [1.0.0] - 2026-01-03
|
||||
|
||||
### Added
|
||||
|
||||
@@ -3,23 +3,26 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:tatlock_ui/core/api/api_interceptors.dart';
|
||||
import 'package:tatlock_ui/core/config/app_config.dart';
|
||||
|
||||
import 'api_client_native.dart' if (dart.library.html) 'api_client_web.dart'
|
||||
as platform;
|
||||
|
||||
part 'api_client.g.dart';
|
||||
|
||||
/// Provides the Dio instance for Core API.
|
||||
@riverpod
|
||||
Dio coreApiClient(Ref ref) {
|
||||
final dio = Dio(
|
||||
BaseOptions(
|
||||
baseUrl: AppConfig.coreApiUrl,
|
||||
connectTimeout: const Duration(seconds: 10),
|
||||
receiveTimeout: const Duration(seconds: 30),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
),
|
||||
final options = BaseOptions(
|
||||
baseUrl: AppConfig.coreApiUrl,
|
||||
connectTimeout: const Duration(seconds: 10),
|
||||
receiveTimeout: const Duration(seconds: 30),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
final dio = platform.createDio(options);
|
||||
|
||||
dio.interceptors.addAll([
|
||||
AuthInterceptor(ref),
|
||||
LoggingInterceptor(),
|
||||
@@ -32,18 +35,18 @@ Dio coreApiClient(Ref ref) {
|
||||
/// Provides the Dio instance for Tatlock API.
|
||||
@riverpod
|
||||
Dio tatlockApiClient(Ref ref) {
|
||||
final dio = Dio(
|
||||
BaseOptions(
|
||||
baseUrl: AppConfig.tatlockApiUrl,
|
||||
connectTimeout: const Duration(seconds: 10),
|
||||
receiveTimeout: const Duration(minutes: 5), // Longer for LLM responses
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
),
|
||||
final options = BaseOptions(
|
||||
baseUrl: AppConfig.tatlockApiUrl,
|
||||
connectTimeout: const Duration(seconds: 10),
|
||||
receiveTimeout: const Duration(minutes: 5), // Longer for LLM responses
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
final dio = platform.createDio(options);
|
||||
|
||||
dio.interceptors.addAll([
|
||||
AuthInterceptor(ref),
|
||||
LoggingInterceptor(),
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
/// Create a Dio instance for native platforms (mobile, desktop).
|
||||
Dio createDio(BaseOptions options) {
|
||||
return Dio(options);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio_web_adapter/dio_web_adapter.dart';
|
||||
|
||||
/// Create a Dio instance for web platform with credentials support.
|
||||
///
|
||||
/// Enables `withCredentials` to send cookies with requests, which is
|
||||
/// required for NPM forward auth to work correctly.
|
||||
Dio createDio(BaseOptions options) {
|
||||
final dio = Dio(options);
|
||||
dio.httpClientAdapter = BrowserHttpClientAdapter(withCredentials: true);
|
||||
return dio;
|
||||
}
|
||||
+2
-1
@@ -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.0+1
|
||||
version: 1.0.1+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.10.4
|
||||
@@ -67,6 +67,7 @@ dependencies:
|
||||
url_launcher: ^6.3.1
|
||||
flutter_code_editor: ^0.3.5
|
||||
highlight: ^0.7.0
|
||||
dio_web_adapter: ^2.1.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user