mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-01 21:30:16 +02:00
Multi-host support + add '.net' host to APKPure source (#1250)
This commit is contained in:
@@ -6,23 +6,24 @@ import 'package:obtainium/providers/source_provider.dart';
|
||||
class HuaweiAppGallery extends AppSource {
|
||||
HuaweiAppGallery() {
|
||||
name = 'Huawei AppGallery';
|
||||
host = 'appgallery.huawei.com';
|
||||
hosts = ['appgallery.huawei.com'];
|
||||
overrideVersionDetectionFormDefault('releaseDateAsVersion',
|
||||
disableStandard: true);
|
||||
}
|
||||
|
||||
@override
|
||||
String sourceSpecificStandardizeURL(String url) {
|
||||
RegExp standardUrlRegEx = RegExp('^https?://(www\\.)?$host/app/[^/]+');
|
||||
RegExp standardUrlRegEx =
|
||||
RegExp('^https?://(www\\.)?${getSourceRegex(hosts)}/app/[^/]+');
|
||||
RegExpMatch? match = standardUrlRegEx.firstMatch(url.toLowerCase());
|
||||
if (match == null) {
|
||||
throw InvalidURLError(name);
|
||||
}
|
||||
return url.substring(0, match.end);
|
||||
return match.group(0)!;
|
||||
}
|
||||
|
||||
getDlUrl(String standardUrl) =>
|
||||
'https://${host!.replaceAll('appgallery.', 'appgallery.cloud.')}/appdl/${standardUrl.split('/').last}';
|
||||
'https://${hosts[0].replaceAll('appgallery.', 'appgallery.cloud.')}/appdl/${standardUrl.split('/').last}';
|
||||
|
||||
requestAppdlRedirect(String dlUrl) async {
|
||||
Response res = await sourceRequest(dlUrl, followRedirects: false);
|
||||
|
Reference in New Issue
Block a user