From 4b66aefb33e70b95554880a2375f25b447c2c92b Mon Sep 17 00:00:00 2001 From: PadowYT2 Date: Mon, 20 Jan 2025 21:04:51 +0300 Subject: [PATCH 1/7] Initial progress of RuStore almost ran out of storage space while trying to build --- README.md | 7 +- android/app/build.gradle | 2 +- .../android/en-US/full_description.txt | 14 +--- .../metadata/android/ru/full_description.txt | 14 +--- lib/app_sources/rustore.dart | 77 +++++++++++++++++++ lib/providers/source_provider.dart | 2 + 6 files changed, 90 insertions(+), 26 deletions(-) create mode 100644 lib/app_sources/rustore.dart diff --git a/README.md b/README.md index 8bc6074..5b44b0c 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,14 @@ 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/) - [Tencent App Store](https://sj.qq.com/) - Jenkins Jobs - - [APKMirror](https://apkmirror.com/) (Track-Only) + - [RuStore](https://rustore.ru/) - Other - App-Specific: - - [Telegram App](https://telegram.org) - - [Neutron Code](https://neutroncode.com) + - [Telegram App](https://telegram.org/) + - [Neutron Code](https://neutroncode.com/) - Direct APK Link - "HTML" (Fallback): Any other URL that returns an HTML page with links to APK files diff --git a/android/app/build.gradle b/android/app/build.gradle index d6c5d7b..8ccb3d8 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -78,7 +78,7 @@ android { buildTypes { release { - signingConfig signingConfigs.release + } debug { applicationIdSuffix = ".debug" diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index d76120c..90025e2 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -13,7 +13,6 @@
  • F-Droid
  • Third Party F-Droid Repos
  • IzzyOnDroid
  • -
  • SourceForge
  • SourceHut
  • @@ -22,24 +21,17 @@ - -
  • -

    Open Source - App-Specific:

    -
  • Other - App-Specific:

    diff --git a/fastlane/metadata/android/ru/full_description.txt b/fastlane/metadata/android/ru/full_description.txt index 2fa41ba..e762156 100644 --- a/fastlane/metadata/android/ru/full_description.txt +++ b/fastlane/metadata/android/ru/full_description.txt @@ -13,7 +13,6 @@
  • F-Droid
  • Third Party F-Droid Repos
  • IzzyOnDroid
  • -
  • SourceForge
  • SourceHut
  • @@ -22,24 +21,17 @@ - -
  • -

    Свободное ПО - Для отдельных приложений:

    -
  • Другие - Для отдельных приложений:

    diff --git a/lib/app_sources/rustore.dart b/lib/app_sources/rustore.dart new file mode 100644 index 0000000..f569d80 --- /dev/null +++ b/lib/app_sources/rustore.dart @@ -0,0 +1,77 @@ +import 'dart:convert'; + +import 'package:easy_localization/easy_localization.dart'; +import 'package:http/http.dart'; +import 'package:obtainium/custom_errors.dart'; +import 'package:obtainium/providers/source_provider.dart'; + +class RuStore extends AppSource { + RuStore() { + hosts = ['rustore.ru']; + name = 'RuStore'; + naiveStandardVersionDetection = true; + showReleaseDateAsVersionToggle = true; + } + + @override + String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { + RegExp standardUrlRegEx = RegExp( + '^https?://(www\\.)?${getSourceRegex(hosts)}/catalog/app/+[^/]+', + caseSensitive: false); + RegExpMatch? match = standardUrlRegEx.firstMatch(url); + if (match == null) { + throw InvalidURLError(name); + } + return match.group(0)!; + } + + @override + Future tryInferringAppId(String standardUrl, + {Map additionalSettings = const {}}) async { + return Uri.parse(standardUrl).pathSegments.last; + } + + @override + Future getLatestAPKDetails( + String standardUrl, + Map additionalSettings, + ) async { + String? appId = await tryInferringAppId(standardUrl); + Response res0 = await sourceRequest( + 'https://backapi.${hosts[0]}/applicationData/overallInfo/${appId}', + additionalSettings); + if (res0.statusCode != 200) { + throw getObtainiumHttpError(res0); + } + var appDetails = jsonDecode(res0.body)['body']; + if (appDetails['appId'] == null) { + throw NoReleasesError(); + } + + String appName = appDetails['appName'] ?? tr('app'); + String author = appDetails['companyName'] ?? name; + String? dateStr = appDetails['updatedAt']; + String? version = appDetails['versionName']; + if (version == null) { + throw NoVersionError(); + } + DateTime? relDate; + if (dateStr != null) { + relDate = DateTime.parse(dateStr); + } + + Response res1 = await sourceRequest( + 'https://backapi.${hosts[0]}/applicationData/download-link', + additionalSettings, + followRedirects: false, + postBody: {"appId": appDetails['appId'], "firstInstall": true}); + var downloadDetails = jsonDecode(res0.body)['body']; + if (res1.statusCode != 200 && downloadDetails['apkUrl'] == null) { + throw NoAPKError(); + } + + return APKDetails(version, getApkUrlsFromUrls([downloadDetails['apkUrl']]), + AppNames(author, appName), + releaseDate: relDate); + } +} diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index b55f759..4a1bbf7 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -23,6 +23,7 @@ import 'package:obtainium/app_sources/izzyondroid.dart'; import 'package:obtainium/app_sources/html.dart'; import 'package:obtainium/app_sources/jenkins.dart'; import 'package:obtainium/app_sources/neutroncode.dart'; +import 'package:obtainium/app_sources/rustore.dart'; import 'package:obtainium/app_sources/sourceforge.dart'; import 'package:obtainium/app_sources/sourcehut.dart'; import 'package:obtainium/app_sources/telegramapp.dart'; @@ -864,6 +865,7 @@ class SourceProvider { Tencent(), Jenkins(), APKMirror(), + RuStore, TelegramApp(), NeutronCode(), DirectAPKLink(), From be739b763941b53403ed1cacdcb0cd3a09d11b7d Mon Sep 17 00:00:00 2001 From: PadowYT2 Date: Mon, 20 Jan 2025 21:06:08 +0300 Subject: [PATCH 2/7] Call the function properly --- lib/providers/source_provider.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/providers/source_provider.dart b/lib/providers/source_provider.dart index 4a1bbf7..4a4cdd7 100644 --- a/lib/providers/source_provider.dart +++ b/lib/providers/source_provider.dart @@ -865,7 +865,7 @@ class SourceProvider { Tencent(), Jenkins(), APKMirror(), - RuStore, + RuStore(), TelegramApp(), NeutronCode(), DirectAPKLink(), From 1f829289edb8e4eda0e823e25f260056e5d9b8e8 Mon Sep 17 00:00:00 2001 From: PadowYT2 Date: Mon, 20 Jan 2025 21:36:02 +0300 Subject: [PATCH 3/7] Fix the API URL having www --- lib/app_sources/rustore.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app_sources/rustore.dart b/lib/app_sources/rustore.dart index f569d80..13c35e0 100644 --- a/lib/app_sources/rustore.dart +++ b/lib/app_sources/rustore.dart @@ -38,7 +38,7 @@ class RuStore extends AppSource { ) async { String? appId = await tryInferringAppId(standardUrl); Response res0 = await sourceRequest( - 'https://backapi.${hosts[0]}/applicationData/overallInfo/${appId}', + 'https://backapi.rustore.ru/applicationData/overallInfo/$appId', additionalSettings); if (res0.statusCode != 200) { throw getObtainiumHttpError(res0); @@ -61,7 +61,7 @@ class RuStore extends AppSource { } Response res1 = await sourceRequest( - 'https://backapi.${hosts[0]}/applicationData/download-link', + 'https://backapi.rustore.ru/applicationData/download-link', additionalSettings, followRedirects: false, postBody: {"appId": appDetails['appId'], "firstInstall": true}); From 16ecc88fcd068590ce702107f59afdb7ac3fc53e Mon Sep 17 00:00:00 2001 From: PadowYT2 Date: Mon, 20 Jan 2025 21:47:43 +0300 Subject: [PATCH 4/7] Debug the response --- lib/app_sources/rustore.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/app_sources/rustore.dart b/lib/app_sources/rustore.dart index 13c35e0..266fc58 100644 --- a/lib/app_sources/rustore.dart +++ b/lib/app_sources/rustore.dart @@ -43,6 +43,9 @@ class RuStore extends AppSource { if (res0.statusCode != 200) { throw getObtainiumHttpError(res0); } + + print(res0); + var appDetails = jsonDecode(res0.body)['body']; if (appDetails['appId'] == null) { throw NoReleasesError(); From 21dacb6171893cfc74ede7a2e421cc70ce9a2d6b Mon Sep 17 00:00:00 2001 From: PadowYT2 Date: Mon, 20 Jan 2025 22:03:06 +0300 Subject: [PATCH 5/7] Revert "Debug the response" This reverts commit 16ecc88fcd068590ce702107f59afdb7ac3fc53e. --- lib/app_sources/rustore.dart | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/app_sources/rustore.dart b/lib/app_sources/rustore.dart index 266fc58..13c35e0 100644 --- a/lib/app_sources/rustore.dart +++ b/lib/app_sources/rustore.dart @@ -43,9 +43,6 @@ class RuStore extends AppSource { if (res0.statusCode != 200) { throw getObtainiumHttpError(res0); } - - print(res0); - var appDetails = jsonDecode(res0.body)['body']; if (appDetails['appId'] == null) { throw NoReleasesError(); From 03f50e501ee8856444e1a9147c5f58e36efa72ff Mon Sep 17 00:00:00 2001 From: PadowYT2 Date: Mon, 20 Jan 2025 22:04:41 +0300 Subject: [PATCH 6/7] This was removed by accident --- android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 8ccb3d8..d6c5d7b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -78,7 +78,7 @@ android { buildTypes { release { - + signingConfig signingConfigs.release } debug { applicationIdSuffix = ".debug" From f301f6cedbce7971fa43f7817940b8c9a539d3e6 Mon Sep 17 00:00:00 2001 From: Imran Remtulla Date: Thu, 13 Feb 2025 10:05:09 -0500 Subject: [PATCH 7/7] Fix RuStore PR bug + reorder items in README --- README.md | 4 ++-- lib/app_sources/rustore.dart | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5b44b0c..36bfccc 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,11 @@ 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/) - [Tencent App Store](https://sj.qq.com/) - - Jenkins Jobs - [RuStore](https://rustore.ru/) + - Jenkins Jobs + - [APKMirror](https://apkmirror.com/) (Track-Only) - Other - App-Specific: - [Telegram App](https://telegram.org/) - [Neutron Code](https://neutroncode.com/) diff --git a/lib/app_sources/rustore.dart b/lib/app_sources/rustore.dart index 13c35e0..853cfed 100644 --- a/lib/app_sources/rustore.dart +++ b/lib/app_sources/rustore.dart @@ -65,12 +65,17 @@ class RuStore extends AppSource { additionalSettings, followRedirects: false, postBody: {"appId": appDetails['appId'], "firstInstall": true}); - var downloadDetails = jsonDecode(res0.body)['body']; - if (res1.statusCode != 200 && downloadDetails['apkUrl'] == null) { + var downloadDetails = jsonDecode(res1.body)['body']; + if (res1.statusCode != 200 || downloadDetails['apkUrl'] == null) { throw NoAPKError(); } - return APKDetails(version, getApkUrlsFromUrls([downloadDetails['apkUrl']]), + return APKDetails( + version, + getApkUrlsFromUrls([ + (downloadDetails['apkUrl'] as String) + .replaceAll(RegExp('\\.zip\$'), '.apk') + ]), AppNames(author, appName), releaseDate: relDate); }