Merge branch 'issues-1171--fdroidrepos-regardless-of-path' into 'master'
Allow any path when adding fdroidrepo(s):// intents. Closes #1171 See merge request fdroid/fdroidclient!582
This commit is contained in:
commit
5d17676a01
@ -424,6 +424,9 @@
|
|||||||
query parameters. An alternative would be to do something like fdroidswap:// as
|
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
|
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.
|
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>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
@ -441,10 +444,6 @@
|
|||||||
<data android:scheme="HTTP" />
|
<data android:scheme="HTTP" />
|
||||||
<data android:scheme="https" />
|
<data android:scheme="https" />
|
||||||
<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="*" />
|
<data android:host="*" />
|
||||||
|
|
||||||
@ -480,6 +479,28 @@
|
|||||||
<data android:pathPattern="/.*/.*/.*/FDROID/REPO" />
|
<data android:pathPattern="/.*/.*/.*/FDROID/REPO" />
|
||||||
</intent-filter>
|
</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 -->
|
<!-- Handle NFC tags detected from outside our application -->
|
||||||
|
|
||||||
|
@ -76,21 +76,27 @@ public class NewRepoConfig {
|
|||||||
uri = Uri.parse(uri.toString().toLowerCase(Locale.ENGLISH));
|
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();
|
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;
|
isValidRepo = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make scheme and host lowercase so they're readable in dialogs
|
boolean isFdroidScheme = TextUtils.equals("fdroidrepo", scheme) || TextUtils.equals("fdroidrepos", scheme);
|
||||||
scheme = scheme.toLowerCase(Locale.ENGLISH);
|
|
||||||
host = host.toLowerCase(Locale.ENGLISH);
|
|
||||||
fingerprint = uri.getQueryParameter("fingerprint");
|
fingerprint = uri.getQueryParameter("fingerprint");
|
||||||
bssid = uri.getQueryParameter("bssid");
|
bssid = uri.getQueryParameter("bssid");
|
||||||
ssid = uri.getQueryParameter("ssid");
|
ssid = uri.getQueryParameter("ssid");
|
||||||
fromSwap = uri.getQueryParameter("swap") != null;
|
fromSwap = uri.getQueryParameter("swap") != null;
|
||||||
|
|
||||||
if (!Arrays.asList("fdroidrepos", "fdroidrepo", "https", "http").contains(scheme)) {
|
if (!isFdroidScheme && !isHttpScheme) {
|
||||||
isValidRepo = false;
|
isValidRepo = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user