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

Improved XAPK Support (#682), Custom user-agent for APKMirror (as per feedback in #1973), Minor change to German translation (#1986), #1990

Merged
merged 6 commits into from
Nov 23, 2024
Merged
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions lib/app_sources/apkmirror.dart
Copy link
Contributor

@DwainZwerg DwainZwerg Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood the discussion in the issue correctly, you didn't just want to change the user agent to obtainium/version number, but also give the option to change the user agent itself (although that probably wouldn't help). In this commit I don't see anything related to the second part. In the newest release I also couldn't change the User-Agent.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:html/parser.dart';
import 'package:http/http.dart';
import 'package:obtainium/components/generated_form.dart';
import 'package:obtainium/custom_errors.dart';
import 'package:obtainium/providers/apps_provider.dart';
import 'package:obtainium/providers/settings_provider.dart';
import 'package:obtainium/providers/source_provider.dart';

class APKMirror extends AppSource {
Expand All @@ -31,6 +33,16 @@ class APKMirror extends AppSource {
];
}

@override
Future<Map<String, String>?> getRequestHeaders(
Map<String, dynamic> additionalSettings,
{bool forAPKDownload = false}) async {
return {
"User-Agent":
"Obtainium/${(await getInstalledInfo(obtainiumId))?.versionName ?? '1.0.0'}"
};
}

@override
String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) {
RegExp standardUrlRegEx = RegExp(
Expand Down