diff --git a/assets/translations/de.json b/assets/translations/de.json index 03861357..7e0b4a6e 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "Warnung für 'Nur Nachverfolgen' nicht anzeigen", "dontShowAPKOriginWarnings": "Warnung für APK-Herkunft nicht anzeigen", "moveNonInstalledAppsToBottom": "Nicht installierte Apps ans Ende der Apps Ansicht verschieben", - "gitlabPATLabel": "GitLab Personal Access Token (Aktiviert Suche)", + "gitlabPATLabel": "GitLab Personal Access Token\n(Aktiviert Suche and Better APK Discovery)", "about": "Über", "requiresCredentialsInSettings": "Benötigt zusätzliche Anmeldedaten (in den Einstellungen)", "checkOnStart": "Überprüfe einmalig beim Start", diff --git a/assets/translations/en.json b/assets/translations/en.json index 15e46dc9..cb9bf5d3 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "Don't show 'Track-Only' warnings", "dontShowAPKOriginWarnings": "Don't show APK origin warnings", "moveNonInstalledAppsToBottom": "Move non-installed Apps to bottom of Apps view", - "gitlabPATLabel": "GitLab Personal Access Token (Enables Search)", + "gitlabPATLabel": "GitLab Personal Access Token\n(Enables Search and Better APK Discovery)", "about": "About", "requiresCredentialsInSettings": "This needs additional credentials (in Settings)", "checkOnStart": "Check for updates on startup", diff --git a/assets/translations/es.json b/assets/translations/es.json index 1e557ab9..8e31c7c2 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "No mostrar avisos de 'Solo Seguimiento'", "dontShowAPKOriginWarnings": "No mostrar avisos de las fuentes de las APks", "moveNonInstalledAppsToBottom": "Move non-installed Apps to bottom of Apps view", - "gitlabPATLabel": "GitLab Personal Access Token (Enables Search)", + "gitlabPATLabel": "GitLab Personal Access Token\n(Enables Search and Better APK Discovery)", "about": "About", "requiresCredentialsInSettings": "This needs additional credentials (in Settings)", "checkOnStart": "Check for updates on startup", diff --git a/assets/translations/fa.json b/assets/translations/fa.json index 476b80a6..393d0c7d 100644 --- a/assets/translations/fa.json +++ b/assets/translations/fa.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "هشدار 'فقط ردیابی' را نشان ندهید", "dontShowAPKOriginWarnings": "هشدارهای منبع APK را نشان ندهید", "moveNonInstalledAppsToBottom": "برنامه های نصب نشده را به نمای پایین برنامه ها منتقل کنید", - "gitlabPATLabel": "رمز دسترسی شخصی GitLab (جستجو را فعال می کند)", + "gitlabPATLabel": "رمز دسترسی شخصی GitLab\n(جستجو را فعال می کند and Better APK Discovery)", "about": "درباره", "requiresCredentialsInSettings": "این به اعتبارنامه های اضافی نیاز دارد (در تنظیمات)", "checkOnStart": "بررسی در شروع", diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 42a3c2de..b403c1f7 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "Don't Show the 'Track-Only' Warning", "dontShowAPKOriginWarnings": "Don't show APK origin warnings", "moveNonInstalledAppsToBottom": "Move non-installed Apps to bottom of Apps view", - "gitlabPATLabel": "GitLab Personal Access Token (Enables Search)", + "gitlabPATLabel": "GitLab Personal Access Token\n(Enables Search and Better APK Discovery)", "about": "About", "requiresCredentialsInSettings": "This needs additional credentials (in Settings)", "checkOnStart": "Check for updates on startup", diff --git a/assets/translations/hu.json b/assets/translations/hu.json index 787b05a4..69b8ab6d 100644 --- a/assets/translations/hu.json +++ b/assets/translations/hu.json @@ -228,7 +228,7 @@ "dontShowTrackOnlyWarnings": "Ne jelenítsen meg 'Csak nyomon követés' figyelmeztetést", "dontShowAPKOriginWarnings": "Ne jelenítsen meg az APK eredetére vonatkozó figyelmeztetéseket", "moveNonInstalledAppsToBottom": "Helyezze át a nem telepített appokat az App nézet aljára", - "gitlabPATLabel": "GitLab Personal Access Token (Engedélyezi a Keresést)", + "gitlabPATLabel": "GitLab Personal Access Token\n(Engedélyezi a Keresést and Better APK Discovery)", "about": "Rólunk", "requiresCredentialsInSettings": "Ehhez további hitelesítő adatokra van szükség (a Beállításokban)", "checkOnStart": "Egyszer az indításkor", diff --git a/assets/translations/it.json b/assets/translations/it.json index 1bed9962..8010b378 100644 --- a/assets/translations/it.json +++ b/assets/translations/it.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "Non mostrare gli avvisi 'Solo-Monitoraggio'", "dontShowAPKOriginWarnings": "Non mostrare gli avvisi di origine dell'APK", "moveNonInstalledAppsToBottom": "Sposta le app non installate in fondo alla lista", - "gitlabPATLabel": "GitLab Personal Access Token (attiva la ricerca)", + "gitlabPATLabel": "GitLab Personal Access Token\n(attiva la ricerca and Better APK Discovery)", "about": "Informazioni", "requiresCredentialsInSettings": "Servono credenziali aggiuntive (in Impostazioni)", "checkOnStart": "Controlla una volta all'avvio", diff --git a/assets/translations/ja.json b/assets/translations/ja.json index 0892ecc9..e53c79c0 100644 --- a/assets/translations/ja.json +++ b/assets/translations/ja.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "「追跡のみ」の警告を表示しない", "dontShowAPKOriginWarnings": "APK Originの警告を表示しない", "moveNonInstalledAppsToBottom": "未インストールのアプリをアプリ一覧の下部に移動させる", - "gitlabPATLabel": "GitLab パーソナルアクセストークン (検索を有効化する)", + "gitlabPATLabel": "GitLab パーソナルアクセストークン\n(検索を有効化する and Better APK Discovery)", "about": "概要", "requiresCredentialsInSettings": "これには追加の認証が必要です (設定にて)", "checkOnStart": "Check for updates on startup", diff --git a/assets/translations/pl.json b/assets/translations/pl.json index 241af7e3..59ae37a0 100644 --- a/assets/translations/pl.json +++ b/assets/translations/pl.json @@ -233,7 +233,7 @@ "dontShowTrackOnlyWarnings": "Nie wyświetlaj ostrzeżeń „Tylko obserwowana”", "dontShowAPKOriginWarnings": "Nie pokazuj ostrzeżeń o pochodzeniu APK", "moveNonInstalledAppsToBottom": "Przenieś niezainstalowane aplikacje na dół widoku aplikacji", - "gitlabPATLabel": "Osobisty Token Dostępu GitLab (umożliwia wyszukiwanie)", + "gitlabPATLabel": "Osobisty Token Dostępu GitLab\n(umożliwia wyszukiwanie and Better APK Discovery)", "about": "Więcej informacji", "requiresCredentialsInSettings": "Wymaga to dodatkowych poświadczeń (w Ustawieniach)", "checkOnStart": "Sprawdź raz przy starcie", diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 2c344994..320906be 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "Не показывать предупреждения о только отслеживаемых приложениях", "dontShowAPKOriginWarnings": "Не показывать предупреждения об источнике APK-файлов", "moveNonInstalledAppsToBottom": "Переместить неустановленные приложения вниз списка", - "gitlabPATLabel": "Персональный токен доступа GitLab (Включает поиск)", + "gitlabPATLabel": "Персональный токен доступа GitLab\n(Включает поиск and Better APK Discovery)", "about": "О приложении", "requiresCredentialsInSettings": "Для этого требуются дополнительные учетные данные (в настройках)", "checkOnStart": "Проверять наличие обновлений при запуске", diff --git a/assets/translations/zh.json b/assets/translations/zh.json index 49da8bc2..f72eb317 100644 --- a/assets/translations/zh.json +++ b/assets/translations/zh.json @@ -229,7 +229,7 @@ "dontShowTrackOnlyWarnings": "不显示“仅追踪”模式警告", "dontShowAPKOriginWarnings": "不显示 APK 文件来源警告", "moveNonInstalledAppsToBottom": "将未安装应用置底", - "gitlabPATLabel": "GitLab 个人访问令牌(用于搜索应用)", + "gitlabPATLabel": "GitLab 个人访问令牌\n(用于搜索应用 and Better APK Discovery)", "about": "相关文档", "requiresCredentialsInSettings": "此功能需要额外的凭据(在“设置”中添加)", "checkOnStart": "启动时进行一次检查", diff --git a/lib/app_sources/gitlab.dart b/lib/app_sources/gitlab.dart index c6d8a632..574e8143 100644 --- a/lib/app_sources/gitlab.dart +++ b/lib/app_sources/gitlab.dart @@ -102,11 +102,53 @@ class GitLab extends AppSource { ) async { bool fallbackToOlderReleases = additionalSettings['fallbackToOlderReleases'] == true; - Response res = await sourceRequest('$standardUrl/-/tags?format=atom'); - if (res.statusCode == 200) { + String? PAT = await getPATIfAny(); + Iterable apkDetailsList = []; + if (PAT != null) { + var names = GitHub().getAppNames(standardUrl); + Response res = await sourceRequest( + 'https://$host/api/v4/projects/${names.author}%2F${names.name}/releases?private_token=$PAT'); + if (res.statusCode != 200) { + throw getObtainiumHttpError(res); + } + var json = jsonDecode(res.body) as List; + apkDetailsList = json.map((e) { + var apkUrlsFromAssets = (e['assets']?['links'] as List? ?? []) + .map((e) { + return (e['direct_asset_url'] ?? e['url'] ?? '') as String; + }) + .where((s) => s.isNotEmpty) + .toList(); + List uploadedAPKsFromDescription = + ((e['description'] ?? '') as String) + .split('](') + .join('\n') + .split('.apk)') + .join('.apk\n') + .split('\n') + .where((s) => s.startsWith('/uploads/') && s.endsWith('apk')) + .map((s) => '$standardUrl$s') + .toList(); + var apkUrlsSet = apkUrlsFromAssets.toSet(); + apkUrlsSet.addAll(uploadedAPKsFromDescription); + var releaseDateString = e['released_at'] ?? e['created_at']; + DateTime? releaseDate = releaseDateString != null + ? DateTime.parse(releaseDateString) + : null; + return APKDetails( + e['tag_name'] ?? e['name'], + getApkUrlsFromUrls(apkUrlsSet.toList()), + GitHub().getAppNames(standardUrl), + releaseDate: releaseDate); + }); + } else { + Response res = await sourceRequest('$standardUrl/-/tags?format=atom'); + if (res.statusCode != 200) { + throw getObtainiumHttpError(res); + } var standardUri = Uri.parse(standardUrl); var parsedHtml = parse(res.body); - var apkDetailsList = parsedHtml.querySelectorAll('entry').map((entry) { + apkDetailsList = parsedHtml.querySelectorAll('entry').map((entry) { var entryContent = parse( parseFragment(entry.querySelector('content')!.innerHtml).text); var apkUrls = [ @@ -124,7 +166,6 @@ class GitLab extends AppSource { .where((element) => Uri.parse(element).host != '') .toList() ]; - var entryId = entry.querySelector('id')?.innerHtml; var version = entryId == null ? null : Uri.parse(entryId).pathSegments.last; @@ -139,21 +180,19 @@ class GitLab extends AppSource { GitHub().getAppNames(standardUrl), releaseDate: releaseDate); }); + } + if (apkDetailsList.isEmpty) { + throw NoReleasesError(); + } + if (fallbackToOlderReleases) { + if (additionalSettings['trackOnly'] != true) { + apkDetailsList = + apkDetailsList.where((e) => e.apkUrls.isNotEmpty).toList(); + } if (apkDetailsList.isEmpty) { throw NoReleasesError(); } - if (fallbackToOlderReleases) { - if (additionalSettings['trackOnly'] != true) { - apkDetailsList = - apkDetailsList.where((e) => e.apkUrls.isNotEmpty).toList(); - } - if (apkDetailsList.isEmpty) { - throw NoReleasesError(); - } - } - return apkDetailsList.first; - } else { - throw getObtainiumHttpError(res); } + return apkDetailsList.first; } } diff --git a/lib/main.dart b/lib/main.dart index db60abe3..51e56f0c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,7 +21,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart'; // ignore: implementation_imports import 'package:easy_localization/src/localization.dart'; -const String currentVersion = '0.13.15'; +const String currentVersion = '0.13.16'; const String currentReleaseTag = 'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES diff --git a/pubspec.yaml b/pubspec.yaml index 37e05337..06fd3fbf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: 0.13.15+179 # When changing this, update the tag in main() accordingly +version: 0.13.16+180 # When changing this, update the tag in main() accordingly environment: sdk: '>=2.18.2 <3.0.0'