mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-21 18:03:45 +02:00
Re-enable auto-filtering for farsroid.com w/ toggle to disable it (#2441)
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:html/parser.dart';
|
import 'package:html/parser.dart';
|
||||||
import 'package:obtainium/app_sources/html.dart';
|
import 'package:obtainium/app_sources/html.dart';
|
||||||
|
import 'package:obtainium/components/generated_form.dart';
|
||||||
import 'package:obtainium/custom_errors.dart';
|
import 'package:obtainium/custom_errors.dart';
|
||||||
import 'package:obtainium/providers/source_provider.dart';
|
import 'package:obtainium/providers/source_provider.dart';
|
||||||
|
|
||||||
@@ -10,6 +12,16 @@ class Farsroid extends AppSource {
|
|||||||
hosts = ['farsroid.com'];
|
hosts = ['farsroid.com'];
|
||||||
name = 'Farsroid';
|
name = 'Farsroid';
|
||||||
naiveStandardVersionDetection = true;
|
naiveStandardVersionDetection = true;
|
||||||
|
|
||||||
|
additionalSourceAppSpecificSettingFormItems = [
|
||||||
|
[
|
||||||
|
GeneratedFormSwitch(
|
||||||
|
'useFirstApkOfVersion',
|
||||||
|
label: tr('useFirstApkOfVersion'),
|
||||||
|
defaultValue: true,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -64,6 +76,16 @@ class Farsroid extends AppSource {
|
|||||||
additionalSettings,
|
additionalSettings,
|
||||||
)).map((l) => MapEntry(Uri.parse(l.key).pathSegments.last, l.key)).toList();
|
)).map((l) => MapEntry(Uri.parse(l.key).pathSegments.last, l.key)).toList();
|
||||||
|
|
||||||
|
if (additionalSettings['useFirstApkOfVersion'] == true) {
|
||||||
|
apkLinks = apkLinks
|
||||||
|
.where(
|
||||||
|
(l) => l.key.toLowerCase().startsWith(
|
||||||
|
'$appName-$version'.toLowerCase(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
if (apkLinks.isEmpty) {
|
if (apkLinks.isEmpty) {
|
||||||
throw NoAPKError();
|
throw NoAPKError();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user