diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 35f7597..cfeac66 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -62,6 +62,7 @@ + diff --git a/assets/translations/bs.json b/assets/translations/bs.json index 54fa76b..2c3c5d3 100644 --- a/assets/translations/bs.json +++ b/assets/translations/bs.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "Želite li ukloniti aplikaciju?", "other": "Želite li ukloniti aplikacije?" diff --git a/assets/translations/de.json b/assets/translations/de.json index 9e62db4..16ae9d0 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "GitLab APK-Extraktion funktioniert möglicherweise nicht ohne API-Schlüssel", "sortByFileNamesNotLinks": "Sortiere nach Dateinamen, anstelle von ganzen Links", "filterReleaseNotesByRegEx": "Versionshinweise nach regulärem Ausdruck filtern", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "App entfernen?", "other": "Apps entfernen?" diff --git a/assets/translations/en.json b/assets/translations/en.json index 2daf50e..397c7a2 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "Remove App?", "other": "Remove Apps?" diff --git a/assets/translations/es.json b/assets/translations/es.json index 76bddc6..b5d3d25 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "¿Eliminar Aplicación?", "other": "¿Eliminar Aplicaciones?" diff --git a/assets/translations/fa.json b/assets/translations/fa.json index 342d98d..beaf442 100644 --- a/assets/translations/fa.json +++ b/assets/translations/fa.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "برنامه حذف شود؟", "other": "برنامه ها حذف شوند؟" diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 32d1e35..ec680f8 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "Supprimer l'application ?", "other": "Supprimer les applications ?" diff --git a/assets/translations/hu.json b/assets/translations/hu.json index ab5be1f..da0b17a 100644 --- a/assets/translations/hu.json +++ b/assets/translations/hu.json @@ -93,13 +93,13 @@ "author": "Szerző", "upToDateApps": "Naprakész appok", "nonInstalledApps": "Nem telepített appok", - "importExport": "Import/Export", + "importExport": "Importálás/Exportálás", "settings": "Beállítások", "exportedTo": "Exportálva ide {}", - "obtainiumExport": "Obtainium Export", + "obtainiumExport": "Obtainium Adat Exportálás", "invalidInput": "Hibás bemenet", "importedX": "Importálva innen {}", - "obtainiumImport": "Obtainium Import", + "obtainiumImport": "Obtainium Adat Importálás", "importFromURLList": "Importálás URL listából", "searchQuery": "Keresési lekérdezés", "appURLList": "App URL lista", @@ -139,11 +139,11 @@ "appSource": "App forrás", "noLogs": "Nincsenek naplók", "appLogs": "App naplók", - "close": "Bezár", - "share": "Megoszt", + "close": "Bezárás", + "share": "Megosztás", "appNotFound": "App nem található", "obtainiumExportHyphenatedLowercase": "obtainium-export", - "pickAnAPK": "Válasszon egy APK-t", + "pickAnAPK": "Válasszon egy APK-ot", "appHasMoreThanOnePackage": "A(z) {} egynél több csomaggal rendelkezik:", "deviceSupportsXArch": "Eszköze támogatja a {} CPU architektúrát.", "deviceSupportsFollowingArchs": "Az eszköze a következő CPU architektúrákat támogatja:", @@ -210,7 +210,7 @@ "copiedToClipboard": "Másolva a vágólapra", "storagePermissionDenied": "Tárhely engedély megtagadva", "selectedCategorizeWarning": "Ez felváltja a kiválasztott alkalmazások meglévő kategória-beállításait.", - "filterAPKsByRegEx": "Az APK-k szűrése reguláris kifejezéssel", + "filterAPKsByRegEx": "Az APK-ok szűrése reguláris kifejezéssel", "removeFromObtainium": "Eltávolítás az Obtainiumból", "uninstallFromDevice": "Eltávolítás a készülékről", "onlyWorksWithNonVersionDetectApps": "Csak azoknál az alkalmazásoknál működik, amelyeknél a verzióérzékelés le van tiltva.", @@ -222,7 +222,7 @@ "versionDetection": "Verzió érzékelés", "standardVersionDetection": "Alapért. verzió érzékelés", "groupByCategory": "Csoportosítás Kategória alapján", - "autoApkFilterByArch": "Ha lehetséges, próbálja CPU architektúra szerint szűrni az APK-kat", + "autoApkFilterByArch": "Ha lehetséges, próbálja CPU architektúra szerint szűrni az APK-okat", "overrideSource": "Forrás felülbírálása", "dontShowAgain": "Ne mutassa ezt újra", "dontShowTrackOnlyWarnings": "Ne jelenítsen meg 'Csak nyomon követés' figyelmeztetést", @@ -231,20 +231,21 @@ "gitlabPATLabel": "GitLab Personal Access Token\n(Engedélyezi a Keresést és jobb APK felfedezés)", "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", + "checkOnStart": "Egyszer az alkalmazás indításakor is", "tryInferAppIdFromCode": "Próbálja kikövetkeztetni az app azonosítót a forráskódból", "removeOnExternalUninstall": "A külsőleg eltávolított appok auto. eltávolítása", "pickHighestVersionCode": "A legmagasabb verziószámú APK auto. kiválasztása", "checkUpdateOnDetailPage": "Frissítések keresése az app részleteit tartalmazó oldal megnyitásakor", - "disablePageTransitions": "Lap áttűnési animációk tiltása", + "disablePageTransitions": "Lap áttűnési animációk letiltása", "reversePageTransitions": "Fordított lap áttűnési animációk", "minStarCount": "Minimális csillag szám", "addInfoBelow": "Adja hozzá ezt az infót alább.", "addInfoInSettings": "Adja hozzá ezt az infót a Beállításokban.", - "githubSourceNote": "A GitHub értékelési korlátozása elkerülhető API-kulcs használatával.", + "githubSourceNote": "A GitHub sebességkorlátozás elkerülhető API-kulcs használatával.", "gitlabSourceNote": "Előfordulhat, hogy a GitLab APK kibontása nem működik API-kulcs nélkül.", - "sortByFileNamesNotLinks": "Sort by file names instead of full links", - "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "sortByFileNamesNotLinks": "Fájlnevek szerinti elrendezés teljes linkek helyett", + "filterReleaseNotesByRegEx": "Kiadási megjegyzések szűrése reguláris kifejezéssel", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "Eltávolítja az alkalmazást?", "other": "Eltávolítja az alkalmazást?" @@ -287,10 +288,10 @@ }, "xAndNMoreUpdatesAvailable": { "one": "A(z) {} és 1 további alkalmazás frissítéseket kapott.", - "other": "{} és további {} alkalmazás frissítéseket kapott." + "other": "{} és {} további alkalmazás frissítéseket kapott." }, "xAndNMoreUpdatesInstalled": { "one": "A(z) {} és 1 további alkalmazás frissítve.", - "other": "{} és további {} alkalmazás frissítve." + "other": "{} és {} további alkalmazás frissítve." } } diff --git a/assets/translations/it.json b/assets/translations/it.json index be3e441..4dd0383 100644 --- a/assets/translations/it.json +++ b/assets/translations/it.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "Rimuovere l'app?", "other": "Rimuovere le app?" diff --git a/assets/translations/ja.json b/assets/translations/ja.json index a89fc20..6c1f7eb 100644 --- a/assets/translations/ja.json +++ b/assets/translations/ja.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "GitLabのAPK抽出はAPIキーがないと動作しない場合があります。", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "アプリを削除しますか?", "other": "アプリを削除しますか?" diff --git a/assets/translations/pl.json b/assets/translations/pl.json index be2f699..d227ee2 100644 --- a/assets/translations/pl.json +++ b/assets/translations/pl.json @@ -250,6 +250,7 @@ "gitlabSourceNote": "Pozyskiwanie pliku APK z GitLab może nie działać bez klucza API.", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "Usunąć aplikację?", "other": "Usunąć aplikacje?" diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 94a6ebf..1f27453 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "Извлечение APK из GitLab может не работать без ключа API.", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "Удалить приложение?", "other": "Удалить приложения?" diff --git a/assets/translations/zh.json b/assets/translations/zh.json index e59296d..d5bc0eb 100644 --- a/assets/translations/zh.json +++ b/assets/translations/zh.json @@ -246,6 +246,7 @@ "gitlabSourceNote": "未使用访问令牌时可能无法从 GitLab 获取 APK 文件。", "sortByFileNamesNotLinks": "Sort by file names instead of full links", "filterReleaseNotesByRegEx": "Filter Release Notes by Regular Expression", + "customLinkFilterRegex": "Custom Link Filter by Regular Expression (Default '.apk$')", "removeAppQuestion": { "one": "是否删除应用?", "other": "是否删除应用?" diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index a60386e..8df2add 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -91,7 +91,18 @@ class HTML extends AppSource { [ GeneratedFormSwitch('sortByFileNamesNotLinks', label: tr('sortByFileNamesNotLinks')) - ] + ], + [ + GeneratedFormTextField('customLinkFilterRegex', + label: tr('customLinkFilterRegex'), + hint: 'download/(.*/)?(android|apk|mobile)', + required: false, + additionalValidators: [ + (value) { + return regExValidator(value); + } + ]) + ], ]; } @@ -99,7 +110,7 @@ class HTML extends AppSource { // TODO: implement requestHeaders choice, hardcoded for now Map? get requestHeaders => { "User-Agent": - "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" + "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36" }; @override @@ -115,16 +126,29 @@ class HTML extends AppSource { var uri = Uri.parse(standardUrl); Response res = await sourceRequest(standardUrl); if (res.statusCode == 200) { - List links = parse(res.body) + var html = parse(res.body); + List allLinks = html .querySelectorAll('a') .map((element) => element.attributes['href'] ?? '') - .where((element) => - Uri.parse(element).path.toLowerCase().endsWith('.apk')) .toList(); + List links = []; + if ((additionalSettings['customLinkFilterRegex'] as String?) + ?.isNotEmpty == + true) { + var reg = RegExp(additionalSettings['customLinkFilterRegex']); + links = allLinks.where((element) => reg.hasMatch(element)).toList(); + } else { + links = allLinks + .where((element) => + Uri.parse(element).path.toLowerCase().endsWith('.apk')) + .toList(); + } links.sort((a, b) => additionalSettings['sortByFileNamesNotLinks'] == true - ? compareAlphaNumeric(a.split('/').last, b.split('/').last) + ? compareAlphaNumeric(a.split('/').where((e) => e.isNotEmpty).last, + b.split('/').where((e) => e.isNotEmpty).last) : compareAlphaNumeric(a, b)); - if (additionalSettings['apkFilterRegEx'] != null) { + if ((additionalSettings['apkFilterRegEx'] as String?)?.isNotEmpty == + true) { var reg = RegExp(additionalSettings['apkFilterRegEx']); links = links.where((element) => reg.hasMatch(element)).toList(); } diff --git a/pubspec.lock b/pubspec.lock index f1e82a6..41f8b1e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -22,7 +22,7 @@ packages: description: path: "." ref: main - resolved-ref: f09c79eee5be3c60b04760143eb954a13fdd07f1 + resolved-ref: "2edf5dbbfeeb33257d526861f2a992aee5d97bb4" url: "https://github.com/ImranR98/android_package_installer" source: git version: "0.0.1" @@ -206,10 +206,10 @@ packages: dependency: transitive description: name: ffi - sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.1.0" file: dependency: transitive description: @@ -296,10 +296,10 @@ packages: dependency: "direct main" description: name: flutter_markdown - sha256: "4b1bfbb802d76320a1a46d9ce984106135093efd9d969765d07c2125af107bdf" + sha256: "2b206d397dd7836ea60035b2d43825c8a303a76a5098e66f42d55a753e18d431" url: "https://pub.dev" source: hosted - version: "0.6.17" + version: "0.6.17+1" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -482,10 +482,10 @@ packages: dependency: "direct main" description: name: path_provider - sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2" + sha256: "909b84830485dbcd0308edf6f7368bc8fd76afa26a270420f34cabea2a6467a0" url: "https://pub.dev" source: hosted - version: "2.0.15" + version: "2.1.0" path_provider_android: dependency: transitive description: @@ -642,10 +642,10 @@ packages: dependency: transitive description: name: shared_preferences_foundation - sha256: f39696b83e844923b642ce9dd4bd31736c17e697f6731a5adf445b1274cf3cd4 + sha256: d29753996d8eb8f7619a1f13df6ce65e34bc107bef6330739ed76f18b22310ef url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3" shared_preferences_linux: dependency: transitive description: @@ -783,10 +783,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "78cb6dea3e93148615109e58e42c35d1ffbf5ef66c44add673d0ab75f12ff3af" + sha256: "3dd2388cc0c42912eee04434531a26a82512b9cb1827e0214430c9bcbddfe025" url: "https://pub.dev" source: hosted - version: "6.0.37" + version: "6.0.38" url_launcher_ios: dependency: transitive description: @@ -863,10 +863,10 @@ packages: dependency: transitive description: name: webview_flutter_android - sha256: d936a09fbfd08cb78f7329e0bbacf6158fbdfe24ffc908b22444c07d295eb193 + sha256: bca797abba472868655b5f1a6029c1132385685ee9db4713cb0e7f33076210c6 url: "https://pub.dev" source: hosted - version: "3.9.2" + version: "3.9.3" webview_flutter_platform_interface: dependency: transitive description: @@ -879,10 +879,10 @@ packages: dependency: transitive description: name: webview_flutter_wkwebview - sha256: "5fa098f28b606f699e8ca52d9e4e11edbbfef65189f5f77ae92703ba5408fd25" + sha256: ed749f94ac9e814d04a258a9255cf69cfa4cc6006ff59542aea7fb4590144972 url: "https://pub.dev" source: hosted - version: "3.7.2" + version: "3.7.3" win32: dependency: transitive description: @@ -903,10 +903,10 @@ packages: dependency: transitive description: name: xdg_directories - sha256: e0b1147eec179d3911f1f19b59206448f78195ca1d20514134e10641b7d7fbff + sha256: f0c26453a2d47aa4c2570c6a033246a3fc62da2fe23c7ffdd0a7495086dc0247 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.0.2" xml: dependency: transitive description: