diff --git a/assets/translations/bs.json b/assets/translations/bs.json index dd9c8be..433984e 100644 --- a/assets/translations/bs.json +++ b/assets/translations/bs.json @@ -244,6 +244,7 @@ "addInfoInSettings": "Add this info in the Settings.", "githubSourceNote": "GitHub rate limiting can be avoided using an API key.", "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "Želite li ukloniti aplikaciju?", "other": "Želite li ukloniti aplikacije?" diff --git a/assets/translations/de.json b/assets/translations/de.json index 95028a6..d7ea035 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -244,6 +244,7 @@ "addInfoInSettings": "Fügen Sie diese Info in den Einstellungen hinzu.", "githubSourceNote": "Die GitHub-Ratenbegrenzung kann mit einem API-Schlüssel umgangen werden.", "gitlabSourceNote": "GitLab APK-Extraktion funktioniert möglicherweise nicht ohne API-Schlüssel", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "App entfernen?", "other": "Apps entfernen?" diff --git a/assets/translations/en.json b/assets/translations/en.json index e86bf32..551cdb6 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -244,6 +244,7 @@ "addInfoInSettings": "Add this info in the Settings.", "githubSourceNote": "GitHub rate limiting can be avoided using an API key.", "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "Remove App?", "other": "Remove Apps?" diff --git a/assets/translations/es.json b/assets/translations/es.json index 2708bce..b7aae29 100644 --- a/assets/translations/es.json +++ b/assets/translations/es.json @@ -244,6 +244,7 @@ "addInfoInSettings": "Add this info in the Settings.", "githubSourceNote": "GitHub rate limiting can be avoided using an API key.", "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "¿Eliminar Aplicación?", "other": "¿Eliminar Aplicaciones?" diff --git a/assets/translations/fa.json b/assets/translations/fa.json index 781b45b..a7dace4 100644 --- a/assets/translations/fa.json +++ b/assets/translations/fa.json @@ -244,6 +244,7 @@ "addInfoInSettings": "Add this info in the Settings.", "githubSourceNote": "GitHub rate limiting can be avoided using an API key.", "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "برنامه حذف شود؟", "other": "برنامه ها حذف شوند؟" diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 728f500..0a8cfbf 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -244,6 +244,7 @@ "addInfoInSettings": "Add this info in the Settings.", "githubSourceNote": "GitHub rate limiting can be avoided using an API key.", "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "Supprimer l'application ?", "other": "Supprimer les applications ?" diff --git a/assets/translations/hu.json b/assets/translations/hu.json index 6beafe7..6498b44 100644 --- a/assets/translations/hu.json +++ b/assets/translations/hu.json @@ -243,6 +243,7 @@ "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.", "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", "removeAppQuestion": { "one": "Eltávolítja az alkalmazást?", "other": "Eltávolítja az alkalmazást?" diff --git a/assets/translations/it.json b/assets/translations/it.json index e905551..49eec85 100644 --- a/assets/translations/it.json +++ b/assets/translations/it.json @@ -244,6 +244,7 @@ "addInfoInSettings": "Add this info in the Settings.", "githubSourceNote": "GitHub rate limiting can be avoided using an API key.", "gitlabSourceNote": "GitLab APK extraction may not work without an API key.", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "Rimuovere l'app?", "other": "Rimuovere le app?" diff --git a/assets/translations/ja.json b/assets/translations/ja.json index aaf4530..528469a 100644 --- a/assets/translations/ja.json +++ b/assets/translations/ja.json @@ -244,6 +244,7 @@ "addInfoInSettings": "設定でこの情報を追加してください。", "githubSourceNote": "GitHubのレート制限はAPIキーを使うことで回避できます。", "gitlabSourceNote": "GitLabのAPK抽出はAPIキーがないと動作しない場合があります。", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "アプリを削除しますか?", "other": "アプリを削除しますか?" diff --git a/assets/translations/pl.json b/assets/translations/pl.json index e957c9b..3b73db6 100644 --- a/assets/translations/pl.json +++ b/assets/translations/pl.json @@ -248,6 +248,7 @@ "addInfoInSettings": "Dodaj tę informację w Ustawieniach.", "githubSourceNote": "Limit żądań GitHub można ominąć za pomocą klucza API.", "gitlabSourceNote": "Pozyskiwanie pliku APK z GitLab może nie działać bez klucza API.", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "Usunąć aplikację?", "other": "Usunąć aplikacje?" diff --git a/assets/translations/ru.json b/assets/translations/ru.json index 14b5f06..6330f01 100644 --- a/assets/translations/ru.json +++ b/assets/translations/ru.json @@ -244,6 +244,7 @@ "addInfoInSettings": "Добавьте эту информацию в Настройки.", "githubSourceNote": "Лимит запросов GitHub можно обойти, используя ключ API.", "gitlabSourceNote": "Извлечение APK из GitLab может не работать без ключа API.", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "Удалить приложение?", "other": "Удалить приложения?" diff --git a/assets/translations/zh.json b/assets/translations/zh.json index 6a3058e..be03d5b 100644 --- a/assets/translations/zh.json +++ b/assets/translations/zh.json @@ -244,6 +244,7 @@ "addInfoInSettings": "在“设置”中添加此凭据。", "githubSourceNote": "使用访问令牌可避免触发 GitHub 的 API 请求限制。", "gitlabSourceNote": "未使用访问令牌时可能无法从 GitLab 获取 APK 文件。", + "sortByFileNamesNotLinks": "Sort by file names instead of full links", "removeAppQuestion": { "one": "是否删除应用?", "other": "是否删除应用?" diff --git a/lib/app_sources/html.dart b/lib/app_sources/html.dart index 47d6acd..a60386e 100644 --- a/lib/app_sources/html.dart +++ b/lib/app_sources/html.dart @@ -1,6 +1,7 @@ import 'package:easy_localization/easy_localization.dart'; import 'package:html/parser.dart'; import 'package:http/http.dart'; +import 'package:obtainium/components/generated_form.dart'; import 'package:obtainium/custom_errors.dart'; import 'package:obtainium/providers/source_provider.dart'; @@ -85,6 +86,15 @@ bool _isNumeric(String s) { } class HTML extends AppSource { + HTML() { + additionalSourceAppSpecificSettingFormItems = [ + [ + GeneratedFormSwitch('sortByFileNamesNotLinks', + label: tr('sortByFileNamesNotLinks')) + ] + ]; + } + @override // TODO: implement requestHeaders choice, hardcoded for now Map? get requestHeaders => { @@ -111,7 +121,9 @@ class HTML extends AppSource { .where((element) => Uri.parse(element).path.toLowerCase().endsWith('.apk')) .toList(); - links.sort((a, b) => compareAlphaNumeric(a, b)); + links.sort((a, b) => additionalSettings['sortByFileNamesNotLinks'] == true + ? compareAlphaNumeric(a.split('/').last, b.split('/').last) + : compareAlphaNumeric(a, b)); if (additionalSettings['apkFilterRegEx'] != null) { var reg = RegExp(additionalSettings['apkFilterRegEx']); links = links.where((element) => reg.hasMatch(element)).toList();