mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-16 14:46:44 +02:00
Auto-select direct APK source for URLs ending in '.apk' (#1820)
This commit is contained in:
@ -1,12 +1,12 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:obtainium/app_sources/html.dart';
|
||||
import 'package:obtainium/custom_errors.dart';
|
||||
import 'package:obtainium/providers/source_provider.dart';
|
||||
|
||||
class DirectAPKLink extends AppSource {
|
||||
HTML html = HTML();
|
||||
|
||||
DirectAPKLink() {
|
||||
neverAutoSelect = true;
|
||||
name = tr('directAPKLink');
|
||||
additionalSourceAppSpecificSettingFormItems = html
|
||||
.additionalSourceAppSpecificSettingFormItems
|
||||
@ -24,6 +24,20 @@ class DirectAPKLink extends AppSource {
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) {
|
||||
print('AAA');
|
||||
if (!forSelection) {
|
||||
return url;
|
||||
}
|
||||
RegExp standardUrlRegExA = RegExp('.+\\.apk\$', caseSensitive: false);
|
||||
var match = standardUrlRegExA.firstMatch(url);
|
||||
if (match == null) {
|
||||
throw InvalidURLError(name);
|
||||
}
|
||||
return match.group(0)!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, String>?> getRequestHeaders(
|
||||
Map<String, dynamic> additionalSettings,
|
||||
|
Reference in New Issue
Block a user