mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-30 21:13:28 +01:00 
			
		
		
		
	Started switching additionaldata to map
This commit is contained in:
		| @@ -25,7 +25,7 @@ class APKMirror extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     Response res = await get(Uri.parse('$standardUrl/feed')); | ||||
|     if (res.statusCode == 200) { | ||||
|   | ||||
| @@ -32,7 +32,7 @@ class FDroid extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   String? tryInferringAppId(String standardUrl, | ||||
|       {List<String> additionalData = const []}) { | ||||
|       {Map<String, String> additionalData = const {}}) { | ||||
|     return Uri.parse(standardUrl).pathSegments.last; | ||||
|   } | ||||
|  | ||||
| @@ -60,7 +60,7 @@ class FDroid extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     String? appId = tryInferringAppId(standardUrl); | ||||
|     return getAPKUrlsFromFDroidPackagesAPIResponse( | ||||
|   | ||||
| @@ -11,11 +11,10 @@ class FDroidRepo extends AppSource { | ||||
|  | ||||
|     additionalSourceAppSpecificFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormItem( | ||||
|         GeneratedFormItem('appIdOrName', | ||||
|             label: tr('appIdOrName'), | ||||
|             hint: tr('reposHaveMultipleApps'), | ||||
|             required: true, | ||||
|             key: 'appIdOrName') | ||||
|             required: true) | ||||
|       ] | ||||
|     ]; | ||||
|   } | ||||
| @@ -33,13 +32,9 @@ class FDroidRepo extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     String? appIdOrName = findGeneratedFormValueByKey( | ||||
|         additionalSourceAppSpecificFormItems | ||||
|             .reduce((value, element) => [...value, ...element]), | ||||
|         additionalData, | ||||
|         'appIdOrName'); | ||||
|     String? appIdOrName = additionalData['appIdOrName']; | ||||
|     if (appIdOrName == null) { | ||||
|       throw NoReleasesError(); | ||||
|     } | ||||
|   | ||||
| @@ -12,12 +12,9 @@ class GitHub extends AppSource { | ||||
|   GitHub() { | ||||
|     host = 'github.com'; | ||||
|  | ||||
|     additionalSourceAppSpecificDefaults = ['true', 'true', '']; | ||||
|  | ||||
|     additionalSourceSpecificSettingFormItems = [ | ||||
|       GeneratedFormItem( | ||||
|       GeneratedFormItem('github-creds', | ||||
|           label: tr('githubPATLabel'), | ||||
|           id: 'github-creds', | ||||
|           required: false, | ||||
|           additionalValidators: [ | ||||
|             (value) { | ||||
| @@ -52,17 +49,23 @@ class GitHub extends AppSource { | ||||
|           ]) | ||||
|     ]; | ||||
|  | ||||
|     additionalSourceAppSpecificDefaults = { | ||||
|       'includePrereleases': 'true', | ||||
|       'fallbackToOlderReleases': 'true', | ||||
|       'filterReleaseTitlesByRegEx': '' | ||||
|     }; | ||||
|  | ||||
|     additionalSourceAppSpecificFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormItem( | ||||
|         GeneratedFormItem('includePrereleases', | ||||
|             label: tr('includePrereleases'), type: FormItemType.bool) | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormItem( | ||||
|         GeneratedFormItem('fallbackToOlderReleases', | ||||
|             label: tr('fallbackToOlderReleases'), type: FormItemType.bool) | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormItem( | ||||
|         GeneratedFormItem('filterReleaseTitlesByRegEx', | ||||
|             label: tr('filterReleaseTitlesByRegEx'), | ||||
|             type: FormItemType.string, | ||||
|             required: false, | ||||
| @@ -99,7 +102,7 @@ class GitHub extends AppSource { | ||||
|     SettingsProvider settingsProvider = SettingsProvider(); | ||||
|     await settingsProvider.initializeSettings(); | ||||
|     String? creds = settingsProvider | ||||
|         .getSettingString(additionalSourceSpecificSettingFormItems[0].id); | ||||
|         .getSettingString(additionalSourceSpecificSettingFormItems[0].key); | ||||
|     return creds != null && creds.isNotEmpty ? '$creds@' : ''; | ||||
|   } | ||||
|  | ||||
| @@ -109,15 +112,15 @@ class GitHub extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     var includePrereleases = | ||||
|         additionalData.isNotEmpty && additionalData[0] == 'true'; | ||||
|     var includePrereleases = additionalData['includePrereleases'] == 'true'; | ||||
|     var fallbackToOlderReleases = | ||||
|         additionalData.length >= 2 && additionalData[1] == 'true'; | ||||
|     var regexFilter = additionalData.length >= 3 && additionalData[2].isNotEmpty | ||||
|         ? additionalData[2] | ||||
|         : null; | ||||
|         additionalData['fallbackToOlderReleases'] == 'true'; | ||||
|     var regexFilter = | ||||
|         additionalData['filterReleaseTitlesByRegEx']?.isNotEmpty == true | ||||
|             ? additionalData['filterReleaseTitlesByRegEx'] | ||||
|             : null; | ||||
|     Response res = await get(Uri.parse( | ||||
|         'https://${await getCredentialPrefixIfAny()}api.$host/repos${standardUrl.substring('https://$host'.length)}/releases')); | ||||
|     if (res.statusCode == 200) { | ||||
|   | ||||
| @@ -25,7 +25,7 @@ class GitLab extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     Response res = await get(Uri.parse('$standardUrl/-/tags?format=atom')); | ||||
|     if (res.statusCode == 200) { | ||||
|   | ||||
| @@ -23,13 +23,13 @@ class IzzyOnDroid extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   String? tryInferringAppId(String standardUrl, | ||||
|       {List<String> additionalData = const []}) { | ||||
|       {Map<String, String> additionalData = const {}}) { | ||||
|     return FDroid().tryInferringAppId(standardUrl); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     String? appId = tryInferringAppId(standardUrl); | ||||
|     return FDroid().getAPKUrlsFromFDroidPackagesAPIResponse( | ||||
|   | ||||
| @@ -24,7 +24,7 @@ class Mullvad extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     Response res = await get(Uri.parse('$standardUrl/en/download/android')); | ||||
|     if (res.statusCode == 200) { | ||||
|   | ||||
| @@ -18,7 +18,7 @@ class Signal extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     Response res = | ||||
|         await get(Uri.parse('https://updates.$host/android/latest.json')); | ||||
|   | ||||
| @@ -23,7 +23,7 @@ class SourceForge extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     Response res = await get(Uri.parse('$standardUrl/rss?path=/')); | ||||
|     if (res.statusCode == 200) { | ||||
|   | ||||
| @@ -11,11 +11,8 @@ class SteamMobile extends AppSource { | ||||
|     name = tr('steam'); | ||||
|     additionalSourceAppSpecificFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormItem( | ||||
|             label: tr('app'), | ||||
|             key: 'app', | ||||
|             required: true, | ||||
|             opts: apks.entries.toList()) | ||||
|         GeneratedFormItem('app', | ||||
|             label: tr('app'), required: true, opts: apks.entries.toList()) | ||||
|       ] | ||||
|     ]; | ||||
|   } | ||||
| @@ -32,15 +29,11 @@ class SteamMobile extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, List<String> additionalData, | ||||
|       String standardUrl, Map<String, String> additionalData, | ||||
|       {bool trackOnly = false}) async { | ||||
|     Response res = await get(Uri.parse('https://$host/mobile')); | ||||
|     if (res.statusCode == 200) { | ||||
|       var apkNamePrefix = findGeneratedFormValueByKey( | ||||
|           additionalSourceAppSpecificFormItems | ||||
|               .reduce((value, element) => [...value, ...element]), | ||||
|           additionalData, | ||||
|           'app'); | ||||
|       var apkNamePrefix = additionalData['app']; | ||||
|       if (apkNamePrefix == null) { | ||||
|         throw NoReleasesError(); | ||||
|       } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user