Fix issue with local and invidious

This commit is contained in:
Thomas 2020-06-05 19:02:49 +02:00
parent 0389aaa66a
commit 8353620b72
3 changed files with 23 additions and 13 deletions

View File

@ -438,6 +438,7 @@ public class TransformActivity extends Activity {
return;
} else if (Arrays.asList(invidious_instances).contains(host)) {
boolean invidious_enabled = sharedpreferences.getBoolean(SET_INVIDIOUS_ENABLED, true);
newUrl = url;
if (invidious_enabled) {
String invidiousHost = sharedpreferences.getString(MainActivity.SET_INVIDIOUS_HOST, MainActivity.DEFAULT_INVIDIOUS_HOST).toLowerCase();
if (host != null && host.compareTo(invidiousHost) != 0) {
@ -447,11 +448,13 @@ public class TransformActivity extends Activity {
newUrl = url.replace("https://" + host, invidiousHost).replace("http://" + host, invidiousHost);
}
}
newUrl = Utils.replaceInvidiousParams(TransformActivity.this, newUrl);
}
}
//Transform a Nitter URL from an instance to another one selected by the end user.
else if (Arrays.asList(nitter_instances).contains(host)) {
newUrl = url;
boolean nitter_enabled = sharedpreferences.getBoolean(SET_NITTER_ENABLED, true);
if (nitter_enabled) {
String nitterHost = sharedpreferences.getString(MainActivity.SET_NITTER_HOST, MainActivity.DEFAULT_NITTER_HOST).toLowerCase();
@ -466,6 +469,7 @@ public class TransformActivity extends Activity {
}
//Transform a Bibliogram URL from an instance to another one selected by the end user.
else if (Arrays.asList(bibliogram_instances).contains(host)) {
newUrl = url;
boolean bibliogram_enabled = sharedpreferences.getBoolean(SET_BIBLIOGRAM_ENABLED, true);
if (bibliogram_enabled) {
String bibliogramHost = sharedpreferences.getString(MainActivity.SET_BIBLIOGRAM_HOST, MainActivity.DEFAULT_BIBLIOGRAM_HOST).toLowerCase();

View File

@ -343,9 +343,7 @@ public class Utils {
newUrl = replaceInvidiousParams(context, newUrl);
} else {
newUrl = scheme + invidiousHost + "/" + youtubeId;
if (!url.contains("/channel/")) {
newUrl = replaceInvidiousParams(context, newUrl);
}
newUrl = replaceInvidiousParams(context, newUrl);
}
}
return newUrl;
@ -452,13 +450,15 @@ public class Utils {
//Local
String local = sharedpreferences.getString(context.getString(R.string.invidious_local_mode), "local=true");
if (local.compareTo("-1") == 0) { //Remove value
newUrl = newUrl.replaceAll("&?local=(true|false)", "");
} else if (local.compareTo("0") != 0) { //Change value
if (newUrl.contains("listen=")) {
newUrl = newUrl.replaceAll("local=(true|false)", local);
} else {
newUrl += "&" + local;
if (!url.contains("/channel/")) {
if (local.compareTo("-1") == 0) { //Remove value
newUrl = newUrl.replaceAll("&?local=(true|false)", "");
} else if (local.compareTo("0") != 0) { //Change value
if (newUrl.contains("local=")) {
newUrl = newUrl.replaceAll("local=(true|false)", local);
} else {
newUrl += "&" + local;
}
}
}

View File

@ -1,4 +1,10 @@
Added
- Remember last used app with "Just once" choice
- Allow to use URLs for Nitter, Invidious and Bibliogram custom hots.
- Custom front-end customization applied when sharing a URL
- Remember last used app with "Just once" choice (or double tap) (full)
- Allow to use URLs for Nitter, Invidious and Bibliogram int custom hosts
- Custom front-end customization applied when sharing URLs
Changed
- About page
Fixed
- Issue when managing local=true for Invidious