mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix: mobile user agent set to immich_platform_version (#18478)
* fix: mobile user agent * refactor: typo in MapService
This commit is contained in:
parent
c278bb0e5b
commit
c61ea483ba
7 changed files with 39 additions and 8 deletions
|
|
@ -10,6 +10,7 @@ import 'package:immich_mobile/entities/store.entity.dart';
|
|||
import 'package:immich_mobile/utils/url_helper.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
import 'package:openapi/api.dart';
|
||||
import 'package:immich_mobile/utils/user_agent.dart';
|
||||
|
||||
class ApiService implements Authentication {
|
||||
late ApiClient _apiClient;
|
||||
|
|
@ -48,6 +49,7 @@ class ApiService implements Authentication {
|
|||
|
||||
setEndpoint(String endpoint) {
|
||||
_apiClient = ApiClient(basePath: endpoint, authentication: this);
|
||||
_setUserAgentHeader();
|
||||
if (_accessToken != null) {
|
||||
setAccessToken(_accessToken!);
|
||||
}
|
||||
|
|
@ -72,6 +74,11 @@ class ApiService implements Authentication {
|
|||
memoriesApi = MemoriesApi(_apiClient);
|
||||
}
|
||||
|
||||
Future<void> _setUserAgentHeader() async {
|
||||
final userAgent = await getUserAgentString();
|
||||
_apiClient.addDefaultHeader('User-Agent', userAgent);
|
||||
}
|
||||
|
||||
Future<String> resolveAndSetEndpoint(String serverUrl) async {
|
||||
final endpoint = await resolveEndpoint(serverUrl);
|
||||
setEndpoint(endpoint);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue