mirror of
				https://framagit.org/tom79/fedilab-tube
				synced 2025-06-05 21:09:11 +02:00 
			
		
		
		
	Fix issue #125
This commit is contained in:
		| @@ -54,6 +54,7 @@ import org.jetbrains.annotations.NotNull; | ||||
| import java.io.IOException; | ||||
| import java.net.InetAddress; | ||||
| import java.net.NetworkInterface; | ||||
| import java.net.URL; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Collections; | ||||
| import java.util.Enumeration; | ||||
| @@ -133,6 +134,12 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen | ||||
|                 (dialog, which) -> new Thread(() -> { | ||||
|                     try { | ||||
|                         String newInstance = input.getText().toString().trim(); | ||||
|                         if (!newInstance.startsWith("http")) { | ||||
|                             newInstance = "http://" + newInstance; | ||||
|                         } | ||||
|                         URL url = new URL(newInstance); | ||||
|                         newInstance = url.getHost(); | ||||
|  | ||||
|                         WellKnownNodeinfo.NodeInfo instanceNodeInfo = new RetrofitPeertubeAPI(activity, newInstance, null).getNodeInfo(); | ||||
|                         if (instanceNodeInfo.getSoftware() != null && instanceNodeInfo.getSoftware().getName().trim().toLowerCase().compareTo("peertube") == 0) { | ||||
|                             SharedPreferences.Editor editor = sharedpreferences.edit(); | ||||
| @@ -906,7 +913,7 @@ public class MainActivity extends AppCompatActivity implements ChromeCastsListen | ||||
|                 SharedPreferences.Editor editor = sharedpreferences.edit(); | ||||
|                 editor.putString(Helper.PREF_INSTANCE, String.valueOf(data.getData())); | ||||
|                 editor.commit(); | ||||
|                 finish(); | ||||
|                 recreate(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user