Allow any path when adding fdroidrepo(s):// intents.
When explicitly given an fdroidrepo(s) intent, it seems silly to restrict it based on a path of /fdroid/repo, because it is plainly obvious it is an F-Droid repo. Manifest and NewRepoConfig both had to be amended to allow this behaviour. Fixes #1171.
This commit is contained in:
		
							parent
							
								
									3a79a9b07f
								
							
						
					
					
						commit
						91a03be6f4
					
				| @ -424,6 +424,9 @@ | ||||
|             query parameters. An alternative would be to do something like fdroidswap:// as | ||||
|             a scheme, but then we need to copy/paste all of this intent-filter stuff and | ||||
|             keep it up to date when it changes or a bug is found. | ||||
| 
 | ||||
|             This filter supports HTTP and HTTPS schemes. There is an additional filter for | ||||
|             fdroidrepo:// and fdroidrepos:// | ||||
|             --> | ||||
|             <intent-filter> | ||||
|                 <action android:name="android.intent.action.VIEW" /> | ||||
| @ -441,10 +444,6 @@ | ||||
|                 <data android:scheme="HTTP" /> | ||||
|                 <data android:scheme="https" /> | ||||
|                 <data android:scheme="HTTPS" /> | ||||
|                 <data android:scheme="fdroidrepo" /> | ||||
|                 <data android:scheme="FDROIDREPO" /> | ||||
|                 <data android:scheme="fdroidrepos" /> | ||||
|                 <data android:scheme="FDROIDREPOS" /> | ||||
| 
 | ||||
|                 <data android:host="*" /> | ||||
| 
 | ||||
| @ -480,6 +479,28 @@ | ||||
|                 <data android:pathPattern="/.*/.*/.*/FDROID/REPO" /> | ||||
|             </intent-filter> | ||||
| 
 | ||||
|             <!-- | ||||
|             Same as the intent filter listening for repositories via https://*/fdroid/repo, except this | ||||
|             looks for fdroidrepos://* and doesn't care what the path is. | ||||
|             --> | ||||
|             <intent-filter> | ||||
|                 <action android:name="android.intent.action.VIEW" /> | ||||
| 
 | ||||
|                 <category android:name="android.intent.category.BROWSABLE" /> | ||||
|                 <category android:name="android.intent.category.DEFAULT" /> | ||||
| 
 | ||||
|                 <!-- | ||||
|                 Android's scheme matcher is case-sensitive, so include | ||||
|                 ALL CAPS versions to support ALL CAPS URLs in QR Codes. | ||||
|                 QR Codes have a special ALL CAPS mode that uses a reduced | ||||
|                 character set, making for more compact QR Codes. | ||||
|                 --> | ||||
|                 <data android:scheme="fdroidrepo" /> | ||||
|                 <data android:scheme="FDROIDREPO" /> | ||||
|                 <data android:scheme="fdroidrepos" /> | ||||
|                 <data android:scheme="FDROIDREPOS" /> | ||||
|             </intent-filter> | ||||
| 
 | ||||
| 
 | ||||
|             <!-- Handle NFC tags detected from outside our application --> | ||||
| 
 | ||||
|  | ||||
| @ -76,21 +76,27 @@ public class NewRepoConfig { | ||||
|             uri = Uri.parse(uri.toString().toLowerCase(Locale.ENGLISH)); | ||||
|         } | ||||
| 
 | ||||
|         // make scheme and host lowercase so they're readable in dialogs | ||||
|         scheme = scheme.toLowerCase(Locale.ENGLISH); | ||||
|         host = host.toLowerCase(Locale.ENGLISH); | ||||
| 
 | ||||
|         // We only listen for /fdroid/archive or /fdroid/repo paths when receiving a HTTP(S) intent. | ||||
|         // For fdroidrepo(s) intents, we are less picky and will accept any path. | ||||
|         boolean isHttpScheme = TextUtils.equals("http", scheme) || TextUtils.equals("https", scheme); | ||||
|         String path = uri.getPath(); | ||||
|         if (path == null || !(path.contains("/fdroid/archive") || path.contains("/fdroid/repo"))) { | ||||
|         if (path == null || isHttpScheme && !(path.contains("/fdroid/archive") || path.contains("/fdroid/repo"))) { | ||||
|             isValidRepo = false; | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         // make scheme and host lowercase so they're readable in dialogs | ||||
|         scheme = scheme.toLowerCase(Locale.ENGLISH); | ||||
|         host = host.toLowerCase(Locale.ENGLISH); | ||||
|         boolean isFdroidScheme = TextUtils.equals("fdroidrepo", scheme) || TextUtils.equals("fdroidrepos", scheme); | ||||
| 
 | ||||
|         fingerprint = uri.getQueryParameter("fingerprint"); | ||||
|         bssid = uri.getQueryParameter("bssid"); | ||||
|         ssid = uri.getQueryParameter("ssid"); | ||||
|         fromSwap = uri.getQueryParameter("swap") != null; | ||||
| 
 | ||||
|         if (!Arrays.asList("fdroidrepos", "fdroidrepo", "https", "http").contains(scheme)) { | ||||
|         if (!isFdroidScheme && !isHttpScheme) { | ||||
|             isValidRepo = false; | ||||
|             return; | ||||
|         } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Peter Serwylo
						Peter Serwylo