Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Redesign] Switch Android client ID source. #878

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/services/jellyfin_api.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';
import 'dart:io' show HttpClient, Platform;

import 'package:app_set_id/app_set_id.dart';
import 'package:chopper/chopper.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:finamp/services/http_aggregate_logging_interceptor.dart';
Expand Down Expand Up @@ -331,7 +332,6 @@ abstract class JellyfinApi extends ChopperService {
)
@Get(path: "/Artists")
Future<dynamic> getArtists({

/// Specify this to localize the search to a specific item or folder. Omit
/// to use the root.
@Query("ParentId") String? parentId,
Expand Down Expand Up @@ -382,7 +382,6 @@ abstract class JellyfinApi extends ChopperService {

/// Optional. If enabled, only favorite artists will be returned.
@Query("IsFavorite") bool? isFavorite,

});

@FactoryConverter(
Expand Down Expand Up @@ -521,7 +520,8 @@ abstract class JellyfinApi extends ChopperService {
final client = ChopperClient(
client: http.IOClient(HttpClient()
..connectionTimeout = const Duration(
seconds: 10) // if we don't get a response by then, it's probably not worth it to wait any longer. this prevents the server connection test from taking too long
seconds:
10) // if we don't get a response by then, it's probably not worth it to wait any longer. this prevents the server connection test from taking too long
),
// The first part of the URL is now here
services: [
Expand Down Expand Up @@ -604,13 +604,14 @@ Future<String> getAuthHeader() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Platform.isAndroid) {
AndroidDeviceInfo androidDeviceInfo = await deviceInfo.androidInfo;
final appSetId = await AppSetId().getIdentifier();
authHeader = '${authHeader}Device="${androidDeviceInfo.model}", ';
authHeader = '${authHeader}DeviceId="${androidDeviceInfo.id}", ';
authHeader = '${authHeader}DeviceId="$appSetId", ';
} else if (Platform.isIOS) {
IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
final appSetId = await AppSetId().getIdentifier();
authHeader = '${authHeader}Device="${iosDeviceInfo.name}", ';
authHeader =
'${authHeader}DeviceId="${iosDeviceInfo.identifierForVendor}", ';
authHeader = '${authHeader}DeviceId="$appSetId", ';
} else if (Platform.isWindows) {
WindowsDeviceInfo windowsDeviceInfo = await deviceInfo.windowsInfo;
authHeader = '${authHeader}Device="${windowsDeviceInfo.computerName}", ';
Expand Down
Loading