diff --git a/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java b/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java
index cfb3fe8a4..d8c36e5cb 100644
--- a/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/settings/PeertubeInstanceListFragment.java
@@ -36,7 +36,6 @@ import com.grack.nanojson.JsonStringWriter;
import com.grack.nanojson.JsonWriter;
import org.schabi.newpipe.R;
-import org.schabi.newpipe.extractor.ServiceList;
import org.schabi.newpipe.extractor.services.peertube.PeertubeInstance;
import org.schabi.newpipe.util.Constants;
import org.schabi.newpipe.util.PeertubeHelper;
@@ -219,7 +218,7 @@ public class PeertubeInstanceListFragment extends Fragment {
}
private void addInstance(String url) {
- String cleanUrl = verifyUrl(url);
+ String cleanUrl = cleanUrl(url);
if(null == cleanUrl) return;
progressBar.setVisibility(View.VISIBLE);
Disposable disposable = Single.fromCallable(() -> {
@@ -237,7 +236,7 @@ public class PeertubeInstanceListFragment extends Fragment {
}
@Nullable
- private String verifyUrl(String url){
+ private String cleanUrl(String url){
// if protocol not present, add https
if(!url.startsWith("http")){
url = "https://" + url;
@@ -246,13 +245,13 @@ public class PeertubeInstanceListFragment extends Fragment {
url = url.replaceAll("/$", "");
// only allow https
if (!url.startsWith("https://")) {
- Toast.makeText(getActivity(), "instance url should start with https://", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getActivity(), R.string.peertube_instance_add_https_only, Toast.LENGTH_SHORT).show();
return null;
}
// only allow if not already exists
for (PeertubeInstance instance : instanceList) {
if (instance.getUrl().equals(url)) {
- Toast.makeText(getActivity(), "instance already exists", Toast.LENGTH_SHORT).show();
+ Toast.makeText(getActivity(), R.string.peertube_instance_add_exists, Toast.LENGTH_SHORT).show();
return null;
}
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 18b11db02..5e47f875c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -111,10 +111,12 @@
Default content language
PeerTube instances
Set your favorite peertube instances
- Find the instances that best suit you on https://instances.joinpeertube.org
+ Find the instances that best suit you on https://joinpeertube.org/instances#instances-list
Add instance
- enter instance url
+ Enter instance url
Failed to validate instance
+ Only https urls are supported
+ Instance already exists
Player
Behavior
Video & audio