mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-09 00:40:31 +00:00
adjusted orbot support and moved on to 0.7.2
This commit is contained in:
parent
a8830e2ede
commit
5c492c01a1
@ -36,6 +36,7 @@ NewPipe does not use any Google framework libraries, or the YouTube API. It only
|
|||||||
* Open a video in Kodi
|
* Open a video in Kodi
|
||||||
* Show Next/Related videos
|
* Show Next/Related videos
|
||||||
* Search YouTube in a specific language
|
* Search YouTube in a specific language
|
||||||
|
* Orbot/Tor support (no streaming yet)
|
||||||
|
|
||||||
### Coming Features
|
### Coming Features
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ android {
|
|||||||
applicationId "org.schabi.newpipe"
|
applicationId "org.schabi.newpipe"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 10
|
versionCode 11
|
||||||
versionName "0.7.1"
|
versionName "0.7.2"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -15,10 +15,13 @@ public class App extends Application {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
// if Orbot is installed, then default to using Tor, the user can still override
|
|
||||||
if (OrbotHelper.requestStartTor(this)) {
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
if(prefs.getBoolean(getString(R.string.useTorKey), false)) {
|
||||||
configureTor(prefs.getBoolean(getString(R.string.useTor), true));
|
OrbotHelper.requestStartTor(this);
|
||||||
|
configureTor(true);
|
||||||
|
} else {
|
||||||
|
configureTor(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
package org.schabi.newpipe;
|
package org.schabi.newpipe;
|
||||||
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
@ -47,7 +47,6 @@ import info.guardianproject.netcipher.NetCipher;
|
|||||||
|
|
||||||
public class Downloader {
|
public class Downloader {
|
||||||
public static final String TAG = "Downloader";
|
public static final String TAG = "Downloader";
|
||||||
|
|
||||||
private static final String USER_AGENT = "Mozilla/5.0";
|
private static final String USER_AGENT = "Mozilla/5.0";
|
||||||
|
|
||||||
/**Download the text file at the supplied URL as in download(String),
|
/**Download the text file at the supplied URL as in download(String),
|
||||||
@ -59,7 +58,7 @@ public class Downloader {
|
|||||||
String ret = "";
|
String ret = "";
|
||||||
try {
|
try {
|
||||||
URL url = new URL(siteUrl);
|
URL url = new URL(siteUrl);
|
||||||
HttpsURLConnection con = NetCipher.getHttpsURLConnection(url);
|
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
|
||||||
con.setRequestProperty("Accept-Language", language);
|
con.setRequestProperty("Accept-Language", language);
|
||||||
ret = dl(con);
|
ret = dl(con);
|
||||||
}
|
}
|
||||||
@ -68,8 +67,9 @@ public class Downloader {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**Common functionality between download(String url) and download(String url, String language)*/
|
/**Common functionality between download(String url) and download(String url, String language)*/
|
||||||
private static String dl(HttpURLConnection con) throws IOException {
|
private static String dl(HttpsURLConnection con) throws IOException {
|
||||||
StringBuilder response = new StringBuilder();
|
StringBuilder response = new StringBuilder();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -109,33 +109,24 @@ public class SettingsActivity extends PreferenceActivity {
|
|||||||
(EditTextPreference) findPreference(DOWNLOAD_PATH_PREFERENCE);
|
(EditTextPreference) findPreference(DOWNLOAD_PATH_PREFERENCE);
|
||||||
useTorCheckBox = (CheckBoxPreference) findPreference(USE_TOR_KEY);
|
useTorCheckBox = (CheckBoxPreference) findPreference(USE_TOR_KEY);
|
||||||
|
|
||||||
// if Orbot is installed, then default to using Tor, the user can still override
|
|
||||||
final boolean useTor = OrbotHelper.isOrbotInstalled(activity);
|
|
||||||
useTorCheckBox.setDefaultValue(useTor);
|
|
||||||
useTorCheckBox.setChecked(useTor);
|
|
||||||
useTorCheckBox.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onPreferenceChange(Preference preference, Object o) {
|
|
||||||
boolean useTor = (Boolean) o;
|
|
||||||
if (useTor) {
|
|
||||||
if (OrbotHelper.isOrbotInstalled(activity)) {
|
|
||||||
App.configureTor(true);
|
|
||||||
} else {
|
|
||||||
Intent intent = OrbotHelper.getOrbotInstallIntent(activity);
|
|
||||||
activity.startActivityForResult(intent, REQUEST_INSTALL_ORBOT);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
App.configureTor(false);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
prefListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
|
prefListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
|
||||||
String key) {
|
String key) {
|
||||||
|
Activity a = getActivity();
|
||||||
updateSummary();
|
updateSummary();
|
||||||
|
|
||||||
|
if (defaultPreferences.getBoolean(USE_TOR_KEY, false)) {
|
||||||
|
if (OrbotHelper.isOrbotInstalled(a)) {
|
||||||
|
App.configureTor(true);
|
||||||
|
OrbotHelper.requestStartTor(a);
|
||||||
|
} else {
|
||||||
|
Intent intent = OrbotHelper.getOrbotInstallIntent(a);
|
||||||
|
a.startActivityForResult(intent, REQUEST_INSTALL_ORBOT);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
App.configureTor(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
defaultPreferences.registerOnSharedPreferenceChangeListener(prefListener);
|
defaultPreferences.registerOnSharedPreferenceChangeListener(prefListener);
|
||||||
|
@ -107,6 +107,7 @@ public abstract class VideoExtractor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//todo: add licence field
|
||||||
protected abstract int getErrorCode();
|
protected abstract int getErrorCode();
|
||||||
protected abstract String getErrorMessage();
|
protected abstract String getErrorMessage();
|
||||||
protected abstract String getVideoUrl(String videoId);
|
protected abstract String getVideoUrl(String videoId);
|
||||||
|
@ -75,7 +75,8 @@
|
|||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="@string/useTorKey"
|
android:key="@string/useTorKey"
|
||||||
android:title="@string/useTor"
|
android:title="@string/useTor"
|
||||||
android:summary="@string/useTorSummary" />
|
android:summary="@string/useTorSummary"
|
||||||
|
android:defaultValue="false"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
Loading…
Reference in New Issue
Block a user