Browse Source

add support for proxying over Orbot (Tor) proxying

master
n8fr8 11 years ago
parent
commit
eecf5be200
  1. 3
      .gitmodules
  2. 1
      AndroidManifest.xml
  3. 1
      external/netcipher
  4. 1
      res/values/strings.xml
  5. 63
      src/acr/browser/lightning/BrowserActivity.java
  6. 7
      src/acr/browser/lightning/BrowserApp.java

3
.gitmodules vendored

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
[submodule "external/netcipher"]
path = external/netcipher
url = https://github.com/guardianproject/NetCipher.git

1
AndroidManifest.xml

@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
android:targetSdkVersion="19" />
<application
android:name="acr.browser.lightning.BrowserApp"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_launcher"

1
external/netcipher vendored

@ -0,0 +1 @@ @@ -0,0 +1 @@
Subproject commit ba9d13676669f7ef32df43a023a4d4a33385e013

1
res/values/strings.xml

@ -158,5 +158,6 @@ @@ -158,5 +158,6 @@
<string name="powered_by_google">Powered by Google</string>
<string name="title_adblock">AdBlock</string>
<string name="message_adblock">AdBlock is currently only available in the browser\'s paid version, Lightning Browser+. It is available to download on Google Play.</string>
<string name="use_tor_prompt">It looks like you have Orbot installed. Do you want to use Tor?</string>
</resources>

63
src/acr/browser/lightning/BrowserActivity.java

@ -4,6 +4,9 @@ @@ -4,6 +4,9 @@
package acr.browser.lightning;
import info.guardianproject.onionkit.ui.OrbotHelper;
import info.guardianproject.onionkit.web.WebkitProxy;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@ -73,27 +76,27 @@ import android.view.Window; @@ -73,27 +76,27 @@ import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient.CustomViewCallback;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient.CustomViewCallback;
import android.webkit.WebIconDatabase;
import android.webkit.WebView;
import android.webkit.WebView.HitTestResult;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.AutoCompleteTextView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.VideoView;
import android.widget.TextView.OnEditorActionListener;
import android.widget.VideoView;
public class BrowserActivity extends Activity implements BrowserController {
private static DrawerLayout mDrawerLayout;
@ -445,6 +448,58 @@ public class BrowserActivity extends Activity implements BrowserController { @@ -445,6 +448,58 @@ public class BrowserActivity extends Activity implements BrowserController {
WebIconDatabase.getInstance().open(
getDir("icons", MODE_PRIVATE).getPath());
}
checkForTor ();
}
/*
* If Orbot/Tor is installed, prompt the user if they want to enable proxying for this session
*/
public void checkForTor ()
{
OrbotHelper oh = new OrbotHelper(this);
if (oh.isOrbotInstalled())
{
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which){
case DialogInterface.BUTTON_POSITIVE:
initializeTor ();
break;
case DialogInterface.BUTTON_NEGATIVE:
//No button clicked
break;
}
}
};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.use_tor_prompt).setPositiveButton(android.R.string.yes, dialogClickListener)
.setNegativeButton(android.R.string.no, dialogClickListener).show();
}
}
/*
* Initialize WebKit Proxying for Tor
*/
public void initializeTor ()
{
OrbotHelper oh = new OrbotHelper(this);
if (!oh.isOrbotRunning())
oh.requestOrbotStart(this);
WebkitProxy wkp = new WebkitProxy();
try {
wkp.setProxy("acr.browser.lightning.BrowserApp", getApplicationContext(), "localhost",8118);
} catch (Exception e) {
Log.d("Lightning","error enabling web proxying",e);
}
}
public synchronized void initializeTabs() {

7
src/acr/browser/lightning/BrowserApp.java

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
package acr.browser.lightning;
import android.app.Application;
public class BrowserApp extends Application {
}
Loading…
Cancel
Save