mirror of https://github.com/LeOS-GSI/LeOS-Genesis
bug fixes
parent
91aab56a7b
commit
6bc71e7464
|
@ -4,7 +4,7 @@ apply plugin: 'maven'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
geckoviewChannel = "nightly"
|
geckoviewChannel = "nightly"
|
||||||
geckoviewVersion = "64.0.20180927100037"
|
geckoviewVersion = "66.0.20181225095124"
|
||||||
}
|
}
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.example.myapplication;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Rect;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
|
||||||
|
public class KeyboardUtils {
|
||||||
|
|
||||||
|
public static void hideKeyboard(Activity activity) {
|
||||||
|
View view = activity.findViewById(android.R.id.content);
|
||||||
|
if (view != null) {
|
||||||
|
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showKeyboard(Activity activity) {
|
||||||
|
InputMethodManager inputMethodManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addKeyboardVisibilityListener(View rootLayout, OnKeyboardVisibiltyListener onKeyboardVisibiltyListener) {
|
||||||
|
rootLayout.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
|
||||||
|
Rect r = new Rect();
|
||||||
|
rootLayout.getWindowVisibleDisplayFrame(r);
|
||||||
|
int screenHeight = rootLayout.getRootView().getHeight();
|
||||||
|
|
||||||
|
// r.bottom is the position above soft keypad or device button.
|
||||||
|
// if keypad is shown, the r.bottom is smaller than that before.
|
||||||
|
int keypadHeight = screenHeight - r.bottom;
|
||||||
|
|
||||||
|
boolean isVisible = keypadHeight > screenHeight * 0.15; // 0.15 ratio is perhaps enough to determine keypad height.
|
||||||
|
onKeyboardVisibiltyListener.onVisibilityChange(isVisible);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface OnKeyboardVisibiltyListener {
|
||||||
|
void onVisibilityChange(boolean isVisible);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,9 +4,11 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.os.Handler;
|
||||||
import android.support.constraint.ConstraintLayout;
|
import android.support.constraint.ConstraintLayout;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.util.Log;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -22,6 +24,7 @@ import java.util.Stack;
|
||||||
|
|
||||||
import info.guardianproject.netcipher.proxy.OrbotHelper;
|
import info.guardianproject.netcipher.proxy.OrbotHelper;
|
||||||
import org.mozilla.gecko.PrefsHelper;
|
import org.mozilla.gecko.PrefsHelper;
|
||||||
|
import org.mozilla.geckoview.GeckoDisplay;
|
||||||
import org.mozilla.geckoview.GeckoRuntime;
|
import org.mozilla.geckoview.GeckoRuntime;
|
||||||
import org.mozilla.geckoview.GeckoSession;
|
import org.mozilla.geckoview.GeckoSession;
|
||||||
import org.mozilla.geckoview.GeckoView;
|
import org.mozilla.geckoview.GeckoView;
|
||||||
|
@ -46,6 +49,10 @@ public class application_controller extends AppCompatActivity
|
||||||
private GeckoSession session1;
|
private GeckoSession session1;
|
||||||
private GeckoRuntime runtime1;
|
private GeckoRuntime runtime1;
|
||||||
private String version_code = "1.0";
|
private String version_code = "1.0";
|
||||||
|
private boolean wasBackPressed = false;
|
||||||
|
private boolean isLoadedUrlSet = false;
|
||||||
|
private boolean isOnnionUrlHalted = false;
|
||||||
|
Handler handler = null;
|
||||||
|
|
||||||
/*helper Variables*/
|
/*helper Variables*/
|
||||||
Stack traceUrlList = new Stack<String>();
|
Stack traceUrlList = new Stack<String>();
|
||||||
|
@ -71,11 +78,8 @@ public class application_controller extends AppCompatActivity
|
||||||
{
|
{
|
||||||
message_manager.getInstance().versionWarning(this);
|
message_manager.getInstance().versionWarning(this);
|
||||||
}
|
}
|
||||||
if(version.equals("none"))
|
|
||||||
{
|
|
||||||
webRequestHandler.getInstance().getVersion(this);
|
webRequestHandler.getInstance().getVersion(this);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void initializeAds()
|
public void initializeAds()
|
||||||
{
|
{
|
||||||
|
@ -90,8 +94,7 @@ public class application_controller extends AppCompatActivity
|
||||||
PrefsHelper.setPref("network.proxy.socks_version",5); //manual proxy settings
|
PrefsHelper.setPref("network.proxy.socks_version",5); //manual proxy settings
|
||||||
PrefsHelper.setPref("network.proxy.socks_remote_dns",true); //manual proxy settings
|
PrefsHelper.setPref("network.proxy.socks_remote_dns",true); //manual proxy settings
|
||||||
PrefsHelper.setPref("browser.cache.disk.enable",false);
|
PrefsHelper.setPref("browser.cache.disk.enable",false);
|
||||||
PrefsHelper.setPref("browser.cache.memory.enable",true);
|
PrefsHelper.setPref("browser.cache.memory.enable",false);
|
||||||
PrefsHelper.setPref("browser.cache.disk.capacity",0);
|
|
||||||
PrefsHelper.setPref("general.useragent.override", "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0");
|
PrefsHelper.setPref("general.useragent.override", "Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20100101 Firefox/17.0");
|
||||||
PrefsHelper.setPref("privacy.donottrackheader.enabled",false);
|
PrefsHelper.setPref("privacy.donottrackheader.enabled",false);
|
||||||
PrefsHelper.setPref("privacy.donottrackheader.value",1);
|
PrefsHelper.setPref("privacy.donottrackheader.value",1);
|
||||||
|
@ -173,7 +176,14 @@ public class application_controller extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url)
|
public boolean shouldOverrideUrlLoading(WebView view, String url)
|
||||||
{
|
{
|
||||||
|
if(url.equals(searchbar.getText().toString()))
|
||||||
|
{
|
||||||
|
view.stopLoading();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
searchbar.setText(url.replaceAll("boogle.store","genesis.onion"));
|
searchbar.setText(url.replaceAll("boogle.store","genesis.onion"));
|
||||||
|
KeyboardUtils.hideKeyboard(application_controller.this);
|
||||||
|
|
||||||
if(!url.toString().contains("boogle"))
|
if(!url.toString().contains("boogle"))
|
||||||
{
|
{
|
||||||
|
@ -182,11 +192,17 @@ public class application_controller extends AppCompatActivity
|
||||||
boolean init_status=orbot_manager.getInstance().reinitOrbot(application_controller.this);
|
boolean init_status=orbot_manager.getInstance().reinitOrbot(application_controller.this);
|
||||||
if(!init_status)
|
if(!init_status)
|
||||||
{
|
{
|
||||||
|
progressBar.setAlpha(0);
|
||||||
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
progressBar.animate().setDuration(300).alpha(1f);
|
||||||
|
|
||||||
|
isOnnionUrlHalted = false;
|
||||||
|
session1.stop();
|
||||||
session1.close();
|
session1.close();
|
||||||
|
webLoader.releaseSession();
|
||||||
session1 = new GeckoSession();
|
session1 = new GeckoSession();
|
||||||
session1.open(runtime1);
|
session1.open(runtime1);
|
||||||
session1.setProgressDelegate(new progressDelegate());
|
session1.setProgressDelegate(new progressDelegate());
|
||||||
webLoader.releaseSession();
|
|
||||||
webLoader.setSession(session1);
|
webLoader.setSession(session1);
|
||||||
|
|
||||||
session1.loadUri(url);
|
session1.loadUri(url);
|
||||||
|
@ -200,7 +216,7 @@ public class application_controller extends AppCompatActivity
|
||||||
traceUrlList.add(status.currentURL);
|
traceUrlList.add(status.currentURL);
|
||||||
status.currentURL = url;
|
status.currentURL = url;
|
||||||
}
|
}
|
||||||
|
Log.i("WOW1",url);
|
||||||
loadURLAnimate(url);
|
loadURLAnimate(url);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -210,6 +226,8 @@ public class application_controller extends AppCompatActivity
|
||||||
{
|
{
|
||||||
super.onPageFinished(view, url);
|
super.onPageFinished(view, url);
|
||||||
|
|
||||||
|
webView1.stopLoading();
|
||||||
|
webView2.stopLoading();
|
||||||
webView1.animate().setDuration(250).alpha(1f);
|
webView1.animate().setDuration(250).alpha(1f);
|
||||||
webView2.animate().setDuration(250).alpha(1f).withEndAction((() -> {
|
webView2.animate().setDuration(250).alpha(1f).withEndAction((() -> {
|
||||||
datamodel.getInstance().setIsLoadingURL(false);
|
datamodel.getInstance().setIsLoadingURL(false);
|
||||||
|
@ -241,7 +259,8 @@ public class application_controller extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
|
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
|
||||||
{
|
{
|
||||||
System.out.println("SUP2");
|
Log.i("SUP2",errorCode+"");
|
||||||
|
System.out.println("SUP2 : " + errorCode);
|
||||||
requestFailure.setVisibility(View.VISIBLE);
|
requestFailure.setVisibility(View.VISIBLE);
|
||||||
requestFailure.animate().alpha(1.0f);
|
requestFailure.animate().alpha(1.0f);
|
||||||
loadErrorPage();
|
loadErrorPage();
|
||||||
|
@ -273,14 +292,21 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
@Override
|
@Override
|
||||||
public void onPageStart(GeckoSession session, String url)
|
public void onPageStart(GeckoSession session, String url)
|
||||||
{
|
{
|
||||||
|
if(isOnnionUrlHalted)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoadedUrlSet = false;
|
||||||
|
KeyboardUtils.hideKeyboard(application_controller.this);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
URL host = new URL(url);
|
URL host = new URL(url);
|
||||||
if(!host.getHost().contains("onion"))
|
if(!host.getHost().contains("onion"))
|
||||||
{
|
{
|
||||||
session1.stop();
|
session1.stop();
|
||||||
session1.close();
|
//session1.close();
|
||||||
session1.stop();
|
//session1.stop();
|
||||||
message_manager.getInstance().baseURLError(application_controller.this);
|
message_manager.getInstance().baseURLError(application_controller.this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,10 +319,9 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
boolean isBlackPage = url.equals("about:blank");
|
boolean isBlackPage = url.equals("about:blank");
|
||||||
if(!isBlackPage)
|
if(!isBlackPage)
|
||||||
{
|
{
|
||||||
traceUrlList.add(status.currentURL);
|
searchbar.setText(url);
|
||||||
status.currentURL = url;
|
|
||||||
}
|
}
|
||||||
if(!isBlackPage)
|
if(!isBlackPage && progressBar.getVisibility() == View.INVISIBLE)
|
||||||
{
|
{
|
||||||
progressBar.setAlpha(0);
|
progressBar.setAlpha(0);
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
|
@ -306,20 +331,51 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
@Override
|
@Override
|
||||||
public void onPageStop(GeckoSession session, boolean success)
|
public void onPageStop(GeckoSession session, boolean success)
|
||||||
{
|
{
|
||||||
progressBar.animate().alpha(0f);
|
handler = new Handler();
|
||||||
|
handler.postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
progressBar.animate().alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
|
||||||
datamodel.getInstance().setIsLoadingURL(false);
|
datamodel.getInstance().setIsLoadingURL(false);
|
||||||
|
message_manager.getInstance().URLNotFoundError(application_controller.this);
|
||||||
|
}
|
||||||
|
}, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChange(GeckoSession session, int progress)
|
public void onProgressChange(GeckoSession session, int progress)
|
||||||
{
|
{
|
||||||
if(progress>=50 && webLoader.getVisibility()==View.INVISIBLE)
|
if(progress>=100)
|
||||||
|
{
|
||||||
|
if(!isLoadedUrlSet &&!isOnnionUrlHalted)
|
||||||
{
|
{
|
||||||
webLoader.bringToFront();
|
webLoader.bringToFront();
|
||||||
webLoader.animate().setDuration(100).alpha(1);
|
webLoader.animate().setDuration(100).alpha(1);
|
||||||
webLoader.setVisibility(View.VISIBLE);
|
webLoader.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
requestFailure.animate().alpha(0f).setDuration(300).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE)));;
|
requestFailure.animate().alpha(0f).setDuration(300).withEndAction((() -> requestFailure.setVisibility(View.INVISIBLE)));;
|
||||||
|
|
||||||
|
String url = searchbar.getText().toString();
|
||||||
|
boolean isBlackPage = url.equals("about:blank");
|
||||||
|
if(!isBlackPage && !wasBackPressed)
|
||||||
|
{
|
||||||
|
Log.i("SHIT1 : ",status.currentURL);
|
||||||
|
traceUrlList.add(status.currentURL);
|
||||||
|
searchbar.setText(url);
|
||||||
|
status.currentURL = url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isLoadedUrlSet = true;
|
||||||
|
}
|
||||||
|
if(progress>=100)
|
||||||
|
{
|
||||||
|
progressBar.animate().alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
|
||||||
|
datamodel.getInstance().setIsLoadingURL(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(handler!=null)
|
||||||
|
{
|
||||||
|
handler.removeCallbacksAndMessages(null);
|
||||||
|
handler= null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,13 +402,25 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
|
|
||||||
public void onHomeButtonPressed(View view)
|
public void onHomeButtonPressed(View view)
|
||||||
{
|
{
|
||||||
session1.stop();
|
webRequestHandler.getInstance().isUrlStoped=true;
|
||||||
session1.close();
|
status.currentURL="https://boogle.store/";
|
||||||
session1.stop();
|
searchbar.setText("https://boogle.store/");
|
||||||
|
//webLoader.releaseSession();
|
||||||
|
//session1 = new GeckoSession();
|
||||||
|
//session1.open(runtime1);
|
||||||
|
//session1.setProgressDelegate(new progressDelegate());
|
||||||
|
//webLoader.setSession(session1);
|
||||||
progressBar.animate().alpha(0f);
|
progressBar.animate().alpha(0f);
|
||||||
progressBar.setVisibility(View.VISIBLE);
|
progressBar.setVisibility(View.VISIBLE);
|
||||||
progressBar.animate().setDuration(300).alpha(1f);
|
progressBar.animate().setDuration(300).alpha(1f);
|
||||||
loadURLAnimate("http://boogle.store/");
|
webView1.stopLoading();
|
||||||
|
webView2.stopLoading();
|
||||||
|
loadURLAnimate("https://boogle.store/");
|
||||||
|
session1.close();
|
||||||
|
isOnnionUrlHalted = true;
|
||||||
|
wasBackPressed = false;
|
||||||
|
KeyboardUtils.hideKeyboard(application_controller.this);
|
||||||
|
webRequestHandler.getInstance().isUrlStoped=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onReloadButtonPressed(View view)
|
public void onReloadButtonPressed(View view)
|
||||||
|
@ -366,6 +434,7 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed()
|
public void onBackPressed()
|
||||||
{
|
{
|
||||||
|
session1.stop();
|
||||||
orbot_manager.getInstance().reinitOrbot(this);
|
orbot_manager.getInstance().reinitOrbot(this);
|
||||||
if(traceUrlList.size()>0)
|
if(traceUrlList.size()>0)
|
||||||
{
|
{
|
||||||
|
@ -374,17 +443,26 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
{
|
{
|
||||||
if(!status.currentURL.contains("boogle.store"))
|
if(!status.currentURL.contains("boogle.store"))
|
||||||
{
|
{
|
||||||
|
Log.i("FITS4 : " , "");
|
||||||
|
isOnnionUrlHalted=true;
|
||||||
|
session1.stop();
|
||||||
|
session1.close();
|
||||||
|
webLoader.releaseSession();
|
||||||
status.currentURL = traceUrlList.pop().toString();
|
status.currentURL = traceUrlList.pop().toString();
|
||||||
progressBar.animate().alpha(0f);
|
progressBar.animate().alpha(0f).withEndAction((() -> progressBar.setVisibility(View.INVISIBLE)));;
|
||||||
webLoader.animate().setDuration(250).alpha(0);
|
webLoader.animate().alpha(0f).withEndAction((() -> webLoader.setVisibility(View.INVISIBLE)));;
|
||||||
webLoader.setVisibility(View.INVISIBLE);
|
isOnnionUrlHalted = true;
|
||||||
|
wasBackPressed = false;
|
||||||
|
KeyboardUtils.hideKeyboard(application_controller.this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
session1.close();
|
||||||
|
Log.i("FITS3 : " , "");
|
||||||
loadURLAnimate(traceUrlList.pop().toString());
|
loadURLAnimate(traceUrlList.pop().toString());
|
||||||
if(traceUrlList.size()<=0)
|
if(traceUrlList.size()<=0)
|
||||||
{
|
{
|
||||||
status.currentURL = "http://boogle.store/";
|
status.currentURL = "https://boogle.store/";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -396,33 +474,49 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
{
|
{
|
||||||
if(traceUrlList.size()<=0 || traceUrlList.peek().toString().contains("boogle.store"))
|
if(traceUrlList.size()<=0 || traceUrlList.peek().toString().contains("boogle.store"))
|
||||||
{
|
{
|
||||||
status.currentURL = "http://boogle.store/";
|
Log.i("FITS2 : " , "");
|
||||||
|
status.currentURL = "https://boogle.store/";
|
||||||
webLoader.animate().setDuration(250).alpha(0);
|
webLoader.animate().setDuration(250).alpha(0);
|
||||||
|
traceUrlList.pop();
|
||||||
|
wasBackPressed = false;
|
||||||
|
session1.close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
webLoader.animate().setDuration(250).alpha(1);
|
webLoader.animate().setDuration(250).alpha(1);
|
||||||
status.currentURL = traceUrlList.peek().toString();
|
status.currentURL = traceUrlList.peek().toString();
|
||||||
}
|
String prevURL = traceUrlList.pop().toString();
|
||||||
traceUrlList.pop();
|
Log.i("FITS : " , prevURL);
|
||||||
session1.stop();
|
|
||||||
session1.close();
|
|
||||||
session1.stop();
|
|
||||||
session1.goBack();
|
session1.goBack();
|
||||||
|
wasBackPressed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(traceUrlList.size()==0)
|
if(traceUrlList.size()==0)
|
||||||
{
|
{
|
||||||
searchbar.setText("http://genesis.onion/");
|
searchbar.setText("https://genesis.onion/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadGeckoUrl(String url)
|
||||||
|
{
|
||||||
|
session1.close();
|
||||||
|
session1 = new GeckoSession();
|
||||||
|
session1.open(runtime1);
|
||||||
|
session1.setProgressDelegate(new application_controller.progressDelegate());
|
||||||
|
webLoader.releaseSession();
|
||||||
|
webLoader.setSession(session1);
|
||||||
|
session1.loadUri(url);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean onEditorClicked(TextView v, int actionId, KeyEvent event)
|
public boolean onEditorClicked(TextView v, int actionId, KeyEvent event)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
session1.stop();
|
session1.stop();
|
||||||
session1.close();
|
webView1.stopLoading();
|
||||||
|
webView2.stopLoading();
|
||||||
|
//session1.close();
|
||||||
String url = v.getText().toString();
|
String url = v.getText().toString();
|
||||||
if(!url.startsWith("www.")&& !url.startsWith("http://")&& !url.startsWith("https://")){
|
if(!url.startsWith("www.")&& !url.startsWith("http://")&& !url.startsWith("https://")){
|
||||||
url = "www."+url;
|
url = "www."+url;
|
||||||
|
@ -444,15 +538,9 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
}
|
}
|
||||||
else if(host.getHost().contains(constants.allowedHost))
|
else if(host.getHost().contains(constants.allowedHost))
|
||||||
{
|
{
|
||||||
if(!orbot_manager.getInstance().reinitOrbot(this.getApplicationContext()))
|
if(!orbot_manager.getInstance().reinitOrbot(this))
|
||||||
{
|
{
|
||||||
session1.close();
|
session1.stop();
|
||||||
session1 = new GeckoSession();
|
|
||||||
session1.open(runtime1);
|
|
||||||
session1.setProgressDelegate(new application_controller.progressDelegate());
|
|
||||||
webLoader.releaseSession();
|
|
||||||
webLoader.setSession(session1);
|
|
||||||
|
|
||||||
session1.loadUri(url);
|
session1.loadUri(url);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -465,17 +553,20 @@ class progressDelegate implements GeckoSession.ProgressDelegate
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
loadURLAnimate("http://boogle.store/search?q="+v.getText().toString().replaceAll(" ","+")+"&p_num=1&s_type=all");
|
loadURLAnimate("https://boogle.store/search?q="+v.getText().toString().replaceAll(" ","+")+"&p_num=1&s_type=all");
|
||||||
}
|
}
|
||||||
orbot_manager.getInstance().reinitOrbot(this.getApplicationContext());
|
orbot_manager.getInstance().reinitOrbot(this);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
loadURLAnimate("http://boogle.store/search?q="+v.getText().toString().replaceAll(" ","+")+"&p_num=1&s_type=all");
|
loadURLAnimate("https://boogle.store/search?q="+v.getText().toString().replaceAll(" ","+")+"&p_num=1&s_type=all");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.example.myapplication;
|
||||||
|
|
||||||
public class constants
|
public class constants
|
||||||
{
|
{
|
||||||
public static String backendUrl = "http://boogle.store";
|
public static String backendUrl = "https://boogle.store";
|
||||||
public static String backendUrlHost = "boogle.store";
|
public static String backendUrlHost = "boogle.store";
|
||||||
public static String frontEndUrlHost = "genesis.store";
|
public static String frontEndUrlHost = "genesis.store";
|
||||||
public static String allowedHost = ".onion";
|
public static String allowedHost = ".onion";
|
||||||
|
|
|
@ -27,6 +27,16 @@ public class message_manager {
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void URLNotFoundError(Context application_context)
|
||||||
|
{
|
||||||
|
new LovelyInfoDialog(application_context)
|
||||||
|
.setTopColorRes(R.color.header)
|
||||||
|
.setIcon(R.drawable.logo)
|
||||||
|
.setTitle("URL Temporarily Unavailable")
|
||||||
|
.setMessage("Site is Down or temporarily Unavailabe. Try again after a while")
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
|
||||||
public void startingOrbotInfo(Context application_context)
|
public void startingOrbotInfo(Context application_context)
|
||||||
{
|
{
|
||||||
new LovelyInfoDialog(application_context)
|
new LovelyInfoDialog(application_context)
|
||||||
|
|
|
@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.support.constraint.ConstraintLayout;
|
import android.support.constraint.ConstraintLayout;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
@ -39,9 +40,11 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
|
||||||
private int currentViewIndex = 0;
|
private int currentViewIndex = 0;
|
||||||
private String html = "";
|
private String html = "";
|
||||||
private String baseURL = "";
|
private String baseURL = "";
|
||||||
private Thread clientThread = null;
|
public Thread clientThread = null;
|
||||||
HttpGet request = null;
|
HttpGet request = null;
|
||||||
private Handler updateUIHandler = null;
|
private Handler updateUIHandler = null;
|
||||||
|
public boolean isUrlStoped = false;
|
||||||
|
private String currenturl = "";
|
||||||
|
|
||||||
private final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1;
|
private final static int MESSAGE_UPDATE_TEXT_CHILD_THREAD =1;
|
||||||
private final static int INTERNET_ERROR =2;
|
private final static int INTERNET_ERROR =2;
|
||||||
|
@ -70,8 +73,19 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if(!currenturl.equals(url))
|
||||||
|
{
|
||||||
|
currenturl = url;
|
||||||
preInitialization(url);
|
preInitialization(url);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//progressBar.animate().setDuration(0).alpha(0f).withEndAction((() -> {
|
||||||
|
// progressBar.setVisibility(View.INVISIBLE);
|
||||||
|
//}));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -80,6 +94,7 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
|
||||||
clientThread = new Thread(() -> {
|
clientThread = new Thread(() -> {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
currenturl = url;
|
||||||
if(url.contains("boogle.store"))
|
if(url.contains("boogle.store"))
|
||||||
{
|
{
|
||||||
nonProxyConnection(url);
|
nonProxyConnection(url);
|
||||||
|
@ -91,9 +106,13 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
onError();
|
if(!isUrlStoped)
|
||||||
|
{
|
||||||
|
Log.i("SUP3",e.getMessage()+"");
|
||||||
|
//onError();
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
clientThread.start();
|
clientThread.start();
|
||||||
}
|
}
|
||||||
|
@ -120,6 +139,8 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
|
||||||
}
|
}
|
||||||
|
|
||||||
public void nonProxyConnection(String url) throws IOException {
|
public void nonProxyConnection(String url) throws IOException {
|
||||||
|
url = url.replace("http://boogle","https://boogle");
|
||||||
|
|
||||||
HttpClient client = new DefaultHttpClient();
|
HttpClient client = new DefaultHttpClient();
|
||||||
request = new HttpGet(url);
|
request = new HttpGet(url);
|
||||||
baseURL = url;
|
baseURL = url;
|
||||||
|
@ -139,6 +160,7 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
|
||||||
Message message = new Message();
|
Message message = new Message();
|
||||||
message.what = MESSAGE_UPDATE_TEXT_CHILD_THREAD;
|
message.what = MESSAGE_UPDATE_TEXT_CHILD_THREAD;
|
||||||
updateUIHandler.sendMessage(message);
|
updateUIHandler.sendMessage(message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void proxyConnection(String url) throws Exception {
|
public void proxyConnection(String url) throws Exception {
|
||||||
|
@ -241,7 +263,7 @@ public class webRequestHandler implements StrongBuilder.Callback<HttpClient>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
String webPage = "http://boogle.store/version";
|
String webPage = "https://boogle.store/version";
|
||||||
URL url = new URL(webPage);
|
URL url = new URL(webPage);
|
||||||
URLConnection urlConnection = null;
|
URLConnection urlConnection = null;
|
||||||
urlConnection = url.openConnection();
|
urlConnection = url.openConnection();
|
||||||
|
|
|
@ -135,13 +135,13 @@
|
||||||
android:background="@drawable/searchbar"
|
android:background="@drawable/searchbar"
|
||||||
android:textCursorDrawable="@drawable/cursorcolor"
|
android:textCursorDrawable="@drawable/cursorcolor"
|
||||||
android:hint="Search or type web address"
|
android:hint="Search or type web address"
|
||||||
android:text="http://genesis.onion"
|
android:text="https://genesis.onion"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
|
android:inputType="textNoSuggestions"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:inputType="text"
|
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:id="@+id/search" android:layout_weight="1"/>
|
android:id="@+id/search" android:layout_weight="1"/>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue