Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug introduced in v1.1.16: APKPure fails to find universal APKs, Fix bugs found in APKPure URL matching #1774

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Currently supported App sources:
- [APKPure](https://apkpure.net/)
- [Aptoide](https://aptoide.com/)
- [Uptodown](https://uptodown.com/)
- [APKMirror](https://apkmirror.com/) (Track-Only)
- [Huawei AppGallery](https://appgallery.huawei.com/)
- Jenkins Jobs
- [APKMirror](https://apkmirror.com/) (Track-Only)
- Open Source - App-Specific:
- [Signal](https://signal.org/)
- [VLC](https://videolan.org/)
Expand Down
14 changes: 10 additions & 4 deletions lib/app_sources/apkpure.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class APKPure extends AppSource {
@override
String sourceSpecificStandardizeURL(String url) {
RegExp standardUrlRegExB = RegExp(
'^https?://m.${getSourceRegex(hosts)}/+[^/]+/+[^/]+(/+[^/]+)?',
'^https?://m.${getSourceRegex(hosts)}(/+[^/]{2})?/+[^/]+/+[^/]+',
caseSensitive: false);
RegExpMatch? match = standardUrlRegExB.firstMatch(url);
if (match != null) {
url = 'https://${getSourceRegex(hosts)}${Uri.parse(url).path}';
var uri = Uri.parse(url);
url = 'https://${uri.host.substring(2)}${uri.path}';
}
RegExp standardUrlRegExA = RegExp(
'^https?://(www\\.)?${getSourceRegex(hosts)}/+[^/]+/+[^/]+(/+[^/]+)?',
'^https?://(www\\.)?${getSourceRegex(hosts)}(/+[^/]{2})?/+[^/]+/+[^/]+',
caseSensitive: false);
match = standardUrlRegExA.firstMatch(url);
if (match == null) {
Expand Down Expand Up @@ -93,7 +94,11 @@ class APKPure extends AppSource {
var apkUrls = apksDiv
?.querySelectorAll('div.group-title')
.map((e) {
String? architecture = e.text.trim();
String architecture = e.text.trim();
if (architecture.toLowerCase() == 'unlimited' ||
architecture.toLowerCase() == 'universal') {
architecture = '';
}
// Only take the first APK for each architecture, ignore others for now, for simplicity
// Unclear why there can even be multiple APKs for the same version and arch
var apkInfo = e.nextElementSibling?.querySelector('div.info');
Expand All @@ -116,6 +121,7 @@ class APKPure extends AppSource {
DateTime? releaseDate =
parseDateTimeMMMddCommayyyy(dateString);
if (additionalSettings['autoApkFilterByArch'] == true &&
architecture.isNotEmpty &&
!supportedArchs.contains(architecture)) {
return const MapEntry('', '');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/source_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,9 @@ class SourceProvider {
APKPure(),
Aptoide(),
Uptodown(),
APKMirror(),
HuaweiAppGallery(),
Jenkins(),
APKMirror(),
Signal(),
VLC(),
WhatsApp(),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.16+2273
version: 1.1.17+2274

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down