Various fixes and improvements (#454, #1026, #1050, #1051, #1052, #1060)

This commit is contained in:
Imran Remtulla
2023-11-03 19:35:42 -04:00
parent 26971aa109
commit 5b142b4401
6 changed files with 31 additions and 22 deletions

View File

@@ -181,7 +181,7 @@ APKDetails getAPKUrlsFromFDroidPackagesAPIResponse(
List<String> apkUrls = releaseChoices
.map((e) => '${apkUrlPrefix}_${e['versionCode']}.apk')
.toList();
return APKDetails(version, getApkUrlsFromUrls(apkUrls),
return APKDetails(version, getApkUrlsFromUrls(apkUrls.toSet().toList()),
AppNames(sourceName, Uri.parse(standardUrl).pathSegments.last));
} else {
throw getObtainiumHttpError(res);

View File

@@ -108,7 +108,8 @@ class FDroidRepo extends AppSource {
if (appIdOrName == null) {
throw NoReleasesError();
}
var res = await sourceRequest('$standardUrl/index.xml');
var res = await sourceRequest(
'$standardUrl${standardUrl.endsWith('/index.xml') ? '' : '/index.xml'}');
if (res.statusCode == 200) {
var body = parse(res.body);
var foundApps = body.querySelectorAll('application').where((element) {

View File

@@ -170,7 +170,15 @@ class HTML extends AppSource {
List<String> allLinks = html
.querySelectorAll('a')
.map((element) => element.attributes['href'] ?? '')
.where((element) => element.isNotEmpty)
.toList();
if (allLinks.isEmpty) {
allLinks = RegExp(
r'(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?')
.allMatches(res.body)
.map((match) => match.group(0)!)
.toList();
}
List<String> links = [];
if ((additionalSettings['intermediateLinkRegex'] as String?)
?.isNotEmpty ==

View File

@@ -89,11 +89,11 @@ class Uptodown extends AppSource {
throw getObtainiumHttpError(res);
}
var html = parse(res.body);
var finalUrl =
(html.querySelector('.post-download')?.attributes['data-url']);
if (finalUrl == null) {
var finalUrlKey =
html.querySelector('.post-download')?.attributes['data-url'];
if (finalUrlKey == null) {
throw NoAPKError();
}
return finalUrl;
return 'https://dw.$host/dwn/$finalUrlKey';
}
}