From 4b66aefb33e70b95554880a2375f25b447c2c92b Mon Sep 17 00:00:00 2001 From: PadowYT2 Date: Mon, 20 Jan 2025 21:04:51 +0300 Subject: [PATCH] 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(),