diff --git a/lib/app_sources/fdroid.dart b/lib/app_sources/fdroid.dart index c7b2dda..c071c02 100644 --- a/lib/app_sources/fdroid.dart +++ b/lib/app_sources/fdroid.dart @@ -181,7 +181,7 @@ APKDetails getAPKUrlsFromFDroidPackagesAPIResponse( List 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); diff --git a/lib/app_sources/fdroidrepo.dart b/lib/app_sources/fdroidrepo.dart index e61d544..b0d74d8 100644 --- a/lib/app_sources/fdroidrepo.dart +++ b/lib/app_sources/fdroidrepo.dart @@ -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) { diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index a2dacdb..13dcdd8 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -170,7 +170,15 @@ class HTML extends AppSource { List 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 links = []; if ((additionalSettings['intermediateLinkRegex'] as String?) ?.isNotEmpty == diff --git a/lib/app_sources/uptodown.dart b/lib/app_sources/uptodown.dart index c764b7c..7a0b41d 100644 --- a/lib/app_sources/uptodown.dart +++ b/lib/app_sources/uptodown.dart @@ -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'; } } diff --git a/lib/pages/app.dart b/lib/pages/app.dart index 7622a96..14e33d4 100644 --- a/lib/pages/app.dart +++ b/lib/pages/app.dart @@ -155,10 +155,13 @@ class _AppPageState extends State { const SizedBox(height: 20), app?.icon != null ? Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - Image.memory( - app!.icon!, - height: 150, - gaplessPlayback: true, + GestureDetector( + child: Image.memory( + app!.icon!, + height: 150, + gaplessPlayback: true, + ), + onTap: () => pm.openApp(app.app.id), ) ]) : Container(), @@ -463,15 +466,15 @@ class _AppPageState extends State { : null)) ], )); - + appScreenAppBar() => AppBar( - leading: IconButton( - icon: const Icon(Icons.arrow_back), - onPressed: () { - Navigator.pop(context); - }, - ), - ); + leading: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () { + Navigator.pop(context); + }, + ), + ); return Scaffold( appBar: settingsProvider.showAppWebpage ? AppBar() : appScreenAppBar(), diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index e5ea114..5736027 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -283,9 +283,6 @@ preStandardizeUrl(String url) { url.toLowerCase().indexOf('https://') != 0) { url = 'https://$url'; } - if (url.toLowerCase().indexOf('https://www.') == 0) { - url = 'https://${url.substring(12)}'; - } url = url .split('/') .where((e) => e.isNotEmpty) @@ -599,7 +596,7 @@ class SourceProvider { AppSource? source; for (var s in sources.where((element) => element.host != null)) { if (RegExp( - '://${s.allowSubDomains ? '([^\\.]+\\.)*' : ''}${s.host}(/|\\z)?') + '://(${s.allowSubDomains ? '([^\\.]+\\.)*' : ''}|www\\.)${s.host}(/|\\z)?') .hasMatch(url)) { source = s; break;