mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-13 10:28:10 +02:00
Added cloudflare.f-droid.org support
This commit is contained in:
@@ -14,12 +14,14 @@ class FDroid extends AppSource {
|
|||||||
@override
|
@override
|
||||||
String standardizeURL(String url) {
|
String standardizeURL(String url) {
|
||||||
RegExp standardUrlRegExB =
|
RegExp standardUrlRegExB =
|
||||||
RegExp('^https?://$host/+[^/]+/+packages/+[^/]+');
|
RegExp('^https?://(cloudflare\\.)?$host/+[^/]+/+packages/+[^/]+');
|
||||||
RegExpMatch? match = standardUrlRegExB.firstMatch(url.toLowerCase());
|
RegExpMatch? match = standardUrlRegExB.firstMatch(url.toLowerCase());
|
||||||
if (match != null) {
|
if (match != null) {
|
||||||
url = 'https://$host/packages/${Uri.parse(url).pathSegments.last}';
|
url =
|
||||||
|
'https://${Uri.parse(url.substring(0, match.end)).host}/packages/${Uri.parse(url).pathSegments.last}';
|
||||||
}
|
}
|
||||||
RegExp standardUrlRegExA = RegExp('^https?://$host/+packages/+[^/]+');
|
RegExp standardUrlRegExA =
|
||||||
|
RegExp('^https?://(cloudflare\\.)?$host/+packages/+[^/]+');
|
||||||
match = standardUrlRegExA.firstMatch(url.toLowerCase());
|
match = standardUrlRegExA.firstMatch(url.toLowerCase());
|
||||||
if (match == null) {
|
if (match == null) {
|
||||||
throw InvalidURLError(name);
|
throw InvalidURLError(name);
|
||||||
@@ -61,9 +63,10 @@ class FDroid extends AppSource {
|
|||||||
Map<String, dynamic> additionalSettings,
|
Map<String, dynamic> additionalSettings,
|
||||||
) async {
|
) async {
|
||||||
String? appId = tryInferringAppId(standardUrl);
|
String? appId = tryInferringAppId(standardUrl);
|
||||||
|
String host = Uri.parse(standardUrl).host;
|
||||||
return getAPKUrlsFromFDroidPackagesAPIResponse(
|
return getAPKUrlsFromFDroidPackagesAPIResponse(
|
||||||
await get(Uri.parse('https://f-droid.org/api/v1/packages/$appId')),
|
await get(Uri.parse('https://$host/api/v1/packages/$appId')),
|
||||||
'https://f-droid.org/repo/$appId',
|
'https://$host/repo/$appId',
|
||||||
standardUrl);
|
standardUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -363,7 +363,7 @@ class SourceProvider {
|
|||||||
url = preStandardizeUrl(url);
|
url = preStandardizeUrl(url);
|
||||||
AppSource? source;
|
AppSource? source;
|
||||||
for (var s in sources.where((element) => element.host != null)) {
|
for (var s in sources.where((element) => element.host != null)) {
|
||||||
if (url.contains('://${s.host}')) {
|
if (RegExp('://(.+\\.)?${s.host}').hasMatch(url)) {
|
||||||
source = s;
|
source = s;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user